Adding a native boot VHD to Windows 7 – Part 1

I’ve been using the native boot VHD feature of Windows 7 quite a lot lately and I’m really happy with results.  Being able to natively boot to a VHD allows you to have different OS images set up for different scenarios.  For me this includes:

1. Easily Rebuild-able Win7 Images: I work with a lot of early release code and I’m *really* tired of rebuilding my machines every time a new build comes out or when something goes wrong.  With native boot VHDs, I can create a Win7 VHD to run these potentially unstable bits knowing I can “roll back” to an earlier version of the VHD by just copying the VHD off of a back up drive.  Native boot also runs much faster than running in a hypervisor since the VHD runs on the metal.

2. Booting to Windows Server 2008 R2 for Hyper-V: I do a lot of development in VHDs, so I need to be able to boot my machine to WSK28 R2 quickly and easily.  I have a native boot VHD with WS2K8 R2 installed that I boot to in order to run my VHDs in HyperV.  When I need WS2K8 R2, I just reboot my machine and choose that WS2K8 R2 VHD from the boot menu.  It’s quick to switch to that image and the performance is great (rather than running the OS from a bootable USB drive, etc.).

The process for setting up a native boot VHD and making in a boot option includes:

1. Creating the VHD.

2. Installing the OS image.

3. Adding the VHD to the Boot Menu.

While there are lots of articles on the native boot VHD feature, here is a simple process to get you started.

Create the VHD

1. Download and install the Windows Automated Installation Kit (AIK) so you have all the tools you need for building your VHD and adding it to the boot menu.

2. Create a folder on your computer to hold the VHDs you’ll build.  I created c:\Boot2VHDs.

3. Click Start >> Computer >> right-click and select Manage.

Boot2VHD_1

4. In the Computer Management (Local) tree-view on the left hand side, select Storage >> Disk Management.

Boot2VHD_2

5. Right-click on Disk Management >> Create VHD to create the VHD file that will hold your bootable image.

Boot2VHD_3

6. In the Create and Attach Virtual Hard Disk dialog, in Location the name and location of the VHD you’d like to create.  I called the VHD c:\Boot2VHDs\Win7.vhd

7. Under Virtual hard disk size enter 50 GB (or whatever size you need to store the OS and any applications on your VHD).

Note: I never keep any files on the VHD so I can easily roll back to a prior version without the risk of losing data. 

8. Under Virtual hard disk format, choose Fixed Size (recommended) .  Fixed size will give you the best performance at the expense of possibly running out of disk space.  The dialog should look like the following.

Boot2VHD_4

9. Click OK.

Note: Creating the VHD can take a few minutes based on the size of the VHD and speed of the drive.  The status bar at the bottom of the dialog will show you progress.

Boot2VHD_5

 

 

 

 

10. Right-click on the newly created disk (Disk 2 below) and select Initialize to make the disk available to Disk Manager.

Boot2VHD_7

11. In the Initialize Disk dialog, under Select disks select the VHD (Disk 2 in this example) under Use the following partition style for the selected disks: choose the M.B.R (Master Boot Record) option and click OK to initialize the disk to be bootable.

Boot2VHD_8

12. Disk Management should now show the 50 GB VHD as Online/Unallocated.

Boot2VHD_9

13. Right-click on the Unallocated volume (see below) and select New Simple Volume.

Boot2VHD_10

 

 

 

14. In the New Simple Volume Wizard dialog Welcome screen, click Next.

Boot2VHD_11

15. In the Specify Volume Size screen, set the Simple volume size in MB to be the size of the VHD you created (51197 MB in this example) and click Next.

Boot2VHD_12

16. In the Assign Drive Letter or Path screen, select the Assign the following drive letter option and select a drive letter (Z: in this example).  Click Next.

Boot2VHD_13

17. In the Format Partition screen, select Format this volume with the following settings, for File system select NTFS, for Allocation unit size select Default and for Volume Label provide descriptive volume label (Win7_VHD for example) and check the Perform a quick format box.   Click Next.

Boot2VHD_14

18. In the Completing the New Simple Volume Wizard screen, confirm all your selections and click Finish.

Boot2VHD_16

19. The formatting should take a few seconds and then you’ll see your new volume (Win7_VHD as drive Z: in this example).

Boot2VHD_17

20. Select Start >> Computer and you’ll see your VHD in Windows Explorer listed (he Z: drive using this example).

Boot2VHD_19

Now that the VHD has been created, the next step is to apply an OS.  The easiest way to apply an image is by using a WIM file, which you’ll see in Part 2.

Thanks,

Chris