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

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.




Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • HelloTxt
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • StumbleUpon
  • Technorati
  • Twitter
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

27 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

  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.

  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]\BOOTVHD\WinSrv2008.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?

      • That’s not it.
        There are only two OSes. You use the first OS to install the second and the two OS’s appear in the menu. The second OS is in a VHD in another partition.

  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.

Leave a Reply

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

*

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>