
Windows 7 provides a unique feature called Boot From VHD. Essentially it is a storage virtualization. Usually a virtual machine consists of a virtual CPU, virtual devices, and virtual storages. Boot From VHD lets you use a real CPU, real devices, but a virtual storage. It doesn't require Intel VT or AMD-V on the machine. After setting up Boot From VHD, what you have is a multi-boot machine. The boot is not from a partition, but from a VHD file.
You can follow the steps below to create a dual-boot machine. One boot from a real drive and the other boot from a VHD file.
D:\VM>diskpart Microsoft DiskPart version 6.1.7600 Copyright (C) 1999-2008 Microsoft Corporation. On computer: MINWINPC DISKPART> create vdisk file=D:\VM\Win7.vhd type=expandable maximum=25000 100 percent completed DiskPart successfully created the virtual disk file. DISKPART> attach vdisk 100 percent completed DiskPart successfully attached the virtual disk file.
DISKPART> list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 232 GB 0 B * Disk 1 Online 24 GB 24 GB
DISKPART> exit Leaving DiskPart... D:\VM>exit
C:\>bcdedit /v Windows Boot Manager -------------------- identifier {9dea862c-5cdd-4e70-acc1-f32b344d4795} device partition=\Device\HarddiskVolume1 description Windows Boot Manager locale en-US inherit {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e} default {51f3be40-8088-11de-ace6-0014223d6008} resumeobject {51f3be3f-8088-11de-ace6-0014223d6008} displayorder {51f3be40-8088-11de-ace6-0014223d6008} {51f3be3c-8088-11de-ace6-0014223d6008} toolsdisplayorder {b2721d73-1db4-4c62-bf78-c548a880142d} timeout 30 Windows Boot Loader ------------------- identifier {51f3be40-8088-11de-ace6-0014223d6008} device vhd=[D:]\VM\Win7.vhd,locate=custom:12000002 path \Windows\system32\winload.exe description Windows 7 locale en-US inherit {6efb52bf-1766-41db-a6b3-0ee5eff72bd7} recoverysequence {51f3be41-8088-11de-ace6-0014223d6008} recoveryenabled Yes osdevice vhd=[D:]\VM\Win7.vhd,locate=custom:22000002 systemroot \Windows resumeobject {51f3be3f-8088-11de-ace6-0014223d6008} nx OptIn Windows Boot Loader ------------------- identifier {51f3be3c-8088-11de-ace6-0014223d6008} device partition=D: path \Windows\system32\winload.exe description Windows 7 locale en-US inherit {6efb52bf-1766-41db-a6b3-0ee5eff72bd7} recoverysequence {51f3be3d-8088-11de-ace6-0014223d6008} recoveryenabled Yes osdevice partition=D: systemroot \Windows resumeobject {51f3be3b-8088-11de-ace6-0014223d6008} nx OptIn
C:\>bcdedit /set {51f3be40-8088-11de-ace6-0014223d6008} description "Windows 7 on VHD"
C:\>bcdedit /displayorder {51f3be40-8088-11de-ace6-0014223d6008} /addlast
C:\>bcdedit /default {51f3be3c-8088-11de-ace6-0014223d6008}
Now the machine has become a dual-boot machine. The first and default boot loader is for the real drive, and the second boot loader is for the VHD file.
So what's the difference between the two? When you boot from the real drive, the real drive will get drive letter C. If you want to read from or write to Win7.vhd, you can use Disk Management (diskmgmt.msc) to attach VHD. When you boot from VHD, Win7.vhd will get drive letter C, and the real drive get the letter D. You can read from or write to both of them. One interesting thing is that when you check the size of Win7.vhd on Drive D, you will find the size is what you defined for the VHD, even the type is expandable. You might think you could create an expandable VHD with a big drive size. When the VHD drive size is too big, bigger than the free space on the real drive, you will get a blue screen when booting from VHD.