Dual booting Windows Server 2008 R2 with Windows 7 using VHD booting

by Shijaz Abdulla on 05.11.2009 at 20:38

I wanted to run Windows Server 2008 R2 in a dual boot configuration on my Windows 7 RTM laptop – so that I can demonstrate Windows Server 2008 R2 features to partners when required.

This gave me an opportunity to use the new “Boot from VHD” feature on Windows 7 and Windows Server 2008 R2. Essentially, I would have Windows 7 on my laptop on one partition on the raw disk. The remaining space on the RAW disk (in my case 15 GB) will be allocated to a partition containing a VHD (Virtual Hard Disk) file, that can be mounted to boot the computer off the VHD file. I will be installing Windows Server 2008 R2 on this VHD file.

image

Here’s how I went about doing it.

Since I did not have any unallocated space on my hard drive, I used the “shrink” option on drive C in Windows 7 (Computer Management) to get some free space – and got 15 GB unallocated as seen in the above screenshot.

Next, I popped in the Windows Server 2008 R2 DVD.

image

At the Welcome screen above, I press SHIFT+10 to launch the WinPE console.

Once you get the WinPE console, use DISKPART to prepare a partition for the Windows Server 2008 R2 VHD:

  1. Type ‘DISKPART’ to launch the utility
  2. Type ‘LIST DISK’ to see the list of physical disks in your machine.
  3. Type ‘SEL DISK 0’ assuming you have only 1 physical disk installed
  4. Type ‘CREATE PARTITION PRIMARY’ to create a primary partition out of the free space
  5. Type ‘FORMAT FS=NTFS QUICK’ to quick-format the new partition on NTFS format
  6. Type ‘LIST VOL’ and look at what you’ve done :-). Notice the asterisk next to the new partition (in my case, it’s Volume 3).
  7. Type ‘ASSIGN’ to assign the next available drive letter to the selected partition.
  8. Type ‘LIST VOL’ again to see what drive letter was assigned (in my case, it’s E)
  9. Now for the magic: ‘CREATE VDISK FILE=E:FILENAME.VHD MAXIMUM=15000 TYPE=EXPANDABLE’ – this creates a dynamically expandable VHD file filename.vhd on the new volume with a maximum size of 15000 MB. Keep the maximum size lesser than the size of the partition.
    WinPE Screenshot
  10. Notice that once you finish this command, Windows 7 detects virtual hardware “Microsoft VHD HBA” and installs it. 
    image
  11. Type ‘SELECT VDISK FILE=E:filename.vhd
  12. Type ‘ATTACH VDISK’ to attach the VHD disk.
  13. Type ‘CREATE PARTITION PRIMARY’ to create a primary partition inside the VHD.
  14. Quick format the partition on NTFS by issuing the ‘FORMAT FS=NTFS QUICK’ command
  15. Assign a drive letter V: on this volume ‘ASSIGN LETTER=V:
  16. LIST VOL to see what you’ve achieved.
  • Volume 1 and 2 were pre-existing Windows 7 volumes
  • Volume 3 (E:) is the disk that we created to store the VHD file
  • Volume 4 (V:) is the virtual disk inside the virtual machine (uses space on E:)

WinPE screenshot

Type EXIT DISKPART to close the utility and close the WinPE session.

Next, continue with the Windows Server 2008 R2 installation from Windows 7. Do not choose the upgrade option, choose the New Installation option.

Choose to install Windows on the partition you just created.

 

image

When installation is complete, and you restart your computer, a boot loader menu appears, where you can choose to boot Windows 7 or Windows Server 2008 R2.