Dual booting Windows Server 2008 R2 with Windows 7 using VHD booting

by Shijaz Abdulla on 05.11.2009 at 20:38

I wanted to run Windows Server 2008 R2 in a dual boot configuration on my Windows 7 RTM laptop – so that I can demonstrate Windows Server 2008 R2 features to partners when required.

This gave me an opportunity to use the new “Boot from VHD” feature on Windows 7 and Windows Server 2008 R2. Essentially, I would have Windows 7 on my laptop on one partition on the raw disk. The remaining space on the RAW disk (in my case 15 GB) will be allocated to a partition containing a VHD (Virtual Hard Disk) file, that can be mounted to boot the computer off the VHD file. I will be installing Windows Server 2008 R2 on this VHD file.

image

Here’s how I went about doing it.

Since I did not have any unallocated space on my hard drive, I used the “shrink” option on drive C in Windows 7 (Computer Management) to get some free space – and got 15 GB unallocated as seen in the above screenshot.

Next, I popped in the Windows Server 2008 R2 DVD.

image

At the Welcome screen above, I press SHIFT+10 to launch the WinPE console.

Once you get the WinPE console, use DISKPART to prepare a partition for the Windows Server 2008 R2 VHD:

  1. Type ‘DISKPART’ to launch the utility
  2. Type ‘LIST DISK’ to see the list of physical disks in your machine.
  3. Type ‘SEL DISK 0’ assuming you have only 1 physical disk installed
  4. Type ‘CREATE PARTITION PRIMARY’ to create a primary partition out of the free space
  5. Type ‘FORMAT FS=NTFS QUICK’ to quick-format the new partition on NTFS format
  6. Type ‘LIST VOL’ and look at what you’ve done :-) . Notice the asterisk next to the new partition (in my case, it’s Volume 3).
  7. Type ‘ASSIGN’ to assign the next available drive letter to the selected partition.
  8. Type ‘LIST VOL’ again to see what drive letter was assigned (in my case, it’s E)
  9. Now for the magic: ‘CREATE VDISK FILE=E:FILENAME.VHD MAXIMUM=15000 TYPE=EXPANDABLE’ – this creates a dynamically expandable VHD file filename.vhd on the new volume with a maximum size of 15000 MB. Keep the maximum size lesser than the size of the partition.
    WinPE Screenshot
  10. Notice that once you finish this command, Windows 7 detects virtual hardware “Microsoft VHD HBA” and installs it. 
    image
  11. Type ‘SELECT VDISK FILE=E:filename.vhd
  12. Type ‘ATTACH VDISK’ to attach the VHD disk.
  13. Type ‘CREATE PARTITION PRIMARY’ to create a primary partition inside the VHD.
  14. Quick format the partition on NTFS by issuing the ‘FORMAT FS=NTFS QUICK’ command
  15. Assign a drive letter V: on this volume ‘ASSIGN LETTER=V:
  16. LIST VOL to see what you’ve achieved.
  • Volume 1 and 2 were pre-existing Windows 7 volumes
  • Volume 3 (E:) is the disk that we created to store the VHD file
  • Volume 4 (V:) is the virtual disk inside the virtual machine (uses space on E:)

WinPE screenshot

Type EXIT DISKPART to close the utility and close the WinPE session.

Next, continue with the Windows Server 2008 R2 installation from Windows 7. Do not choose the upgrade option, choose the New Installation option.

Choose to install Windows on the partition you just created.

 

image

When installation is complete, and you restart your computer, a boot loader menu appears, where you can choose to boot Windows 7 or Windows Server 2008 R2.


About Shijaz Abdulla

facebooktwitterlinkedin

Shijaz Abdulla is a Datacenter Technology Solutions Professional at Microsoft, based in Doha - Qatar and helping customers better manage their infrastructure using Microsoft technologies. He is a blogger and a technology enthusiast.


Trackback Permanent Link

