Friday, January 16, 2009

Windows 7 Natively Boots VHD Files

OK, before I head out and do some real work, I thought I'd post this. Windows 7 can boot from a VHD. Sure, this is fairly common knowledge, but what real benefit is this to us when testing and/or deploying Windows 7?

Well, if you have downloaded both the x86 and x64 versions of Windows 7 and don't want to have to have multiple partitions (or disks) for booting these different versions of Windows 7, you can simply create a VHD, mount it, then get Windows 7 to install into it and there's your multi-boot system off a single hard drive without a multitude of OS partitions! Now, that's handy! :)

OK, I'll not repeat everything in here that is already on the web, but refer to other blogs and web-based information where appropriate. If you can create a VHD using Virtual Server or Hyper-V, then go ahead and create one, making it at least 40 GB in size - it *can* be a dynamic disk, but a fixed size will be faster. For the sake of doing this in a test environment, dynamic disks will save a fair bit of disk space. So they will do for a bit of testing, though I'd not recommend them for a production system.

If you already have Windows 7 installed and no other Virtualization platform available to create a VHD, then perform the following steps to create a dynamically expandable VHD file that is expandable to 40 GB which will contain out boot image of Windows 7 x64 Ultimate Beta 1:

Open a "cmd" prompt and type diskpart which will ask for elevation.
DISKPART> create vdisk file=c:\Win7x64.vhd type=expandable maximum=40960
DISKPART> exit

You now have a small (82 MB) file that will expand up to 40 GB which will contain the x64 version of Windows 7. Now, insert the Windows 7 Ultimate Beta 1 x64 DVD into the drive and reboot the computer. When you come to the point of choosing your language, this is where we need to mount this VHD file and then install Windows 7 into it. Press Shift+F10 to open a cmd prompt.

Now, to save repeating what's already a decent step-by-step from this point, have a read of Adrian Kingsley-Hughes' ZDNet blog entry. Sure, there's a few other things that we could do and a few different ways of achieving this, but he's covered enough to get this all running!

What you'll end up with is an install of Windows 7 on hardware - the install you use for daily testing, and in addition to this, you can now have multiple installs of Windows 7 on a dingle drive, in a single partition, that all reside in their own VHD files. One thing to note - if you *do* boot Windows 7 from inside a VHD, you will not be able to hibernate the machine.

Regards,

The Outspoken Wookie

No comments: