locked
How Do I Move My VHD Virtual Drive Used for Native Boot to a New Patition or Drive

    Question

  • Hello!

    I am trying to workaround the task to move my VHD drive I am currently using to natively boot into the Windows Developer Preview to a new drive.

    Could somebody please help me understand how do I do that without a hassle?

    I am using dual boot Windows Developer Preview and Windows 7. Both 64-bit flavors.

    That's the story.

    1. I had a Windows 7 x64 setup.

    The Windows folder is located on the boot partition multi(0)disk(0)rdisk(0)partition(2)

    The BCD database is located on the System Reserved partition multi(0)disk(0)rdisk(0)partition(1)

    2. I installed Windows Developer Preview to a VHD file that I stored on the multi(0)disk(0)rdisk(0)partition(3) partition like:

     

    DISKPART> list vdisk

      VDisk ###  Disk ###  State                 Type       File
      ---------  --------  --------------------  ---------  ----
      VDisk 0    Disk 1    Attached not open     Fixed       \Device\HarddiskVolume3\VM\wdp\wdp.vhd

     

    (The HarddiskVolume3 had drive letter D: assigned in Windows 7 environment).

    3. Now, when the Windows Developer Preview is set as a default OS and its boot manager is used by default, I want to move the wdp.vhd to a new HDD drive on partition:

    multi(0)disk(0)rdisk(1)partition(1)

    The question is: how do I move the VHD file correctly so that I don't lose the ability to boot into either of the operating systems after I move the VHD?

    Currently I cannot edit the BCD database from within Windows Developer Preview environment. When I execute the bcdedit, I get access denied:

    C:\Users\EH>bcdedit /v
    The boot configuration data store could not be opened.
    Access is denied.

    I believe that is because the boot files, which are currently stored on System Reserved partition, do not have the SID of my new NTAUTHORITY\SYSTEM ACE in their ACLs.

     

    I would highly appreciate your help.

    Thank you.


    Well this is the world we live in And these are the hands we're given...
    Tuesday, October 4, 2011 9:45 AM

Answers

  • You have booted WindowsDevPrev and OSDevice and ApplicationDevice is displayed as \Device\HarddiskVolume4(C:)

    This is not a real disk drive - you are inside the VHD - I assume first partition of VirtualHardDisk is mapped to \Device\HarddiskVolume4.

    I would not mess with VHD when I am booted to the same VHD !

    OK.

    If you can boot to Windows Server R2 without attaching the VHD.

    Then see what is displayed for your VHD (in WinDevPrev loader + recovery loader + ramdisk options).

    OSDevice and ApplicationDevice point to the same location = full_path to VHD.

    If you move VHD to another "drive:\folder\VHDfile" you have to adjust OSDevice and ApplicationDevice to point to this new "drive:\folder\VHDfile".

    The same changes must be applied for corresponding Recovery Loader and for corresponding Ramdisk Options(SdiDevice).

    -----------------------------------------------------------------------------------

    If you are not sure what to do you can go another way.

    Visual BCD Editor can automatically create loaders for every installed Windows version.

    If you delete all entries in BCD for WinDevPrev (loader, recovery loader and ramdisk options)

    Then attach VHD in Disk Management.

    Then in Visual BCD Editor right-click in tree view and select "Create missing Windows loaders" this will create the loader for WDP installed inside the VHD.

    Later when booted in WDP on command prompt with admin rights:

    ReAgentC /disable

    ReAgentC /enable

    This two commands will recreate the BCD entries for the recovery environment loader.

    Resume loaders are created automatically by the operating system when booting to it.

    Wednesday, October 5, 2011 2:39 PM

