Boot from VHD in Windows 7
I’ve downloaded a VHD file from Microsoft and wanted to boot from it. Just to experiment with the new feature. Here are the surprisingly simple steps to take:
1. Create an extra boot entry (copy from current entry) and give a description, BCDEdit will echo the created identifier:
bcdedit /copy {current} /d "Windows 7 Foundation Suite 3 VHD"
"The entry was successfully copied to {a20180a3-a426-11de-96df-a3075ebd94a1}.
2. Set VHD to the newly created bootloader entry, with this two commands:
1: bcdedit /set {a20180a3-a426-11de-96df-a3075ebd94a1} device vhd=[D:]\Images\WDTFS-x64.VHD\WDTFS-x64.VHD
2: bcdedit /set {a20180a3-a426-11de-96df-a3075ebd94a1} osdevice vhd=[D:]\Images\WDTFS-x64.VHD\WDTFS-x64.VHD
3. Force auto detect the Hardware Abstraction Layer (if you’re using a syspreped VHD)
bcdedit /set {a20180a3-a426-11de-96df-a3075ebd94a1} detecthal on
Replace identifier (don’t forget curly braces) and .VHD path (yes, with square brackets round the drive letter) with your own.
4. We’re done! Reboot your machine and you will be presented with a new boot menu.
Tnx Ben, looks interesting
But I have 2 small questions:
May the VHD-files be placed on the C-drive?
Does it support all kinds of operating systems on the VHD-file? (ex: VHD with XP)
Tnx
Stijn
The VHD files can be placed on the C: drive indeed. However an USB drive cannot hold your VHD image, USB harddisks are not supported at the moment.
As far as I know only Windows 7 and Windows Server 2008 R2 are supported.
if you can’t find or download a sysprepped VHD, you can easily create a bootable one by yourself
There are even multiple ways how this can be done (provided you are running windows 7 or 2008 R2 as host os already).
Method 1:
-open diskmgmt.msc and create a new vhd (create vhd and attach/detach vhd are new options in the console)
-format the vhd file (for performance reasons it is best to use a fixed size)
-initialize the mounted vhd and create a new simple volume
-now you must have the install.wim of a windows 7 and 2008 R2 dvd at hand, together with the ImageX executable
-apply the install.wim to the mounted vhd (with the command imageX /apply c:\install.wim 1 z:\)
Note: to find the correct index ID, use the command: imageX /info c:\install.wim
Note2: you might replace source and destination locations for your environment
-wait a few minutes for the process to complete
-the vhd can now be detached (it’s ready to be booted from)
-use the steps described by the topic owner to prepare the boot entry
Method2:
-use diskpart to replace the first three steps of method1
-continue on like in method 1 from step four
Method3:
-use the wim2vhd tool available here: http://code.msdn.microsoft.com/wim2vhd
(haven’t used that one yet though …)