Boot Windows Server 2008 R2 RC from VHD within Windows 7

by Marin Franković on 16 May, 2009

As I wrote in some of my earlier articles, Windows 7 and Windows Server 2008 R2 can be booted from VHD file without need to be installed on "real" physical disk. This is great option for testing or even deploying multi boot computers to users. Possibilities are endless.

Few days ago I decided to exploit this opportunity and to install Windows 2008 R2 RC in VHD and use it as boot option on my laptop. There are basically two ways you can do this.

First I created new virtual machine in Microsoft Hyper-V console and tried to implant it on my existing Windows 7 installation. I successfully modified boot sector to include VHD file but when I tried to boot from it I got BSOD.

Then I tried another possibility, I installed Windows 2008 R2 to VHD directly from its installation procedure. And it works great! :) Here is procedure on how to do it:


Bare in mind that I already have Windows 7 installed.

  • Physical disk that will hold VHD file must be formatted (does not have to be empty, can not be USB)
  • Boot from Windows Server 2008 R2 DVD
  • When first installation dialog box appears pres SHIFT + F10 to open command prompt
  • Launch diskpart
  • At diskpart prompt enter following command create vdisk file=c:\win2k8r2.vhd type=fixed maximum=20000 (this will create VHD file of 20 GB and it will be fixed size, you can even use expandable as type. You can also change name and location of vdisk file)
  • Next, run select vdisk file=c:\win2k8r2.vhd
  • Run attach vdisk
  • Exit from diskpart and command prompt
  • When selecting partition on which to install Windows Server 2008 R2, select newly created and attached VHD partition. Ignore any warnings like "… cannot boot from this partition".

When installation finishes, you will have an option to boot from Windows 7 or Windows 2008 R2 RC. If you want to remove Windows 2008 R2 RC, all you need to do is edit boot menu with bcdedit command and delete or move VHD file.

Dual boot


P.S. This post is an anniversary one. It celebrates 100 th post. :)


{ 1 trackback }

SCVMM 2008 R2 guide (Part 1) | I am legend
12 October, 2009 at 9:44

{ 19 comments… read them below or add one }

1 LuxZg 22 May, 2009 at 19:54

When creating VHD, is it required to be placed on system/bootable partition? I have followed the steps, and tried some variations as well, but no matter what I do the “next” button is disabled when I select a virtual disk as a partition where I want to install OS. I can’t think of any other reason, and unfortunately my system (C:) partition is too small to accommodate one more OS..

Reply

2 Marin 23 May, 2009 at 1:26

As fas as I know, vhd file can be on any partition, as long as it is formated. Bare in mind that your hardware has to support 64 bit OS. Also, partition should not be smaller than 20 GB.

Reply

3 LuxZg 23 May, 2009 at 9:51

Hardware has 64bit support, as I’m running Win7 x64 on it. Partition is all fine, formated and all, as I have other files on it. And I have tried with partition of 30.000 MB as well.

I do have one difference compared to this “guide” post, VHD isn’t shown in setup GUI although it is attached. I have to initialize and create a partition for it to be shown. But again, “Next” is grayed out.
I have also just noticed that error I get is actually two separate errors/warnings in one text.
First one is virtual disk related-> “Windows cannot be installed to this disk. The selected disk is a surfaced virtual disk.”

But second one could be my real problem-> “Windows cannot be installed to this disk. This computer’s hardware may not support booting to this disk. Ensure that the disk’s controller is enabled in the computer’s BIOS menu.”
So I’ll check if my secondary drive (which holds the image) is properly recognized in BIOS..

Reply

4 LuxZg 23 May, 2009 at 10:21

You can erase my previous post. It says clearly in your post:
“Boot from Windows Server 2008 R2 DVD”

BOOT! I ran the setup from Windows 7 yesterday.. but have been too excited by the idea to think properly :D

Setup is running fine now, it’s just expanding files so it should be all-ok.

Thanks!
Luka

Reply

5 Marin 23 May, 2009 at 11:10

I will leave your posts as an warning to others that are too excited. :) I am glad that it works now.

Reply

6 Jacob 4 February, 2010 at 3:29

Thank you for leaving this comment up… I made the exact same mistake… try number 2.

Reply

7 LW 29 May, 2009 at 1:08

When creating VHD, is it required to be placed on system/bootable partition? I have followed the steps, and tried some variations as well, but no matter what I do the “next” button is disabled when I select a virtual disk as a partition where I want to install OS. I can’t think of any other reason, and unfortunately my system (C:) partition is too small to accommodate one more OS..

Reply

8 Marin 29 May, 2009 at 7:44

