Dual booting Windows Server 2008 R2 with Windows 7 using VHD booting
Posted on November 5, 2009 by Shijaz Abdulla
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.
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.
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:
Type ‘DISKPART’ to launch the utility
Type ‘LIST DISK’ to see the list of physical disks in your machine.
Type ‘SEL DISK 0’ assuming you have only 1 physical disk installed
Type ‘CREATE PARTITION PRIMARY’ to create a primary partition out of the free space
Type ‘FORMAT FS=NTFS QUICK’ to quick-format the new partition on NTFS format
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).
Type ‘ASSIGN’ to assign the next available drive letter to the selected partition.
Type ‘LIST VOL’ again to see what drive letter was assigned (in my case, it’s E)
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.
Notice that once you finish this command, Windows 7 detects virtual hardware “Microsoft VHD HBA” and installs it.
Type ‘SELECT VDISK FILE=E:\filename.vhd’
Type ‘ATTACH VDISK’ to attach the VHD disk.
Type ‘CREATE PARTITION PRIMARY’ to create a primary partition inside the VHD.
Quick format the partition on NTFS by issuing the ‘FORMAT FS=NTFS QUICK’ command
Assign a drive letter V: on this volume ‘ASSIGN LETTER=V:’
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:)
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.
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.