Windows 7 – Natively Booting from a .VHD file (Virtual PC image)

Cesar De la Torre

[Update 15 August 2009 – Tested with Windows 7 RTM final version] 

The most important thing to keep in mind is that we currently (prior to Windows 7) cannot natively boot from any kind of .VHD. 

Actually, I have just managed to boot from a Windows 7 installed on a new .VHD, and I installed it right from the Windows 7 DVD. We can do a similar process with “Windows Server 2008 R2 (beta)” installed on a .VHD file, as well.

If you’d use Virtual PC 2007 to install the Virtual image, the produced .VHD wouldn’t work when trying to boot from the .VHD. 

A.-  Creating the .VHD file and Windows 7 installation on that .VHD file

UPDATED: When using Windows 7 RC1 “plain vanilla” installed, it usually creates a small initial partition (about 100Mb), and then, when you do the following steps, you have to specify d: drive instead c: drive. If you try with c: and you get an error message sying something like “You don’t have space enough”, try specifying d: drive. 

1. Boot the machine using the Windows 7 DVD
2. Choose Windows Repair
3. start CMD
4. Run Diskpart
5. Type: Create vdisk file=c:\Windows7.vhd maximum=40000 type=expandable
6. Type: select vdisk file=c:\Windows7.vhd
7. Type: attach vdisk (in previous Betas, it was ‘surface’ instead of ‘attach’)
8. Type: ‘exit’ (you exit Windows Repair, but
 Do Not Reboot)
9. Install Windows 7 to this attached .VHD (From Win7 installation, you now have to ‘see’ another Hard Drive, you’ll need to create a partition & format it, first. You might get an error/warning saying that your computer hardware might not support this disk, just ignore it..).
10. Reboot, and you got it!!!!

B.- Configure boot options

You might want to chenge dual boot options, options string name, etc.  

When you want to configure the boot options of windows you can use bcdedit.exe or EasyBCD to modify the boot settings.

Be careful if you use EasyBCD, as current version might not have new Windows 7 options, yet…

So, bcdedit.exe is harder to use, as it is a console app, but it will work ok for sure! 🙂

For instance, once you have booted in Windows 7 (any boot, you might have 2 ‘Windows 7’ option strings… ;-)), you might want to change those boot options strings. In order to do so, start a CMD prompt and run bcdedit.exe (in \Windows\System32) to see the GUID of your boot options:

bcdedit /v

Remember/copy the GUID of your VHD installation and type the following line, of course, changing my ‘xxxxxxxx’ stuff to your GUID.

bcdedit /set {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} description “Windows 7 .VHD Image”

You can put the description you like, but the above line will change the description for your VHD installation boot option.

You can also change the order of the boot options typing the following:

bcdedit /displayorder {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} /addlast

Finally, once you have these kind of .VHD images, you can copy it and have as many BOOT options as you want.

The easiest way is to copy an originall boot menu option, like:

bcdedit /copy {Original_GUID_Number} /d “my new description”
or
bcdedit /copy {current} /d “my new description”
or
bcdedit /copy {default} /d “my new description”

Type again the following to see the new GUID for your new copied boot option:

bcdedit /v

Copy that GUID to a notepad or a paper… 

After that, you must change the 2 pointers within the menu option, so they point to the new/right .VHD file:

bcdedit /set {My_new_GUID_Number} device vhd=[C:]\MyNewVpcFile.vhd 

bcdedit /set {My_new_GUID_Number} osdevice vhd=[C:]\MyNewVpcFile.vhd

So! ,this kind of natively booting is great when you have many Virtual PC images and you want to run it the fastest possible way, I mean, almost like a native installation (We might have a slight delay because everything is stored within a single file, but, it must be a very small difference). In any case, we’re not running a virtual environment nor 2 operating systems at the same time, it must be much faster than using Virtual PC or VMware. ðŸ™‚

Btw, if you need more detailed info because you don’t really know Windows 7 setup, neither bcdedit.exe, check the following post. It is a STEP BY STEP procedure with pictures, etc.:

http://www.sevenforums.com/tutorials/2953-virtual-hard-drive-vhd-file-create-start-boot.html

 

0 comments

Discussion is closed.

Feedback usabilla icon