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.

P.S. This post is an anniversary one. It celebrates 100 th post.
Related posts:
- Install Windows Server 2008 R2 or Windows 7 on USB stick
- Windows 7, Windows Server 2008 R2 and Windows Hyper-V Server 2008 are RTM
- RC for Windows 7 and Windows Server 2008 R2
- SP1 beta for Windows Server 2008 R2 and Windows 7
- RemoteFX feature in Windows Server 2008 R2 SP1
Email
Print Viewed 26,412 times.

{ 59 comments… read them below or add one }
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..
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.
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..
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
Setup is running fine now, it’s just expanding files so it should be all-ok.
Thanks!
Luka
I will leave your posts as an warning to others that are too excited.
I am glad that it works now.
Thank you for leaving this comment up… I made the exact same mistake… try number 2.
Hahaha…i made the same mistake of running Win2k8 R2 Setup in Windows 7, that’s why I the error appeared. Thanks for this comment
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..
VHD file does not have to be on system/boot partition, also, please read comments by LuxZg, maybe you have same problem.
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
@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.
Hi Marin Frankovic
Thanks for your information.
Could you please guide me, Its windows 7 means all verison right?
(Home Basic, Home premium and etc…).
Thanks
Jenkins NS
Hi Jenkins NS,
according to TechNet article http://technet.microsoft.com/en-us/library/dd440865(WS.10).aspx, “Native boot from a VHD is available in Windows 7 Enterprise, Windows 7 Ultimate, and all versions of Windows Server 2008 R2.”.
Thank you Marin Frankovic
Dear Marin
Today I installed Windows 7 Ultimate in my Laptop. i5 64bit Processor and 8GB Ram machine.
After that i have follow your steps, all operations are sucessfully completed. Then i restart my laptop it highlight both choices Windows 7 and my VHD Windows 2008. i have selected Windows 2008 its lauch startup repair screen, when i click finish its shutdown the machine. kindly guide me.
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?
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.
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…
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
Thanks for the link Shawn C!
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/
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! =)
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.
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!..
Thanks for this post. I still don’t understand why the Windows Server 2008 R2 image I created using Hyper V BSOD’d when I tried to boot it natively. I felt better knowing I wasn’t alone in getting that behavior. I proceeded with your second option and it worked without any problems.
Hi Brian,
did you sysprep that VHD image created in Hyper-V? Bare in mind that virtual processors and IDE controllers are represented differently in virtual and physical world.
Hi, I tried to install W2008 to a VHD but I do not get Shift + F10 to show a command prompt on the first installation dialog. Pressing Shift+F10 but nothing happens! Can it be that Small Business Server behaviour differs?
Hi Jos,
SBS 2008 is based on Windows Server 2008 (http://www.microsoft.com/sbs/en/us/compare-features.aspx). Boot from VHD is available only in Windows Server 2008 R2.
Thx, Marin. I gues I have to dl R2 then…
It’s possible to boot Hyper V R2 from VHD and then run guest os in Hyper V (vhd in vhd) for teaching purposes?
Hi Noizychild,
of course you can do that. Although, I use external USB to store my VHD, because of disk space.
You give me a great solution. Thanx Marin!
Hi Marin, thanx for the great and simple way on creating a W2008 bootable VHD. I’ve been to several “how to’s” on that but they are too complicated or require too many things/tools to work. I have one question: can I move the VHD to another machine? I saw elsewhere that there is some “detecthal” option on bcdedit, maybe it can be used to that?
Hi GB,
The right way to transfer VHD to another system is to sysprep the OS after installation in VHD and start it on other computer. But that would not give you true mobility between computers since you had to sysprep it every time you move it to another machine. I did not try it with bcdedit detecthal switch. If you try it, please let me know if it works or not.
Well that’s what I did so far: my only boot was a W2K8, and I had VM’s to test SharePoint 2010, wich runs poorly on 2Gb RAM. So your tip allowed me to use all my (4Gb) RAM and CPU to run the test boot – wich I could not do using a VM on Hyper-V. I used differencing disks, wich allowed me to rollback the “damage” the tests did on the boot in a very easy way. And yesterday I reformatted my machine and got back to W7 (the USB TV receiver I bought did not work on W2K8, so I could not watch the Soccer World Cup matches at work – that’s a completely valid reason to reformat your machine here in Brazil
, well, I moved back to W7 and all I had to do to run the W2K8 boot was to duplicate the W7 boot entry and modify it to point to th W2K8 vhd – a couple of bcdedit commands, I’ll put them on my blog in case there’s anyone interested.
I’ll copy the VHD to see if it works on another machine without sisprep and post here the result.
Ok, that doesn’t work. I copied the VHD from my notebook – where it was created – to the desktop, and when trying to boot from it, all I got was a black screen and a reboot. Shame, it would be extremely useful, even more if it could be done from a USB stick… Imagine the uses for a “mobile boot”
Hi gboucha,
you should sysprep it. Regarding boot from USB stick, did you see this article: http://blog.frankovic.net/2010/06/install-windows-server-2008-r2-or-windows-7-on-usb-stick/ ?
I followed the instruction here, once I selected the Unallocated Space (the vdisk), clicked Next, it said “Setup was unable to use the existing system partition because it does not contain the required free space”, and can not move forward. I’ve tried fixed and expandable, both same issue. After I reboot back to win7, I saw the vhd file is created.
Any clue?
Hi Eric,
it seems that your partition was too small. Please read carefully instructions and try again.
I set the vfile to 100G – maximum=100000, should be big enough.
It definitely should be enough.
Well, maybe you selected the wrong one. It is very hard to help you like this. Maybe the best thing would be to try again.
Hi Eric,
Your RECOVERY partition is full…
You may have cerated the VHD on your RECOVERY partition and maybe fix this mistake by recreating the vhd on the right partition. Due to this, you should have one VHD remaining on your recovery partition and the checking process for free space is looking each partition and recovery should have a minimum of free space…
Hi,
I have a situation here:
I have a desktop which has Win 7 Ultimate x64 already installed on c: as normal. Partition d: is empty formatted 120GB.
Now, I have the Information worker SPS 2010 VHD downloaded from http://www.microsoft.com/downloads/details.aspx?FamilyID=751fa0d1-356c-4002-9c60-d539896c66ce&displaylang=en
Can I get it working through this approach?
Hi,
since this is 2008 R2 server, theoretically you could modify it to boot from vhd. What I would do is first try to manually modify boot information to boot to this vhd. This is a long shot since you do not know on which hardware this vhd was made. Second option is to boot this vhd into hyper-v, sysprep it and then connect to it from boot. All in all, I do not think that you will get any valuable results. Better install hyper-v on second partition or in vhd from scratch and then use it to run this virtual machine.
I have done this, with that SPS VHD – it will work, but it’s painful. You do have to go through installing all your HW device drivers for the machine you install on. I simply copied a boot item (bcdedit) and pointed device/osdevice to the VHD.
I agree with Marin – just run a Hyper-V instance and load this thing up.
1 thing to think about if you do choose direct boot to VHD, your target device is 120 G, I believe that image the VHD while expanding is set to 120 GB – that means, when you do boot to VHD it expands to the full 120 GB – you might run out of space on boot.
Hi Shawn,
thanks for the clarification on this.
Hi Shawn & Marin,
I have tried to load to VHD from BCD but, the O/S goes into repair mode. I suspect the H/W config does not matches.
Anyway, I have a try with Virtual Box which is good.
Thanks!!
If you use virtual box, make sure you change the drive (on the host) from a SCSI device to an IDE device. Otherwise, you get BSOD’s – not 100% sure why.
On booting to VHD, yes, you will have to install a whole bunch of HW drivers specific to your host. The existing image is a 2K8R2 image, which has all the Hyper-V extensions as part of the os image. So, I knonw this works, the un-pretty part is just installing all your drivers, etc.
Not 100% sure what/when you say it’s going into repiar mode duing boot.
Hi there, we have been running systems with the following setup, using boot to VHD, since aug last year. 1.5 T drive with 50GB base partition (we use this for admin) and then the balance of the drive has 16 VHD files, thus allowing multiboot to 17 different Windows 7 OS vhd’s. This has been working a treat until recently where we have changed one of the VHD’s to be server 2008R2, the server2008R2 boots no problem, however the VHD’s within the hyper-V don’t boot , stating that the hypervisor isn’t running. Any suggestions would be appreciated. Many thanks in advance
Update to my last post, I have resolved the issue, by BCD did not have the setting to automatically enable the Hypervisor.
Just wanted to let everyone know IF you are not installing Win2008sevr2 in a physical computer. You can still install it Win2008serv2 with Hype using the vmware fusion and follow the steps mention above. The only difference used the command line once you have long on into windows 7 to attach the virtual hard drive.
Hi. I followed your instructions to install Windows 2008 R2 from VHD within Windows 7. I saw the newly created ‘partition’ and selected it as the location of the install. Everything appeared to run smoothly thus far. Whilst the W2k8r2 installation was in gear it showed that there were 4 or 5 phases to the process. Halfway through the first phase it bombed out saying something about not being able to connect to network.’ When I now try to repeat the process the ‘partition’ (vhd) cannot be seen as an option. When I go to Diskpart the VHD file appears detached. I can re-attach the same file but as soon as I exit from Diskpart the VHD detaches itself. I checked by going back to Diskpart and running list vdisk.I cannot understand why the vhd file is not persisting as an attached VDISK. Can I delete the vhd file and start afresh?
Hi Yas,
procedure was tested and works fine. Yes, you can reformat your hard drive or delete created vhd file and start over again.
Hi Marin. Im sure your procedure works but my trawling of the Web to find a method to delete the vhd file has so far failed painfully. I am of the persuasion that there must be a diskpart command to do this in the same manner that it is created in the 1st place? When I run list vdisk – no object is returned, yet I am able to attach the vdisk, albeit temporarily. I am not keen to reformat. Gracias!
Hi,
so you do have Windows 7 installed on one of your partitions and now you want to erase VHD file and create new one? VHD that you created is nothing more than a file. Log in to your Win 7 installation, open My Computer and open C drive. There should be your VHD. Delete it and start over.
My Laptop already had Windows7 installed yet I was trying to setup Win 2008 R2 as a dual boot option as your article detailed. I deleted the vhd file using standard WindowsDos commands and started afresh. Hey presto WIn2k8R2 is now installed and available as a bootup option. What I did learn was that the drive (c:) i initially created the vhd file on was not the C: drive I see from Windows. My C: drive is actually the d: drive when I went through Command prompt during the installation. It has been a while since I’ve had to use the Dos commands.:)
I am using windows 7 ,i am trying to install the windows Server 2008 R2 64 bit , in my machine but when i use vm and selected existing virtual disk , and start the vm it is loading but always rebooting and rebooting never showing up the screen , and it showing a dialog after some time with system recovery options
1)system image recovery
2)windows memory diagnostic
command prompt
I have tried many times downloading the vhds from the
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=16572
full download 1.93 GB
still the same issue , unable to load te windows 2008 r2 vm.
thanks in advance,
please suggest
Hi Ravi,
you are downlaoding premade VHD that is supposed to be used in Hyper-V only. Procedure I explained shows how to install Windows Server 2008 R2 as dual boot option with Windows 7.
Hi Yas,
I am glad that everything worked out!
{ 1 trackback }