With Windows 7 Ultimate/Enterprise or Windows Server 2008, you can easily boot to a virtual hard disk (VHD). This is a great alternative to using a separate physical partition, if you want to boot to an alternative operating system.
What are some other reasons for doing this?
- Unlike using virtualization directly, such as through Virtual PC, you are booting to real hardware .. but still leaving your main / primary OS alone.
- You don't need exclusive access to the real disk, or have to get involved in disk partitioning etc. It's a great for creating multiple OS installations … without having to create multiple OS partitions on your hard drive.
- You can easily mount the VHD from your main OS for later file access etc.
- You can later migrate the VHD run as a virtual machine on Hyper-V (you'll need to run Sysprep generalize before migrating the VHD, to ensure that hardware devices are properly detected and Windows initializes when started from within Hyper-V).
Note: the key limitation is that VHD boot only works for VHDs containing Windows 7 Ultimate/Enterprise or Windows Server 2008 R2 operating systems; you can use an earlier OS as the host computer, but you'll need to do some additional (for example, if you use Windows Vista SP1 as the host, you must replace Bootmgr and Bcdedit.exe with Windows 7 versions. Probably best to stick to using Windows 7 Ultimate/Enterprise or Windows Server 2008 R2 operating systems as both the host and VHD operating systems (I've only tested the procedure below on a Windows 7 host).
It's easy to set up, and there are lots of good resources that go through the process (see the end of this post); but here's a tried and tested quick and simple method that should work in most environments:
- On the host computer, CD/DVD boot using the Windows 7 Ultimate/Enterprise or Windows Server 2008 R2 DVD.
- Let the install run until you get to the first screen that needs an input; the language, time and currency, and input locale screen.
- Press SHIFT+F10 to launch a WinPE command console.
- Type DISKPART and press ENTER.
- Type LIST DISK and press ENTER, to see the available disks in your system.
- Type SEL DISK 1 and press ENTER (On my system I created the VHD on the second disk, i.e. Disk 1).
- Type LIST VOL and press ENTER, to confirm you have the right disk. Also make a note of the drive letter assigned to the volume you want to save the VHD to; in my case, I wanted to create a 20GB dynamically expandable VHD for a full installation of Windows Server2008 R2 and save it on drive E:.
- Type CREATE VDISK FILE=e:\WindowsServer2008R2Full.vhd MAXIMUM=20000 TYPE=EXPANDABLE and press ENTER.
- Type SELECT VDISK FILE= e:\WindowsServer2008R2Full.vhd and press ENTER.
- Type ATTACH VDISK and press ENTER.
- Type EXIT and press ENTER, to quit Diskpart.
- Type EXIT and press ENTER, to quit WinPE.
- Continue the installation, and specify to install to your new 20GB virtual hard disk (shows up just like a regular unallocated partition to Windows Setup).
The install will have reconfigured your boot manager, so the installation reboots will automatically pick up your new VHD boot as the default.
To change the boot defaults, either manually edit using BCDEDIT at a command line (see the links below for info on this), or if you want to cheat/save a bunch of time, use EasyBCD, available from http://neosmart.net.
Of course, you do the above at your own risk, make sure you are properly insured, your mileage may vary etc.
The following links provide useful additional information on more advanced methods for VHD booting:
Frequently Asked Questions: Virtual Hard Disks in Windows 7 and Windows Server 2008 R2, http://technet.microsoft.com/en-us/library/dd440865(WS.10).aspx
Native VHD Boot: A Walkthrough of Common Scenarios, http://www.microsoft.com/download/en/details.aspx?id=2744