VHD file does not have to be on system/boot partition, also, please read comments by LuxZg, maybe you have same problem.

Reply

9 paillave 12 September, 2009 at 12:51

Hi
Maybe I didn’t get very well your tutorial. What is the point to boot on a vhd for testing purpose if the partition that hosts it must be formated? Wouldn’t it be the point of this feature to have multiple vhd on an existing partition/physical hard drive we can boot from?
Thanks

Reply

10 Marin Franković 12 September, 2009 at 15:42

@paillave You can have multiple VHD files on one partition. You can have operating system on host partition or not. All your operating systems can be in VHD files. There are no limits for combinations. For example, I have Windows 7 installed directly on disk and Windows 2008 R2 in VHD file which is located on the C drive of Windows 7. Now I could copy my existing Windows 2008 R2 VHD file to D partition, “sysprep” it and have one more instance of Windows 2008 R2 to boot to. My boot menu would have 3 entries, one Windows 7 and two Windows Server 2008 R2. I use Windows 2008 R2 as second operating system for teaching purposes. I run Hyper-V in it. It is much cleaner to install OS into one VHD file than to install it as dual boot. Feel free to contact me if this explanation does not help.

Reply

11 Roman 15 September, 2009 at 7:29

What I would really like to do is run WS2008R2RC in a Virtual PC guest on Windows 7. That’s how I’ve been doing all my testing. That allows me to pause and go do other things or access the internet for information and then switch back. Is this not possible? When I try it, I get the error that my CPU is not 64bit. I do have Windows 7 installed as 32bit. I guess Virtual PC does not have the ability to emulate either?
VirtualBox will usually do this, but it’s having some other error message. Having a dual boot is much less useful than simultaneous boot. Any ideas?

Reply

12 Marin Franković 15 September, 2009 at 8:48

Windows 2008 R2 is 64 bit operating system. Hyper-V and VMWare ESX server are the only virtualization technologies that can emulate 64 bit environment for 64 bit virtual machines. So this means that you can not install 64 bit operating system into Virtual PC or MS Virtual Server 2005. Microsoft is in process of creating Virtual PC 7, which is supposed to be Virtual Server 2005 succesor, but it is not yet available for download.

If you install Windows Server 2008 R2 in VHD file, it is very easy to remove it later on. just delete entry from boot manager in Windows 7 and that is it. Much cleaner than “normal” dual boot.

Reply

13 Shawn C 9 November, 2009 at 0:39

In your comment of 9/12, you mention making a copy then sysprepping, then having 3 items in the boot menu.

How did you add the addition boot entry to point to an additional VHD file? Via BCDEDIT or BDCBOOT?.

Basically, if I just put another VHD on a disk, now I want to get this added to my boot menu. Let’s assume it’s a VHD that contains either Win7 or Win2008R2 just to make it simple. What do you see as the steps to add it to the boot menu?
Thanks…

Reply

14 Shawn C 9 November, 2009 at 0:48

Never mind – found a great link. Last “section”
To add a native-boot VHD to an existing Windows 7 boot menu
http://technet.microsoft.com/en-us/library/cc731662%28WS.10%29.aspx

Reply

15 Marin Franković 9 November, 2009 at 20:34

Thanks for the link Shawn C! :)

Reply

16 matt 10 November, 2009 at 23:37

To those interested in creating native VHDs on systems such as Windows XP, Windows Server 2003, Windows Vista, Windows 7 etc…Take a look at this utility. This takes all the work out of setting up a dual-boot VHD environment and manages it as well.

http://www.portlock.com/products/leap_frog/

Reply

17 Olops 9 December, 2009 at 9:37

Hi,

How can I boot from an existing VHD(with XP OS already created using VPC)? Can I just edit the boot.ini and add the existing VHD in list? How?

Actually, I’ve been trying to convert my VHD into a selected physical partition. Is that possible?

Thank you in advance! =)

Reply

18 Marin Franković 9 December, 2009 at 9:48

You can not boot Windows XP from VHD file. You can only boot Windows Server 2008 R2 or Windows 7 from VHD. The easiest way, that comes to my mind right now, to “convert” VHD to physical disk is to start your VHD in Virtual PC, use Ghost to capture OS image in Virtual PC and then deploy that image on physical computer.

Reply

19 Olops 9 December, 2009 at 10:22

I see.. I’ve tried WinImage but no luck coz it is not giving me an option to select a partition or drive letter.It just gives the option to format the whole physical drive (disk 0) and restore the content from the VHD. Anyway, I’ll try Ghost.. Should I expect to encounter a trouble on that? If yes, what are those trouble and how to resolve them?.. Thank you!..

Reply

Leave a Comment

Previous post:

Next post: