Windows

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...

10 comments
Petr.Lazecky
Petr.Lazecky

I do not believe author ever tried this. This is theory only and this article is wrong. Basically, there is more to boot OS from VHD then boot loader. Operating system itself must have driver that is able to remap VHD sectors to real physical disk sectors. This is how this feature works - it uses volume driver to make this. In order to make Vista boot from VHD we would need to be able to install this driver from Windows 7 into Vista. I have not tried that but as this driver is Windows 7+ then there is big risk here..

rcpaccialjr
rcpaccialjr

I have tried to replicate your tutorial but I always end up not being able to boot with an error code 0xc000000d. Besides, I can't find any official Microsoft Tech doc that describes how to do this. For now I can confirm that Win7 and WinServ 08 R2 Beta are both VHD bootable, but not Vista. Unless you could provide us with screen caps and additional details, that would be very helpful.

fkowal
fkowal

So in other words, your trying to say that WIN7 has Virtual PC capabilities built in without additonal Microsoft Software Installation? Whereby you can boot into the VHD instead of booting into WIN7 first? Also if I understand this correctly then the VHD (virtual hard disk,) can be any operating system one previously created with Virtual PC or another competitors Virtual PC Creator that makes VHD files. SO you get a dual/triple boot system on Bootup if need to be. By the way, do you think the program BCDEDIT will work easier for this. What is BCD Edit? See http://neosmart.net/dl.php?id=1

seeker.89
seeker.89

how about in xp vista and windows 7 can uses it same as you present?

seeker.89
seeker.89

how about in xp,vista and windowz can i make it like you make in window server 2008

hideaway
hideaway

Why do you put acronyms in the title of an article without defining them on the first usage??? (In other words WHAT IN THE HELL IS VHD???)

rcpaccialjr
rcpaccialjr

You mentioned VHDs created and used with Hyper-V. How about VHDs created and used with Virtual PC 2007?

Craig.Humphrey@ChapmanTri
Craig.Humphrey@ChapmanTri

Hi, I just read Brad Bird's article on booting VHDs using Windows 7. I'm currently looking for a way to have multiple ISO images on a USB Flash drive, with some kind of boot loader that allows me to choose which one to boot. The ISO's could be OS install CD/DVDs or even "live" CD/DVDs. Using a Windows 7 boot loader (on the Flash drive) and VHDs might be a suitable compromise (if I can get the VHDs small enough). Anyone got a solution to either of these? Thanks Craig