81 Responses to Dual booting Windows Server 2008 R2 with Windows 7 using VHD booting

  1. Anonymous says:

    Was Wins 7 already installed on your laptop before installing Sr2008?
    Thank you.

  2. Shijaz says:

    Yes. Windows 7 was installed.

  3. Anonymous says:

    32 bit i'm assuming?

  4. Shijaz says:

    No, 64 bit all the way!
    64bit version of Windows 7 Ultimate and Windows Server 2008 R2 of course is 64 bit.

  5. nalvarez says:

    Let’s say that I have some virtual machines (created in a Win. Server 2008 R2 Hyper-V) stored in the partition of Windows 7.

    I want to know if I’m gonna be able to see and use these virtual machines from the VHD partition running 2008 R2, as well as the rest of the files from the W7 partition

    Thanks

  6. SAK says:

    In the last step, should i install windows 2008 server in E or V.

  7. Staats says:

    Quick question… Does anything special need to be done to allow booting from a VHD? When I’ve tried this, the installation will nto allow me to install on the vhd because it is not bootable. Any ideas? Thanks for you help!

  8. humalla says:

    i did all that went to install and i get a error not enoth temp memory (533mb needed) i free’d up 102gbs for this windows server 2008 install i have more than enoth space 100gb on c drive 300gb on d

    its only 1 hdd 500gb would you happen to know why its coming up with this probem

    using windows 7 64bit pro

    want to install duel boot windows server 2008 64bit

  9. humalla says:

    this computer does not have enough space for temporary files. windows installation needs at least 535 megabytes (MB) of space on any partition for temporary files. to install windows, free enough space and restart the installation

    error code 0×80070103

    i dont understand the problem when i have put 102gb for it to install on

    • Tom says:

      I got this error code too because it wants to install the temporary files on the active partition. My active partition was the System Reserved partition that is only 100MB in size. Once I changed the active partition to the C drive (where I have Win 7 installed), then the error message went away.

      • Jake says:

        Thanks, that fixed my problem!

        In case anyone is wondering, to change the c drive’s partition to active, follow these instructions (for win7):

        Don’t mark a partition as active if it doesn’t contain the loader for an operating system. Doing so will cause your computer to stop working.

        Open Computer Management.‌ If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

        On the left, under Storage, click Disk Management.

        Right-click the primary partition that you want to make active, click Mark Partition as Active, and then click Yes.

  10. ondras says:

    Hi,
    according to your steps, will be Server 2008 R2 (booted from VHD) able to install Hyper-V role?
    Thank you

  11. Gustaf says:

    Hi!
    Please help me, I dont get it to work..
    I do all the steps untill the last one.
    Install windows 2008 server r2 on the V:.
    It says “it can not install windows on this disk. the selected disk is a virtual disk exposed. It cannot install windows on the disk, its not certain that the computers hardware has support to boot from the disk. Make sure the disk’s controller is enabled in the bios menu.”
    Thanks.

    • Eric says:

      I encountered the same issue.

    • Chris says:

      I hit the same issue.

    • Steve says:

      I’m running into this same issue as well.

    • Bora says:

      I also hit the same issue when using V: (virtual hard drive) instead of E: (physical partition) as target for new Windows 2008 Server installation. Actual message is as follows:

      “Windows cannot be installed to this disk. The selected disk is a surfaced virtual disk.

      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.”

      I wonder why does the image in the last step show that E: is selected, and not V:. Later in a port Shiaz says that V: should be used, but apparently Windows will not install on it? Could it be that Shiaz made a mistake in the first place? Or could it be that you can do this only on machines with hardware virtualization support? When I try to install on E:, it works, but obviously this will install on normal partition, not on VHD one…

      Anyhow, looking forward to seeing a meaningful reply from Shiaz on this question, as well as the question from Staats’. There’s also a missing reply on Zull’s question on how to reuse VHD file created in the process.

      If all these questions remain unanswered, I’d suggest to everybody to treat this post as a guide on how to install Windows 2008 on a normal physical partition, and to skip all the parts related to creating and formating a VHD file, as it’s not used if installing on E: partition.

      • Hi

        Yes, you need hardware assisted virtualization in the first place.

        Shijaz

      • Alistair says:

        You’ll get that error if you run the final Windows Install (Win Sever 2008) from inside Win 7. You need to boot from the Windows Server disc. You’ll get the same error message, but you will be allowed to continue this time. I think you might need to create the vhd file within Win7 to get Windows to download that driver though, so it was a two stage process for me.

    • Moses says:

      for all of you with the Bios error
      as long as your computer does supports VT.
      burn server 2008 to a dvd
      boot from dvd
      follow the guide from the boot disk installation (NOT FROM INSIDE WINDOWS)
      it should present this error but the NEXT button won’t be grayed out and allow you to continue

      worked like a charm for me :) ))
      cheers,
      Moses

  12. Swarup says:

    I am guessing the W2k8 dual boot will be able to access any partition on the machine from here on out, like the C drive? This way, you just need a partition to contain the boot VHD file?

  13. Rick Powell says:

    Great work on this tip. It helped me and worked just as you have instructed.

  14. Rick Powell says:

    Where is the text bootfile so I can modify it?

  15. charlie says:

    Argh. I’m coming up with “The specified command or parameters are not supported on this system.” on the diskpart. Is this because it is 32-bit or anyone have other suggestions as to why I Can’t get this far? It is a 100gb drive with 30gb free.

  16. Zull says:

    At your step 9, How can I re-use an existing VHD which was created the same way on another Windows 7 machine. This VHD has all that is needed for Win Server 2008 R2 configured as a Hyper-V.
    I have got rid of my existing laptop, and now am looking to move my existing VHD to the new machine.
    I am assuming here that steps 1-8 will create the necessary boot entries for me and then at step 9, instead of creating a new VHD, I’ll attach an existing VHD.
    Please validate.
    Thanks.

  17. Zull says:

    Also, for Rick Powell’s question, I guess you can edit the bootloader using something like this:

    BCDEDIT /SET {default} DEVICE VHD=[LOCATE]BOOTVHDWinSrv2008.VHD

    Note: Pl Bing for the “BCDEDIT” command for appropriate syntax and parameters.
    HTH.
    Thanks.

  18. martin says:

    Guys, can someone please explain me one thing?
    Creating VHD file is being done from OS already installed. After successfully performing the above described steps, I will get a dual boot windows to choose from correct? But what happens with the actual OS these were made on? I mean I have Windows7 on which will be doing this, so creating two systems. After this completes, and rebooting dual boot window appears, so what happend with the Windows 7 i was using to create these two VHD files? There will be option to choose from two or three?
    Thank you in advance for replies

    • Yes, you will get 2 options to choose from.

      • martin says:

        Thank you very much.
        But can you please tell me what happens with the OS I was using to create these two new? I have an host system on 500GB physical drive, and want to create Windows 7 and Svr 2008 R2. I believe I can allocate them 80GB each, but can I move it later to different Physical drive? Will these two new OS work if just copied to 2nd physical drive if first is disconnected?

  19. martin says:

    I see, thank you :-) . One more question and i am gone.
    i want to have each system partition 80GB [on a 500GB hdd] how should i divide the drive? 160GB and then vhd will take 80 GB or else?
    One more time thank you for an answer and yor time.

  20. mayur says:

    Hi I am trying to install exactly as you mentioned. Able to create the partition and vhd. But when i am trying to install Hyer v server 2008 R2 on the newly created drive ( 117 GB), its giving me error like “Windows setup cannot locate a valid hard drive to store temporary installation files. To install windows, create more free space on the hard drive or add a new hard drive” Please Help.

  21. Darren Schmidt says:

    Had some problems that revolved around the system partition not being large enough. Installing on an HP Laptop with two 500gb hd’s. I installed Win7Ultimate and it only created a 100mb system partition. I increased this to 2gb and my problems went away. Thanks for the walk-through.

  22. miller adams says:

    Hey all …
    Everything went smooth on my Win 7 home premium. Then I started the install of Server 2008 and pointed it to the newly created VHD V:
    Got this message:
    Windows cannot be installed to this disk. Windows needs the driver for device [Microsoft VHD HBA] Click load drivers and load the required device driver.
    I tried the install media in the CD ROM and the local C; drive but it would not locate this driver …
    any ideas
    cheers,
    miller

    • Raghav says:

      Hi Miller,
      I got the same issue how did you resolve it ?

      cheers,

      Raghav

      • david says:

        I ran into this problem as well

        The reason it happened with me is because the VHD was set to dynamic, it needs to be a static set size VHD.

        anyways, i hope this helps anyone.

  23. Serge says:

    Hi, I follow these steps and was able to create the partition for a dual boot installation of win server 2008 R2 on my laptop running win 7 ultimate. My laptop is a HP dv6 pavillion. But I couldn’t install the win sr2, because I’m receive this message: “Windows is unable to copy the required files. these files are missing or corrupted…” I tried to install win sr2 Hyper-V, the same message.
    Please help me!
    Thanks

  24. Raghav says:

    when I press SHIFT+F10 i am not gettimg Windows PE console.. any idea ??

  25. Kevin says:

    Shijaz,

    Is VHD a feature of Windows 7 Home Premium? Can I follow the same steps if I’m trying to dual-boot with Win2003 R2? Thank you…

  26. Tarun Khurana says:

    I followed your steps and everything works great. I have a question. When I boot into Windows 2008 I see drives C: & V: where C: has my Windows 7 installation and V: is my Windows 2008 installation. Can I re-arrrange drive letters in Windows 2008 so I can make V: –> C: The reason being when I install programs the setup packages are defaulting path to C: and I am concerned it may break programs installed on Windows 7 installation. Will there be any issues with me changing drive assignment for C: & V: to without impacting the environment.

    Thanks for all your help!

  27. J90 says:

    So just to clarify on the last step do you install Server 2008 on the virtual machine (E:) or on the virtual disk (V:) ?

    Then you let it restart and it finishes setting up the install of Server 2008 ( This won’t overwrite my the current OS, right?)

    Then next time you start the PC you’ll have a dual boot screen appear, like this:

    http://images.maketecheasier.com/2008/12/dual-boot-screen.jpg

    Correct?

    Thanks

  28. Marcia says:

    I have a question if I have a dual boot and have my Visual Studio 2010 on Windows 7 and my MS SQL 2008 on Windows Server 2008 Ent..
    Can I work on Windows 7 and access MS SQL 2008 using Visial Studio when developing?
    I hope this is not a silly question.

  29. Eranda says:

    Is this method takes more memory than install windows 2008 server in another partition without VHD (the old method) ?

  30. Zohaib says:

    I am walking though the steps. However when I attempt to create the second primary partition on the virtual drive it disconnects the virtual drive and gives an error that the device is not connected. I have tried several times and the vdisk does show up but as soon as I request a primary partition it disconnects.

  31. Jaiganesh says:

    i dont have win2008r2.vhd file.
    i have only the setup of windows 2008 r2
    with this can i do dual boot

  32. anirban says:

    Shijaz sir

    in the same case,suppose in my pc i have alreadyy installed windows server 20003 sp1 and i want to install windows server 2008 32bit edition,should it is possible

  33. pummy says:

    I have win 7 home premium installed on my laptop.I am assuming I can’t use this vhd method to insert a vhd boot of server 2008 to make laptop dual boot.Because may be windows 7 has to be ult or prof(supporting initial virtualization).So what are my options?Can I still do vhd dual boot?Or do I have to go old way.also,I heard server 2008 has problems in dual booting with windows 7 old way.Has anyone done it please?

  34. Robert Stewart says:

    @Pummy:

    I just setup my latptop (Dell E6510 with single 500GB HDD) in a dual boot config the old way.

    Installed windows 7 to a 230 GB Part
    Went back and installed 2008 R2 to the remaining Part and all is well.

    Let me start by explaining what got me into this config. This is my corporate laptop and I wanted to be able to boot to 2008 to run Hyper V and look at reference servers all from my laptop. What I failed to notice when originally setting this up with the Corp Win 7 image, is that there was not System Reserved partition in front of Win 7. Once I created the second partition by shrinking the C: and then installing W2K8 R2 to the empty part I found myself not being able to boot back to the corp image as the BCD had no info for the original part.

    I assume this happened because the original Corp Image did not seperate a system reserved part to hold the BCD so my 2008 image wrote BCD to the secondary part and thats all it knew about.

    Be careful to ensure that your primary OS instal has a System Reserved part in front of the OS part before installing a secondary OS to an alternate partition or you will find yourself in the same boat as myself. Now off to the office to reload my corp image and try this all again.

  35. kumar says:

    Hi Shijaz,

    I have a Windows 7 Home Premium with 64 bit(4Gb RAM) and i already have Win 2008 R2 VHD.Can i make VHD bootable from Home Premium by following the above steps?

  36. bharath says:

    Hi All,
    I am trying to install windows server 2008 unattended using unattend.xml.I am doing this in a virtual machine with three drives(c,d and e).Before calling the setup.exe , i create three partitions using diskpart and format(NTFS).
    Once the installation starts i get the error:”Setup was unable to create a new system partition or locate an existing system partition. See the Setup log files for more information.”
    The setupact.log in c:windowspather says that “the selected disk is not computers boot disk.”
    I am using diskpart to create partion and assign letter.
    Any help is much appreciated.

  37. Carlos says:

    Hola, Estoy buscando Windows Server 2008 R2 32 Bits, existe?

  38. Carlos says:

    Hi!
    I am looking for windows server 2008 r2 32 bit, where I can download?

  39. JOHN says:

    Hi,
    i am using window 7 32-bit and now want to install windows server 2008 R2 in dual boot,
    i have a problem here that in computer management when i try to shrink my C: drive it only allows to shrink 560 MB , but there is 60 GB free space, i have total 3 partitions all have more than 60 GB free. i dont have any idea what to do, can anyone guide me , ill be very thankful

  40. niels says:

    GREAT run through.
    quick question. I have a SCCM vnext ready downloaded from microsoft.
    Can I boot from that? how do I go about?

  41. Rich says:

    Possible to do the same (Dual Boot) with Windows Home Server V1? How about Windows Home Server 2011?

    Great info!

  42. Radu says:

    Hi Shijaz,

    Question: I had win 2008 r2 installed on 1 separate partition and i didn’t know that by installing win7 my dual boot will disappear, is there anyway i can fix the booting table and try to get my win server 2008 booting option back? I mean the server is still there on the separate partition…..so there should be a way, please tell me there is.
    Thanks!

  43. Edward R says:

    Excellent information and great help. Any special / specific instruction for widows vista home edition users. Please advice.
    Thanks
    Edward R

  44. saeed ghahremani says:

    thank you .

  45. Pingback: Dual booting windows 7 and server 2008 - MoonRivers Media LLC

  46. Pingback: How to Dual Boot from a VHD - Dynamics NAVAX - AX Technical Blogs - Microsoft Dynamics Community

  47. Patty McPherson says:

    I too am having the problem installing WinServ08r2 – receiving message:
    “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”.
    my laptop is toshiba satellite i5- virtualization technology = ( intel vt -x only) – does anyone know if this is not sufficient? do I need (intel vt -d)?

  48. Patty McPherson says:

    I ran Microsofts “hardware virtualization detection tool” and it came positive — So i should be ok with this requirement. Still –can’t get it to work.

    thanks

  49. Pingback: MoonRiversTechnology Blog - Dual Booting Windows 7 and Server 2008

  50. Chaks says:

    Hi

    I have a Sony Vaio laptop. Config is i5 processor, 320 GB harddisk, 8 GB ram. It has come with Windows 7 professional. Recently I have tried to install Win Server 2008 R2 in another partition. After installation, when I choose Win Server, it worked well, but when I choose Win 7, it crashed saying Boot MGR is missing and later started saying OS not found. I got it formated again to the factory settings. Now C: is 100 GB Primary, D: is 100 GB logical and H: is 83 GB Logical. Also 13.3 GB is Recovery partition and 100 MB is system reserved.

    Now I wish to install Win server 2008 r2 in D:. Please let me know the steps to achieve this.

    Thanks & Regards
    Chaks

  51. satti says:

    Hi Shijaz,

    I have windows 8 in my lappy (dell inspiron 15 r 5520) and I am trying to install windows server 2008 R2 in my laptop and I tried the above process to create VHD and then install win 2008 server in that upto the last step its going well but after selecting the virtual partition (V:) to install the server its throwing the below error:

    Windows cannot be installed to this disk. The selected disk has an MBR partition table. On EFI systems, Windows can only be installed to GPT disks.

    Windows cannot be installed to this disk. The selected disk is a surfaced virtual disk.

    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.

    please let me know how to resolve the above issue.
    laptop config: i7 , 1 TB hard disk, 8 gb ram.

    Thanks,
    Satti

  52. usama says:

    Dear while doing the steps u mentioned i got message.
    (no usable free extend could b found.) actually i am already having max 4 primary partitions so it wont allow me to create the 5th one. in this case wht should i do.
    i can send you screenshots

  53. Kaizad Driver says:

    Hi.

    I’m running a Dell Inspiron 6210 with a core 15 processor, 8gb of Ram and Win8 64bit.
    I want to use dual booting by using a vhd that I already have which has Windows Server 2012 already installed on it.

    Using Oracle Virtual box means that I cannot allocate all CPU’s and RAM. Hence the requirement of booting from the vhd itself.

    Can I make a dual boot using Hyper-V™ Server 2008 R2 or is there some way I can dual boot directly using the available vhd.

    Would appreciate any advice you can give.

    Thank you.

  54. aj says:

    I was able to install Windows 2012 w/ Windows 7 dual booting 2012 as the VHD. The instructions are spot on….Windows 7 created that 100mb partition during the inittial installation, on my machine I have that inactive so when the installation routine begins it doesnt even see that.also by following the FORMAT instructions to the letter you should be able to get the VHD partition primed for the installation.

Leave a Reply

Your email address will not be published. Required fields are marked *

Connect with Facebook

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>