You can screw up your partition table. You have to partition which means disks of fixed size. Or you can have them all share the same disk, which is dangerous. OS's aren't portable.

Virtual Machines

Your OS's are completely separate from each other and can't hurt one other. Your OS's are very portable. You get Undo support for your disks.

Everything is virtualized, so you're taking a perf hit on pretty much everything. Often not a good solution for laptops.

Boot to VHD

Your OS runs on the hardware directly, except your disk, which is virtualized and runs inside a single file. Estimated 3%-5% perf hit. Seriously. Also is awesome on a laptop if you have the HD space.

None! But I'm biased! Neener neener!

Only works on internal drives or ESATA. No USB Drive support. No undo disk support.

Making a VHD is easy with Windows 7 since you can create and mount/attach VHDs in the standard tools. VHD as a disk format is built into the Operating System (although, strangely, you can't mount ISOs.).

You can create a blank VHD, set it up in your boot menu with BCDEdit (details and walkthrough here and a video demo here) and then just boot off your VHD. If you want to install your OS (Windows Server 2008 and Win 7 Enterprise or Ultimate are the only ones supported) then you just install away.

However, this is STILL not convenient enough for me.

I'm always trying crazy new Daily Builds of big stuff that takes a while to be installed. The step where I install an OS onto my VHD takes too long, so I'd like a prepared VHD that's already to be started for the first time, kind of like when you buy a machine from Dell or whoever and you get that nice "starting your computer, detecting drivers" action on first boot.

The Windows(R) Image to Virtual Hard Disk (WIM2VHD) command-line tool allows you to create sysprepped VHD images from any Windows 7 installation source. VHDs created by WIM2VHD will boot directly to the Out Of Box Experience, ready for your first-use customizations. You can also automate the OOBE by supplying your own unattend.xml file, making the possibilities limitless.

Fresh squeezed, organically grown, free-range VHDs - just like Mom used to make - that work with Virtual PC, Virtual Server, Microsoft Hyper-V, and Windows 7's new Native VHD-Boot functionality!

How to SysPrep your Windows 7 Image

I copied my Windows 7 DVD to a folder on a drive with lots of space free. I probably didn't need to copy it over, but it likely made the process faster.

Then I downloaded and installed the Windows® Automated Installation Kit (AIK) for Windows® 7. This file is a large ISO (1.5G) so be aware. It's meant for admins, not humans. I didn't want to burn the ISO to disk, so I used 7-Zip to open the ISO as an archive and extract it. (If you're not using 7-Zip, you're missing out on life, BTW)

Magical. Now I've got a 5 gig VHD file that I can setup to boot from directly as described here. The first time I start up, it'll be 95% into the setup process and just ready to detect my hardware. It's a nice "OEM-like" VHD that I can use again and again.

Since I'm only using these VHDs temporarily (for a week or two for testing) I won't use an activation key and instead leave that field blank during setup. That'll buy me 30 days of testing if I need to, and I can easily start over by just starting over with my new fresh VHD.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

Krolly - No, that's not the case. VT extensions are only required for CPU Virtualization like that used by Virtual PC. The BootToVHD solution I'm describing doesn't have this limitation. It's not really virtualizing anything but the disk.

I've been booting to VHD since the RC came out and the only con that I have noticed is that boot time is slightly longer, maybe another 5 secs longer? I ran some performance tests (memory, cpu, disk access etc..) comparing VHD vs Boot VHD vs native and the difference between Boot VHD and native were negligible.

The only other thing which could be improved is the setting up process. It is still a bit of a faff though with articles like it gets a bit easier.

Sounds wunderful, but what can you do to increase the vhd size? With 5GB i doubt that you can do a lot of demos, the vhd will run full in an instant, or am I wrong?

Jakob

Tuesday, 04 August 2009 13:07:31 UTC

Is there any way I can include installation programs of my preference and automate the installation of those programs after the VHD is booted ? is it possible or do I have to manually install all the programs ?

Interesting post, I like what I've read so far. What I'm looking for is a way to keep a Windows XP Pro system running - I have a very specialized USB film scanner (which doesn't have Vista drivers). My current XP computer died (bad motherboard). I only need to boot into XP when I need to scan something.

Did I read correctly that you can't do the VHD boot with Windows 7 Professional? That's really too bad. It's a really cool feature. I played with it on the Beta release. However, if it's only supported on Ultimate (super-expensive) and enterprise (not available to me or my company -- we're too small), then I won't get any benefit from it.

['ll have to go back and talk to my friends/co-workers. I had been citing the VHD boot feature as a major reason that a developer or technical person would want to upgrade to Windows 7. It sounds like only the big corporate installations (or those willing to shell out megabucks for Ultimate) will get to play with it.

J.Marsch

Wednesday, 05 August 2009 19:30:03 UTC

Can you run multiple bootable VHD simultaneously? With Virtual PC, you can have multiple VMs running concurrently provided you have enough RAM and fast CPU.

Since Win7 allows me to make an image-based backup to VHD, can you add that VHD to your Boot Environment? This would be a great way to create different configurations and/or roll back your machine via VHD Boot.

This is a great solution until Windows 7 is broadly released. After that I'd hope the IE App Compat VPP images are updated so you can get the same thing with no mucking about. http://www.microsoft.com/Downloads/details.aspx?FamilyID=21eabb90-958f-4b64-b5f1-73d0a413c8ef&displaylang=en

One other tidbit - I didn't want to install the AIK just to get the 470KB ImageX.exe. It's a silly shortcut, but you can just open the ISO in 7-Zip and extract KB3AIK_EN.iso\Neutral.cab\F1_imagex, then rename it to imagex.exe. Worked with this script, and I didn't have to bother with install / copy file / uninstall.

Here's a screenshot of how it looks in 7-Zip:http://www.screencast.com/users/jongalloway/folders/Jing/media/d0d78c3b-8a28-4af5-bf15-76fe3bb3269f

This is pretty cool. Totally worked. Have only tested it in Virtual PC so far though. But I must say, differential disks are nice! Can just set the vhd made by wim2vhd as read-only and use it as a parent for other disks. Does that work when booting to vhd too? Or is it just a Virtual PC thing?

I came across this post about need a boot configuration entry for the VHD.http://www.ravichaganti.com/blog/?p=317

But even doing this caused my Hyper-V image to blue screen...in Safe Mode! :-( I figure it must be some device driver that is installed in that VHD pertinent to my bare metal machine I'm running the VHD on. I found this gem on the link you sent through:sysprep /generalize /shutdown

A little tip: The Windows EULA allows you to "rearm" Windows 7 up 3 times giving you a total of 120 trial days. To do so run "slmgr -rearm" from a command prompt with admin rights. Do this as close to expiration as possible since you get 30 extra days from the day you do this.

Halstein Tonheim

Friday, 11 September 2009 01:05:19 UTC

I have Win7 Ultimate as a host OS and am trying to boot a WinServer 2008 Enterpize VHD. I followed all of the instructions outlined in the blog. Everything goes smooth up until I attempt my first boot into the Win 2008 VHD. I am then greeting with a dialog telling me that my Boot Configuration is Corrupted (Error 0x490).

Michael Connell

Thursday, 15 October 2009 21:54:50 UTC

Does this work when the native OS is x64 and the VHD is x86? I can boot into the VHD but get an error about "setup cannot configure this computer to run windows" and then it exits.

You can use the /size:<vhdSizeInMb> parameter in the command line to set the size you want the VHD to grow to so you can have larger disks. If not set it defaults to 40GB.

WIM2VHD only runs on Win7 or Win2k8 Server. That's pretty obvious from the website but my Win7 machine is brand new with no tools on it yet, so I tried to do this on my XP machine without reading first. Gave me an error about a regkey that only exists on Win7/Server 2008. Oh well.

Hey Jon Galloway, thanks for the tip on grabbing just the ImageX tool. I was wondering about this but thought it might require something else that's installed behind the scenes.

Name Result Error code Time takenCheck for update Completed successfully 0x0 0 msSystem disk test Same Same SameDisk failure diagnosis Same Same 141 msDisk metadata Same Same 47 msTarget OS test Same Same 140 ms