Windows Server 2008 R2 (or Window 7 or SharePoint 2010 VHD) Native boot from VHD

 This is the one of thing recently I have searched most of my time. I thought it would be better if I blogged this.  In my case I have Windows 7 ultimate edition installed on my desktop (Base OS) and I want to install Windows Server 2008 R2 but I don’t want install it on physical drive. So solution is Virtual Hard Disk (VHD) Here my main intention to install Windows Server 2008 R2 is for SharePoint 2010 .Instead of creating a new Virtual Hard Disk and install OS,SharePoint 2010 etc..  I directly download SharePoint trial VHD from internet. . I will explain in another post how to install OS in VHD. After downloading all files extract them in a folder. It will extract into a single 45 GB VHD file and everything is installed it. So my next task to make the VHD as native boot (Dual boot). It is very simple, all we have to do is we need to run some DOS commands. Okay, here are the steps   Start –> All Programs –> Accessories –> Command Prompt (Right click – Run as Administrator) It will open command prompt and run the following commands in command prompt.

1.         diskpart

2.         select vdisk file=C:\VHD\windows2008.vhd

3.         attach vdisk

4.         exit

In step 2 I have stored my VHD in C:\VHD\Windows2008.vhd. Replace it with your VHD path. Now a new Drive will attach to your computer. Let’s name it as [I ]  it may be different on your computer. Now open the Command Prompt and run the below command, here my new Drive letter is I, make sure you have entered correct Drive, It will copy a bootconfig entry in to your base OS drive

5.      I:\windows\system32\bcdboot  I:\windows 

Now it is time to add a native boot VHD to an existing windows 7 boot menu. Before begin it is always safe to back up your exiting bootconfig file.  You can do it by running fowling command in command prompt.

6.     bcdedit /export c:\bcdbackup

  Next we will copy any exiting boot entry

7.     bcdedit /copy {default} /d " Name you want display while dual boot"

When the bcdedit command executes successfully, it will return a GUID output in the command prompt window. Now set the  device and osdevice  options for boot entry options for boot entry

8.    bcdedit /set {guid} device vhd=[C:]\VHD\windows2008.vhd

9.     bcdedit /set {guid} osdevice vhd=[C:]\VHD\windows2008.vhd

Make sure that you have copied guid with braces. Some x86-based systems require a boot configuration option for the kernel in order to detect certain hardware information and successfully native-boot from a VHD. At a command prompt, type

10.     bcdedit /set {guid} detecthal on

Now all set to go. Restart your computer you will see your new OS in boot menu