Microsoft

Windows 7 now allows you to boot a native OS from a VHD file

IT pro Brad Bird explains how to use the new capability in Windows 7 to boot an OS natively from within a VHD file rather than the standard method of dual booting.

Earlier this year, I configured my Dell Latitude E6500 laptop to dual boot from Windows 7 installed locally to Windows Server 2008 on an externally connected eSATA hard disk. This process works fine and is the traditional method of booting to a native environment from a PC.

New to Windows 7 is the ability to leverage an existing VHD file and boot to the environment contained in it natively.

In my case, I have several VHD files that work in Hyper-V, which I use as part of my Server 2008 installation. These are on my external eSATA drive, which is configured to display as drive V: to my Windows 7 native install (Figure A).

Figure A

I have a virtual machine that uses Windows Vista from the VHD file displayed below.

Figure B

OK, now let's see what I have as bootable options on my laptop. Before Vista, you needed to look at the boot.ini file. Windows Vista and Windows 7 use the bcdedit.exe utility. You will need to run the command prompt with elevated privileges to see it (Run As Administrator).

Figure C

As you can see in Figure C, I have my Windows 7 environment and my Windows Server 2008 environment to choose from. I'll need to add an entry for the Windows Vista option to boot from VHD.

To do this, I'll copy my current environment entry and then edit the copied entry with the appropriate parameters. To do this, type:

bcdedit /copy {current} /d "Windows Vista"

Here is my output in Figure D:

Figure D

Here is the new entry in Figure E:

Figure E

Notice how right now, this is reflected as coming from drive C:, which will need to be changed. I now have a unique CLSID that can be associated as a new boot device, and my description reads correctly as Windows Vista.

Now, let's edit the newly added boot device with the correct values. In my case the correct path to the VHD file must be supplied and associated to the correct CLSID. To do this, type:

bcdedit /set {CLSID_number} osdevice vhd=[v:]"\Hyper-V\Virtual Hard Disks\WS03 VMAdd.vhd"

Note: Replace with your drive, path, and filename.

You are done!

To get a sample of what the boot menu will look like before you reboot, from the Run menu, launch msconfig.

Figure F

Now, you can boot Windows Vista from a VHD file.

Need help configuring, administering, supporting, and optimizing network infrastructure? Then turn to our free Network Administration NetNote. Automatically sign up today!

About

Brad Bird is a lead technical consultant and MCT certified trainer based in Ottawa, ON. He works with large organizations, helping them architect, implement, configure, and customize System Center technologies, integrating them into their business pr...

Editor's Picks