Boot from a VHD file

Booting from VHD only works for Windows 7 or Windows 2008. It will not work for USB device since the usb drivers are initialized too late in the boot process(works for eSATA??). The performance loss is about 3% compared to “normal” boot, since only the hard driver layer is virtualized.

Install Windows to a new VHD

When installation process goes to “install now”, press(Shift + F10) to go to DOS prompt.

***to create a 50G expandable disk.***
create vdisk file="C:\win7\win7.vhd" type=expandable maximum=50000
select vdisk file="c:\win7\win7.vhd"
attach vdisk

continue the installation process, remember to select the newly created disk, the virtual one!

Setting up Windows boot manager to boot from an existing VHD

In admin Dos prompt:

C:\>bcdedit /copy {current} /d "My New VHD Option"
*** copy the newly created {guid} by right mouse click and use that in the following command ***
C:\>bcdedit /set {guid} device vhd=[driveletter:]\directory\vhd filename
C:\>bcdedit /set {guid} osdevice vhd=[driverletter:]\directory\vhd filename
C:\>bcdedit /set {guid} detecthal on
*** the [] needs to be there like the following sample.***
bcdedit /set {guid} device vhd=[C:]\win7\win7.vhd
*** to check out existing boot loaders, run the following ***
bcdedit /v
*** to delete an existing vhd device ***
bcdedit /delete {guid} /cleanup

How to increase a VHD file

The total size a VHD file is determined at the time you create it. If you want to increase the total size of the VHD file, you would have to do it just like with any real hard drive, first increase the size of the partition and then expand it.

  • First use VHD Resizer to increase the file.
  • Then map the new VHD as a second hard drive to the old vm.
  • The last, go to DOS command.

    list disk
    select disk=1
    list partition
    select partition =1