Windows 7 Dual Boot to VHD


I recently got my shiny new copy of Windows 7 Professional (x64) so decided to give it a whirl. Now I was already using Vista Business (x64) and I have been quite happy with it, so will I find Windows 7 that much different?

Well, rather than migrate (which is an option with Vista) I chose to wipe and start again and the install was trivial – then I started to look into some of the new features and the one that has grabbed my attention the most is the ability to dual boot from a VHD. Why bother when you have Virtual PC to host the images you may ask? Well two reasons for me really:

  1. Running a Virtual PC requires the overhead of running you main OS as the host, so booting directly into it would eliminate that waste of memory, processor use etc.
  2. Booting directly into a VHD treats it like a real installation and so uses real driver onto the real hardware – it doesn’t behave like a Virtual machine and so you can test how installations of drivers may really affect the OS and you get a true OS performance rather than some slower interpretation.

So, here is my step by step on how I did it – because believe me it took a few goes and some to get it to work!

1. Install Windows 7 as your main OS

It is useful to note at this point that you do NOT need to leave space on the drive for additional partitions etc as VHD dual booting does not need a partition of its own – it exists within the VHD file on the main partition. If however you want to share data between various dual boots you will need a common ‘D:’ drive or similar.

2. Either create you own VHD image or do as I did and download a ready made VHD from Microsoft.

Here is a link to the download http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=606ae07e-b7db-405b-974b-dd61fc41add4. If this link doesn’t work, I just searched the microsoft ‘Downloads’ for “Windows 7 VHD”.

This gives you a 90 day evaluation copy of Windows 7 Enterprise – but the 90 days starts nicely from when you first use it, not from some preset date 89 days ago! I extracted the VHD (comes as a 3 part rar) which contains the file Win7ENT90DAYS.vhd (as well as loads of other files/stuff you don’t need).

3. Register the VHD for Dual Boot

Now here’s the interesting part. Place the VHD file ‘somewhere’ on your main drive – in my case I created a root folder call “VHD” and placed it in there. So on my machine the file is located as follows:

C:\VHD\Win7ENT90DAYS.vhd

Now open a Command Prompt ‘As Administrator’ and enter the following command:

bcdedit /copy {current} /d "My Windows 7 Enterprise"

This will give a response similar to this:

C:\>bcdedit /copy {current} /d "My Windows 7 Enterprise"
The entry was successfully copied to {aefc86cc-c9b9-11de-a443-86288b18463d}.

Now enter the following two commands, using the GUID generated in the above command:

bcdedit /set {GUID} device vhd=[C:]\VHD\Win7ENT90DAYS.vhd
bcdedit /set {GUID} osdevice vhd=[C:]\VHD\Win7ENT90DAYS.vhd

This will give a response similar to this:

C:\>bcdedit /set {aefc86cc-c9b9-11de-a443-86288b18463d} device vhd=[C:]\VHD\Win7ENT90DAYS.vhd
The operation completed successfully.

C:\>bcdedit /set {aefc86cc-c9b9-11de-a443-86288b18463d} osdevice vhd=[C:]\VHD\Win7ENT90DAYS.vhd
The operation completed successfully.

This has registered the VHD file as a potential Dual Boot and will appear in the list as “My Windows 7 Enterprise”

ReBoot and you should now see the Dual Boot menu and simply choose the new entry “My Windows 7 Enterprise”.

GOTCHAS et al

I stumbled at a few points getting this far when using the bcdedit utility, so take careful note of the following points:

  • include the curly braces – the curly braces around the GUID form part of the instruction
  • include the square brackets – the square brackets around the drive letter (in this case [C:]) are important and form part of the instruction

Removing the Dual Boot Entry

Should you wish to remove the Dual Boot open a Command Prompt ‘As Administrator’ and enter the following command:

bcdedit

This will list all the currently registered entries. One of these entries will be “My Windows 7 Enterprise”. This will give a response similar to this:

Windows Boot Loader
-------------------
identifier              {aefc86cc-c9b9-11de-a443-86288b18463d}
device                  vhd=[C:]\VHD\Win7ENT90DAYS.vhd
path                    \Windows\system32\winload.exe
description             My Windows 7 Enterprise
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {aefc86c1-c9b9-11de-a443-86288b18463d}
recoveryenabled         Yes
osdevice                vhd=[C:]\VHD\Win7ENT90DAYS.vhd
systemroot              \Windows
resumeobject            {aefc86bf-c9b9-11de-a443-86288b18463d}
nx                      OptIn

Note the GUID and use it in the following command:

bcdedit /delete {GUID}

This will give a response similar to this:

C:\>bcdedit /delete {aefc86cc-c9b9-11de-a443-86288b18463d}
The operation completed successfully.

So there you have it…simple isn’t it. Now I can have multiple Dual Boot options for various reasons using a single VHD image as the starting point for each of them.

I would suggest configuring the first one, then boot into the main OS and copy the VHD (as a backup) so you can reset back to it is you want – and to do that you don’t even need to use the Command Prompt, just replace the VHD whilst in the main OS.

Advertisements

One Response to Windows 7 Dual Boot to VHD

  1. Pingback: Multi Boot into Windows 8 from VHD on Windows 7 « Stuart's Space

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: