Running Hyper-V Server 2008 R2 from USB

Having read about ESXi which can be bought from Dell / HP in an embedded manner, which lets you boot without harddrive I decided to go on the journey to accomplish the same thing with Hyper-V Server 2008 R2. The closest I got to an “embedded” storage thingie was a Kingston USB-stick with 16 GB of storage on it. Worth to note here is that USB-sticks doesn’t have the greatest read/write performance, which I was aware of before I started.

If you wanna see it in action you can always watch the 2½ minute video filmed with iPhone (not the best quality, sorry!) New video shot with video-cam instead, looks a little better (I blame the rest on FLV…).

Updated: I’ve been informed through email that the OPK (OEM Preinstallation Kit) is freely available at Microsofts site.

Download it here: http://oem.microsoft.com/script/contentpage.aspx?PageID=561189 (You might need to register)

Starting off I first decided to install Hyper-V Server onto my USB-stick. That was an epic fail since it’s not (without a lot of trouble) installing Windows onto a removable drive. So I took the easy approach which saved me (and will save you) a lot of time. Boot from VHD! (click for a TechNet-video) This is a gift from Microsoft staff and Santa Claus to the rest of us. You just need to get everything right and keep track of which drive is which and why and when. But there’s a walktrough coming along nicely below this text.

Step 1: Get a USB-drive with at least 8 GB storage. This is minimum req’s for Hyper-V Server 2008 R2, but I’d recommend 16 GB. Shop the fastest one you can find, it’ll be worth it when you have to sit around and wait. You’ll also need the ISO for Hyper-V Server 2008 R2 and the Windows Automated Installation Kit (WAIK).

Either burn your ISO or use a program to mount it as a virtual drive. You could also extract the files to a directory

Step 2: Fire up CMD with admin-rights.

diskpart (starts the disk management CMD-utility)
create vdisk file=driveletter:virtualharddisk.vhd maximum=14500 type=fixed (creates a VHD on driveletter: of the size 14500 Mb and it’s fixed size for better performance)
select vdisk file=driveletter:virtualharddisk.vhd (selects the created disk)
attach vdisk (attaches it so Windows can see it)
list disk (shows you all the disks in the system, note the number of your newly created VHD)

select disk disknumber (selects the newly created VHD)
create partition primary (creates a primary partition)
select partition 1 (selects the primary partition)
active (sets it to active)
format fs=ntfs quick (format it with NTFS and do it quick)
assign (assigns a driveletter, note with driveletter it gets!)

Leave this window open and start a new CMD with administrative rights.

Step 3: Download Windows AIK from Microsoft (1.7 GB) and install it. You need this to get ImageX which we’ll need soon and you could use the WAIK to customize your installation but that’s beyond the scope of this post.

Step 4:
imagex /info dvddrive:sourcesinstall.wim (this will show you all the entries (or versions) available in the WIM-file, Hyper-V Server 2008 R2 has only one entry, index 1)

imagex /apply dvddrive:sourcesinstall.wim /check 1 vhddrive:

Step 5: Back to our diskpart-CMD
diskpart
select vdisk file=driveletter:virtualharddisk.vhd
attach vdisk
list volume
(note the drive letter for the newly mounted VHD.)

Step 6:
bcdboot vhddrive:Windows /s usbdrive: /v (this copies the boot-files from your VHD’s Windows-directory to your USB-stick, which lets you boot later on)

Step 7:
When it’s finished, go back to the CMD with diskpart active and run

detach vdisk
exit

Now you can reboot your machine or test in another one with your USB-stick. Don’t forget to move USB to the top of the boot order since it’ll reboot a few times during installation (if you don’t wanna babysit it and press F9 / F12 / the any key)

If this approach doesn’t work you can always create a VHD, install Hyper-V Server 2008 R2 in Virtual PC / Virtual Server / Hyper-V / Virtualbox. When finished, log on and then run Sysprep with the generalize option. I’ve had some problems with certain hardware and it just freezes on the logon screen. This also happened when the VHD was expandable, but I haven’t investigated it further.

Questions? Ask in comments / send an email!

0 thoughts on “Running Hyper-V Server 2008 R2 from USB”

  1. I haven’t downloaded the OPK (but see the updated article) so I don’t know. I’d think though that since the OEM partners are supposed to use it to embed Hyper-V Server 2008 R2 the most viable option is boot from VHD. And in that case “my” solution is basically the same, the OPK will probably let you customize a lot of thing in an OEM manner, like support information and such.

  2. I have tried it, unfortunately, it has not functioned with me.
    What have I made wrong?
    I would like to try out it on Dell PowerEdge T610 with an internal USB-Stick.
    After I have carried out the steps 1-7 the USB-stick was empty.
    Something I have not understood.
    Can you help me please?

  3. Hi Hans-Joerg!

    When running step #2:
    diskpart (starts the disk management CMD-utility)
    create vdisk file=driveletter:virtualharddisk.vhd maximum=14500 type=fixed

    make sure that the “driveletter:” points towards your USB-stick. Then the VHD will be created on it from the beginning. You could also create it in c:temp and then copy it to your stick.

    For the rest of the steps you’ll need to keep track of when it’s your USB-sticks driveletter or your VHD’s driveletter to use… This is stated iin the how-to, but can be kind of tricky.

    Let me know if it fails again!

  4. Hi Joachim,

    I’ve got a quick question for you with your setup. (well trying to figure out my setup and incorporating yours) I’m trying to setup a Hyper V 2008 Server as my main setup and then have a virtual world. Now the drawback that I’m running into is I can’t remote into the V setup unless I’ve got a DNS server already running so that I can see it – for whatever reason I can’t just ip directly to it. I was hoping to run several servers doing DNS, DHCP, App support and Active Directory but it looks like I can’t really do that unless I’m incorporating the Hyper V box into an already established network. I’m trying to run all of this via one box and I’ve got my main desktop running Windows 7 so I can run the Hyper V remote management portion. So I was thinking with your solution to run the Hyper V either in a virtual network or thru USB and create a Windows 2008 Std Server as my main box and then drop the rest of the vhd’s onto a partition on the main box. How will running the Hyper V in USB or virtual impact speed on the virtual boxes?

    Sorry for the long winded message but I haven’t been able to find much info into my solution and then came across yours with creating it onto a USB stick. So hence my asking for some advice.

    Thanks in advance if you can offer any suggestions.

  5. Hi!

    When you’re setting up your Hyper-V Server you’ll need to create at least one network that’s connected to your physical network. You can do this through RSAT on Windows 7, if you click on Hyper-V Network Settings in the rightmost column in the MMC when you’re connected to your server.

    Then when you create your VM you’ll connect it to that network which will expose it on your “outside” LAN. If you don’t do this all machines will be “internal” to your server and not reachable from the outside.

    I haven’t actually measured the performance but my machines feels like any other VM, so a guess would be that USB doesn’t drag performance down “that much”. Performance measuring to be done in the future as I’m preparing for a 10-day tour at the moment.

    Let me know how it goes with your virtualization or if you stumble upon more problems!

  6. Hello!

    Thanks for the guide, I do have a few questions though: I’ve tried installing Windows Server 2008 Enterprise Without Hyper-V on an external HDD, without success. But when i’m trying to boot it nothing happens. It seems like the problem is booting from Vdisk.

    Do you know what the problem might be?

  7. I have managed to get the USB-stick to boot on my Dell Poweredge T410, but the setup from USB-stick takes about 2 hours. Setup has restarted the server but now it just stands at “Setup is preparing your computer for first use” and it won’t proceed. Ideas?

  8. Simon: When you’re installing, does the setup say anything about your disk? Are you installing on the physical disk or on a VHD? Haven’t tried a full installation on external media (the vhd-trick actually tells Windows that it’s non-removable).

    MarcusW: It takes a looooong time before it skips past that. This is most likely due to the extraction of drivers and then writing them to USB. Have you gotten past it? You could check your setup-logs on the stick if it hangs, could be one device that it doesn’t like. Another trick is to use your vhd in virtualbox or Hyper-V, install Windows, run sysprep /generalize and then copy that same VHD to your USB.

  9. Hi and thanks for the article.
    I went through all this, but when I try to boot from my USB stick my PC tells me “USB device without operating system.”
    After that I went through step 5-7 again, but the outcome is still the same. Do you have any idea what I’m doing wrong ? Could it be that my USB stick is incapable of beeing bootable (I use a Sony MicroVault 16GB) ?

    Best regards from Germany
    Markus

  10. Hi Markus!

    When you do those steps, are you sure about the driveletters? If you look at your USB-stick in Explorer, what’s on it?

    When you boot from VHD it doesn’t matter which stick you’re using, but the bootloader has to be there. If you choose to install directly on the stick without VHD your stick must have a device id of a harddrive (which almost no sticks have).

    Does your computer support booting from USB in bios?

    That’s a few pointers that I can think of at the moment.

  11. Hi Joachim and thanks for your reply.
    I’m all right with the drive letters and my PC also supports booting from USB. I also can see the bootmgr file and teh boot directory on the stick. But I wonder how the bootloader does know about the vhd file ? In the TechNet video you link to from your site they edit the boot loader using bcdedit to point it to the vhd. I don’t find anything like that in your manual.

  12. Step 5 & 6 does just that:

    Step 5: Back to our diskpart-CMD
    diskpart
    select vdisk file=driveletter:virtualharddisk.vhd
    attach vdisk
    list volume (note the drive letter for the newly mounted VHD.)

    Step 6:
    bcdboot vhddrive:Windows /s usbdrive: /v (this copies the boot-files from your VHD’s Windows-directory to your USB-stick, which lets you boot later on)

    I’ve tried the guide again on both a virtual computer in Virtualbox which supports USB, my HTPC and my laptop and all three boot from the stick using the steps above… Have you tried it on another computer?

  13. Hi, just been playing with this, failed many times. I decided to use the host (windows 7 x64) bcdboot (bcdboot C:Windows /s usbdrive: /v) rather than using the boot from the image (bcdboot vhddrive:Windows /s usbdrive: /v). Now it works. Thanks for the info!

  14. Hi,

    Let me begin by saying that I am a developer, not an admin, so a lot of your procedure was totally “cookbook” for me. I think I followed all the steps, but at the end I had a flash drive with only 16MB used and it won’t boot. I’m assuming I missed something basic (like copying the vhd file to the flash drive, maybe?) but I reviewed the procedure thoroughly and I can’t spot my mistake. The bcdboot process said “copying boot files” and that’s what used the 16MB. I would appreciate it if you could point out my error.

    Thanks,
    Bob

  15. I realise that this is an old posting, but for the benefit of anyone else struggling with this (like I did for the past few hours!) I managed to resolve the booting issue with EasyBCD (which is a freebie at the time of writing and has been for a while, promise I’m not pimping!)

  16. What size USB flash drive do you need to do this with Hyper-V? ESXi can run from a 2GB flash drive (I think it actually only needs 1GB).

    1. You could manage with a 4 GB I’d assume, it’s around 2.6 GB installed. I’ve just tried it with 16 GB USB-drives.

  17. Thank you so much. This worked perfectly. FYI…if anyone is doing this to install an OS on a PowerEdge T410, just plug the USB in the front, boot, select F11, and then go to the HDD option…the USB will show up and you can install the OS.

Leave a Reply

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