Booting from a virtual hard disk or VHD is a new feature shipping with Windows 7 and Windows Server 2008 R2. This post applies to both, client and server.
Booting from a VHD offers a variety of benefits for different scenarios.
- Contained operating system (OS) installation
- xcopy deployment of fully installed and configured OS in a single file
- Rollback in time via differencing disks
- Full access to all hardware
- No need to re-partition your hard disk
- Ideal for test and evaluation
We know VHDs or virtual hard disks from Microsoft virtualization solutions like Hyper-V, Virtual Server or Virtual PC. All solutions use the VHD as vessel for the OS. So does the boot from VHD feature. The main difference between boot from VHD and the other solutions is full access to the underlying hardware. Microsoft virtualization solutions – as well as competitors’ products – use virtualization to abstract the guest OS from the physical hardware.
Not so boot from VHD. The boot process has become more sophisticated and is now able to not only boot from a physical disk but also from a file. The file format conveniently is the same as for the before mentioned Microsoft virtualization solutions. That said, a VHD being created with any for the Microsoft virtualization solutions cannot be mounted and booted from without additional preparation.
The easiest way to create a bootable VHD to be used in a boot from VHD context is described below. A screen cast on TechNet Edge will be available soon.
- Make sure the physical disk to be used to store the VHD file is formatted
- Insert your Windows 7 or Windows Server 2008 R2 boot DVD and boot into the installation
- At the first installation dialog press Shift-F10 for a command prompt.
- At the command prompt type and launch diskpart
- At the diskpart prompt execute create vdisk file=c:\windows7vhd.vhd type=fixed maximum=20000
- Now run select vdisk file=c:\windows7vhd.vhd
- Run attach vdisk
- Exit diskpart by running exit
- Exit from the command prompt and continue your installation. Ignore any warnings (like: “... cannot boot from this partition”) that may appear.
- As always, there’s more than one way to skin the cat.
- You could use the Windows Disk Manager to create a new VHD file.
- Adding differencing disk support to the VHD is another very helpful feature.
- In case you have an existing VHD with an installed OS (maybe created with Hyper-V), this image needs preparation before booting it as the native OS via boot from VHD.
Lots of stuff for additional blog posts later. Now let me finish the screen recording and get it up on Edge.
BTW, here’s a snapshot of the setup I use to record the screen cast soon to be on TechNet Edge. Fun, fun.
My host is an Asus Eee 1000HE, a DVD drive is connected via USB and a SATA2USB dongle, the screen is recorded via Media Encoder and an Epiphan DVI2USB framegrabber connect to the VGA port of the Eee PC.