How to dual boot Windows 7 and Windows Server 2008 with a VHD

I have a new Dell M4400 laptop that I just got up and running with Windows 7 and thought “WOW! It would be great to boot this thing as Hyper-V server and just run the demos on there … but I have everything installed already!”  What to do? The solution turns out to be incredibly simple: Dual boot between Windows 7 and Windows Server 2008 R2 using boot from VHD.  At the end of the day the only drawbacks seem to be that I’ll lose the ability to hibernate when I’m booted off of VHD and I’ll see about a 3% overhead in disk performance so I took the plunge, I’m pretty pleased with it so I thought I’d share what it took to get up and running and my list of reference articles/sites.

Pre-Requisites

  1. You’ll need a machine that supports hardware virtualization with Windows 7 already installed and hardware virtualization enabled in the bios.
  2. You’ll need the install media for Windows Server 2008 R2. I recommend a USB stick and following my blog article: Installing Windows 2008 off a USB stick
  3. You’ll need to take your prom dress off and not be a little girl about it. You’ll likely not blow up your machine but in case you do you’ll be hard at work getting things back. I run windows home server at home for backup so I have no worries, those backups are rock solid!

The Process

The first thing you need to do is create a VHD to boot off of and make it available to the setup. Here’s the steps:

1. Start the Windows Server setup. When you get to the install screen (shown below) press Shift-F12:

This will bring up a dos prompt. You’re actually inside of a WinPE (Windows Preinstalled Environment) it’s from here we’re going to: Mount our drive on the Windows 7 install, connect to the volume, create a VHD on that drive, attach the VHD to the system before we continue the setup.

2. In this step we’ll create the VHD and and attach it to our system so the installer will see it.

  • From the DOS prompt enter DISKPART

X:\Sources>diskpart

 

  • List our drives in the system.

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  ——–  ————-  ——-  ——-  —  —
  Disk 0    Online          298 GB      0 B
  Disk 1    Online         3864 MB      0 B

  • Select the drive we’re going to create the VHD on.

DISKPART> select disk 0

Disk 0 is now the selected disk.

  • List our volumes before we create the VHD.

DISKPART> list vol

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ———-  —  ———–  —–  ———-  ——-  ———  ——–
  Volume 0     E                       DVD-ROM         0 B  No Media
  Volume 1     C   System Rese  NTFS   Partition    100 MB  Healthy
  Volume 2     D                NTFS   Partition    297 GB  Healthy
  Volume 3     F                FAT32  Removable   3863 MB  Healthy
  Volume 4                      FAT    Partition    172 MB  Healthy    Hidden

  • Create our VHD on the drive we have our Windows7 OS installed on.

DISKPART> create vdisk file=d:\vhds\windows2008.vhd MAXIMUM=50000 TYPE=EXPANDABLE

  100 percent completed

DiskPart successfully created the virtual disk file.

  • Select the VHD Disk

DISKPART> select vdisk file=d:\vhds\windows2008.vhd

DiskPart successfully selected the virtual disk file.

  • Attach the VHD Disk to the system

DISKPART> attach vdisk

  100 percent completed

DiskPart successfully attached the virtual disk file.

  • Create the Primary Partition on the VHD

DISKPART> cre part pri

DiskPart succeeded in creating the specified partition.

  • Format the new Partition (quickly thanks Alex)

DISKPART> format fs=ntfs quick

  100 percent completed

DiskPart successfully formatted the volume.

  • Assign a drive letter to the new Partition

DISKPART> assign letter=v:

DiskPart successfully assigned the drive letter or mount point.

  • Verify the Volume is there.

DISKPART> list vol

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ———-  —  ———–  —–  ———-  ——-  ———  ——–
  Volume 0     E                       DVD-ROM         0 B  No Media
  Volume 1     C   System Rese  NTFS   Partition    100 MB  Healthy
  Volume 2     D                NTFS   Partition    297 GB  Healthy
  Volume 3     F                FAT32  Removable   3863 MB  Healthy
  Volume 4                      FAT    Partition    172 MB  Healthy    Hidden
* Volume 5     V                NTFS   Partition     48 GB  Healthy

  • Exit DISKPART and DOS (type exit at both prompts) and continue the installation.

DISKPART>EXIT

X:\Sources>EXIT

3.  Now you’ll run the installer making sure to select your 50GB drive you created earlier and install the OS there. On my Dell M4400 it said that booting from the VHD wasn’t supported on my bios. I ignored it and the boot works anyway. Your mileage may vary.

After it’s installed

Okay you should have run through the installer now and yes it’s really just that easy.

Now in Windows 7 and Windows Server 2008 The OS creates a special boot partition that’s 100MB in size. There’s a boot configuration file there that gets automatically updated by doing this install procedure for you so when you’re booting your OS you’ll see the options on the screen.  I’m not going to include more information about that in this HOW-TO but will provide links to some of the great resources I referenced in my own learning process. 

The Cool Stuff

My favorite part of my blog (and why I blog) is The Cool Stuff!  Here’s the cool stuff:

  1. You’re able to automatically see your parent drive on the VHD machine. In my case it’s the D: drive.
  2. You’re able to mount a VHD within Windows 7 and see the content there as well.
  3. We used a Dynamic Disk which will expand automatically (it will not contract automatically) as needed up to the size of the disk we created it as.  Right now my 50GB VHD only uses 7GB of actual diskspace.
  4. We’re able to use Hyper-V now and create our new machines be it for labs or demos and get to use all the cool features of Hyper-V like snapshoting.
  5. All of my laptop’s hardware features are all directly available to the OS since we’re booting from a virtual Hard Drive not a virtual machine.

The Gotchas

This is the stuff I ran into that could pose a problem and how I addressed it.

  1. The installer said my Laptop BIOS didn’t support booting from VHD but I tried it anyway and it’s working fine. YMMV (Your Mileage May Vary)
  2. We’ll lose Hibernate when booted from the VHD and we’re not able to run the System Index Tool to see what kind of scores our computer gets (you can use other tools for that like SiSandra).
  3. When I first installed Windows Server 2008 I couldn’t see my wireless NIC. Turns out this is a feature you need to turn on in Windows Server 2008 which makes sense as I don’t know of any servers with a Wireless NIC.
  4. Once you enable your Wireless NIC, Hyper-V won’t be able to use it to create a virtual switch. But don’t worry there’s a few clever blog posts out there on how to do this using Internet Connection Sharing ;).
  5. I saw a blog post about BitLocker and it not supporting the boot from VHD. I haven’t enabled bitlocker on the new laptop so I don’t know the impact that will have.

Leave a Comment

Scroll to Top