All replies

  • On Tue, 4 Oct 2011 09:45:37 +0000, Exotic Hadron wrote:

    C:\Users\EH>bcdedit /v
    The boot configuration data store could not be opened.
    Access is denied.

    Are you running this from an elevated command prompt?


    Paul Adare
    MVP - Identity Lifecycle Manager
    http://www.identit.ca
    Program:  What commercials try to do to us.

    Tuesday, October 4, 2011 11:49 AM
  • Sure. I typed at the prompt:

    runas /trustlevel:0x40000 cmd

    and ran bcdedit /v at the elevated prompt.

    Am I doing it wrong?

    By the way, it seems like Windows now automatically asks for elevation when need be. Even if the exe file does not have *.setup|install.* key in its name.


    Well this is the world we live in And these are the hands we're given...
    Tuesday, October 4, 2011 1:02 PM
  • On Tue, 4 Oct 2011 13:02:14 +0000, Exotic Hadron wrote:

    Sure. I typed at the prompt:

    runas /trustlevel:0x40000 cmd

    and ran bcdedit /v at the elevated prompt.

    Am I doing it wrong?

    Try just typing cmd at the Start screen, right-click on cmd, click Advanced
    and then Run an Administrator.


    Paul Adare
    MVP - Identity Lifecycle Manager
    http://www.identit.ca
    The attention span of a computer is only as long as its power cord.

    Tuesday, October 4, 2011 1:24 PM
  • Heck! How silly of me! That worked. That provided with the different security descriptor list.

    Why didn't /trustlevel parameter work here?

    Also, running /trustlevel:unrestricted returned

    C:\Users\EH>runas /trustlevel:unrestricted cmd
    RUNAS ERROR: Unable to run - cmd
    1260: This program is blocked by group policy. For more information, contact you
    r system administrator.

    I checked RSOP for Computer Configuration|Windows Settings|Security Settings|Local Policies|Security Options and none of User Account Control:* policies were applied by domain policies. What could it indicate?

     

    Thanks for help.

     

    Still, what would be the practice to move the VHD provided the aforementioned criteria?


    Well this is the world we live in And these are the hands we're given...

    Tuesday, October 4, 2011 1:52 PM
  • Download Visual BCD Editor from http://boyans.my3gb.com and install.

    1. Copy VHD file to new location. Attach it in Disk Management.

    2. Run Visual BCD Editor. Select loader for VHD.

    Edit all 'drive' + 'path' to point to new location of VHD. This includes:

    'ApplicationDevice', 'ApplicationPath', 'OSDevice'

    3. The same applies for VHD recovery loader, VHD resume loader and corresponding device options (ramdisk options) !

    • Proposed as answer by BoYans Wednesday, October 5, 2011 7:01 AM
    • Unproposed as answer by Exotic Hadron Wednesday, October 5, 2011 7:42 AM
    Wednesday, October 5, 2011 7:01 AM
  • Hi Boyans,

    Thanks for the tip.

    Indeed, I've started my BCD story with your tool, yet before I installed the WDP. To tell the truth, the boot entry that I've created didn't work. Seems like I messed something somewhere. 

    I understand that it IS helpful, but first, could you please explain what exactly should be changed and where?

    I have the following settings for loaders:

    Windows Server 2008 R2

    Windows Recovery Environment (First record; I believe this is the WinRE for Windows Server 2008 R2)


    Well this is the world we live in And these are the hands we're given...

    Wednesday, October 5, 2011 8:25 AM
  • Windows Developer Preview

    Windows Recovery Environment (Second record; I believe this is the WinRE for Windows Development Preview)

    Could you please help me here? What do I have to change to move the VHD?


    Well this is the world we live in And these are the hands we're given...
    Wednesday, October 5, 2011 9:10 AM
  • On Wed, 5 Oct 2011 09:10:31 +0000, Exotic Hadron wrote:

    Could you please help me here? What do I have to change to move the VHD?

    I wouldn't bother messing around with 3rd party tools as you can easily do
    this with bcdedit:

    bcdedit /set {guid} device vhd=[locate]\some.vhd
    bcdedit /set {guid} osdevice vhd=[locate]\some.vhd

    Where the {guid} is the GUID currently being used to boot your VHD install.


    Paul Adare
    MVP - Identity Lifecycle Manager
    http://www.identit.ca
    In computer science, we stand on each other's feet.  -- Brian Reid

    Wednesday, October 5, 2011 10:48 AM
  • Thank you for your reply. Provided the screens above what would be the GUID I need to enter? The 57cde*-27c05 one? And, since I'll do that from Windows Server 2008 R2 what should be the drive letter to specify? The one as assigned (seen) from Windows Server 2008 R2?

    The thing is I am frightened to see that after I run say

    bcdedit /set {guid} device vhd=[d:]\some.vhd
    bcdedit /set {guid} osdevice vhd=[d:]\some.vhd

    provided the output

    DISKPART> list vdisk

    VDisk ### Disk ### State Type File
    --------- -------- -------------------- --------- ----
    VDisk 0 Disk 1 Attached not open Fixed \Device\HarddiskVolume3\VM\wdp\wdp.vhd

    and that HarddiskVolume3 has D: letter in Windows Server 2008 R2, I am frightened to see that the Windows Developer Preview's boot manager will see the HarddiskVolume3 as the one with the different drive letter.


    Well this is the world we live in And these are the hands we're given...

    Wednesday, October 5, 2011 2:24 PM
  • You have booted WindowsDevPrev and OSDevice and ApplicationDevice is displayed as \Device\HarddiskVolume4(C:)

    This is not a real disk drive - you are inside the VHD - I assume first partition of VirtualHardDisk is mapped to \Device\HarddiskVolume4.

    I would not mess with VHD when I am booted to the same VHD !

    OK.

    If you can boot to Windows Server R2 without attaching the VHD.

    Then see what is displayed for your VHD (in WinDevPrev loader + recovery loader + ramdisk options).

    OSDevice and ApplicationDevice point to the same location = full_path to VHD.

    If you move VHD to another "drive:\folder\VHDfile" you have to adjust OSDevice and ApplicationDevice to point to this new "drive:\folder\VHDfile".

    The same changes must be applied for corresponding Recovery Loader and for corresponding Ramdisk Options(SdiDevice).

    -----------------------------------------------------------------------------------

    If you are not sure what to do you can go another way.

    Visual BCD Editor can automatically create loaders for every installed Windows version.

    If you delete all entries in BCD for WinDevPrev (loader, recovery loader and ramdisk options)

    Then attach VHD in Disk Management.

    Then in Visual BCD Editor right-click in tree view and select "Create missing Windows loaders" this will create the loader for WDP installed inside the VHD.

    Later when booted in WDP on command prompt with admin rights:

    ReAgentC /disable

    ReAgentC /enable

    This two commands will recreate the BCD entries for the recovery environment loader.

    Resume loaders are created automatically by the operating system when booting to it.

    Wednesday, October 5, 2011 2:39 PM