Install Windows Server 2008 R2 or Windows 7 on USB stick

by Marin Franković on 9 June, 2010

There is a huge interest in methods for installing Windows Server 2008 R2 or Windows 7 on USB stick. Bare in mind that USB stick are slower than disks and that performance will suffer. These methods are unsupported by Microsoft!

This article was taken from my friends Robert blog with his permission. Minor errors have been corrected.

ARTICLE:

Microsoft released a document on TechNet few months ago, explaining how to install Windows Hyper-V Server 2008 R2 to USB stick. This configuration is supported only for OEM’s and only if you have permanently installed USB stick. If you want to know how to do it, please visit: http://technet.microsoft.com/en-us/library/ee731893(WS.10).aspx. There is also a tool to automate the process. You can find it on MSDN: http://code.msdn.microsoft.com/BootHVSR2FromUSB.

The question I usually hear from my students is: “Is it possible to install Windows Server 2008 R2 this way”. The answer to this question is: “Yes it is”. But you have to know that this is not supported or advised to do by Microsoft.


The process is exactly the same as with Windows Hyper-V Server 2008 R2, so please follow the instructions on Microsoft TechNet site. You will however need to do some additional modifications (if you want to avoid blue screen).

  1. When you create fixed size vhd file, let it be at least 10GB in size! 12GB is highly recommended (if you want to have enough place for updates etc.)
  2. USB stick should be at least 16 GB in size – minimum system requirements for foundation server is 10 GB, and for Standard is 32GB. I installed Windows Server 2008 R2 standard edition to 12GB vhd file with no problems
  3. If you are using automated tool found here, it will probably hang at the end. Then please, manually repeat steps 5 and 6 found in the TechNet document.
  4. Before step 7, please do the following:
  • Open registry editor, select HKLM, click on file/load Hive, navigate to disk R:\windows\system32\config (the drive you mounted vhd from USB stick), and open SYSTEM. Give it some name, like: Hyper-V.
  • Open hyper-V sub key (or whatever name you entered in previous dialog box)  under HKLM, open ControlSet001/Control. Edit BootDriverFlags value and enter 4.

BootDriverFlags

  • Open hyper-V sub key (or whatever name you entered in previous dialog box)  under HKLM, open ControlSet001/Control/PnP. Edit PollBootPartitionTimeout and enter 30000 (Decimal)

PollBootPartitionTimeout

  • Now you ready to dismount VHD (step 7 in original documentation) and ready to boot you newly created syspreped installation of Windows Server 2008 R2.

Be aware that you have to boot from USB stick (change it in your BIOS or pres F9, or F8, or whatever shortcut is used on your computer to pop up boot devices screen).
Also be aware that some steps could take a looooooot’s of time (it took about 3 hours to finish sysprep process on my machine with Hyper-V server, and just around 40 minutes with Windows Server 2008 R2).
After this slow process Windows server will work like a baby – it boots in 35 seconds on HP Compaq 6710b from Flash Voyager GT Corsair 16GB USB.

When I answered this question to my students the second question was: “Is it possible to do this with windows 7?”. 
The answer is: “Please try and let me know ;-) ” 
The process is the same, and it’s working with Windows 7 to.

{ 9 comments… read them below or add one }

Jeremy October 4, 2011 at 1:57

Is this to create a USB disk that will be able to deploy the server on other computers, or is this a way to actually have a fully installed version of this server that boots, operates, etc. from the USB device itself?

The latter is what I’ve been looking for, but there seems to be some confusion everywhere I’ve looked as to what different people are trying to achieve, making it very difficult to find consistent information when surfing forums/tutorials.

Please email me if you can with any additional info you can give me. My tech level is a little low, but the automated tool from Microsoft seems a little too good to be true as far as automating what is normally a very complex and unsupported process.

Reply

Marin Franković October 4, 2011 at 13:52

Hi Jeremy,

this procedure will enable you to boot fully installed version of these operating systems from USB stick. This is of course totally unsupported by Microsoft. The only supported OS to boot from USB is Windows Server 2008 R2 Hyper-V. I would not reccomend this to be used in production. USB installation created by this procedure is not transferable between different hardware machines. Maybe you should take a look at article that describes how to boot from VHD file (http://blog.frankovic.net/2009/05/boot-win-2008-r2-rc-from-vhd/).

Reply

Jeremy October 9, 2011 at 0:15

Hi

I am trying to install Server 2008 R2, not Hyper-V, but as the title says the procedure will work for Windows 7 as well, I assumed this was not an issue.

I believe I have followed the steps at Technet accurately, but I was confused as to what .wim file I was supposed to apply to the VHD during this process. Since this isn’t a VHD boot solution, I assumed I was either supposed to apply the boot.wim or install.wim file to the VHD (not a .wim image of an installed Server 2008 R2), and then continue with the process. I repeated the entire process start to finish using first the boot.wim, then a .wim file created from a sysprepped installation of Server 2008 R2, and finally with the install.wim file. The first wouldn’t boot, the second gave me a BSOD.

The install.wim is allowing me to boot, says “Setup is preparing files” or something to that affect, and then an error window tells me that it is unable to install, must restart to continue installation. Of course there is no change upon any number of reboots. I have also followed the directions on this page it says to complete before detaching the vhd.

I am using a 1TB Western Digital external USB hard drive. Perhaps you could show me where I have gone awry?

Reply

Jeremy October 9, 2011 at 19:24

I apologize,

I had not properly prepared my USB drive prior to beginning the process. I am sure virtualization was enabled in BIOS, but I had missed the steps about enabling the AMD NX bit (or Intel DEP equivalent) and the removable media bit (which appears to be a feat in and of itself).

Also, I had not run the bcdedit command from a WinPE prompt. I now have a PE boot disk , and was wondering (as the Technet tutorial isn’t very clear) if there were any other commands that need to be run from PE?

I double-checked and found that Technet says you may use a customized *.wim if you wish, but alternatively you may use the install.wim in the sources folder on the 2008 R2 disc, however your tutorial mentions running sysprep on a USB medium, and the Technet document you linked doesn’t mention sysprep at all. I feel I may have missed something there..

Sorry for all the comments, but my class was required to purchase these 1TB drives specifically for the installation and use of Server 2008 R2, and we are now three weeks into the class with little to no progress as far as getting it installed and up and running for our classroom lab environment. Thanks in advance for any tips/help.

Reply

Marin Franković October 9, 2011 at 19:30

Hi Jeremy,

to be honest, I never tried to install Win 2008 or Win 7 on external USB hard drive. My procedure explains how to do it on USB stick. I was using 16GB one. I suspect that out of the box, external USB drives are not supported for this scenario. have you checked this link (http://www.intowindows.com/how-to-install-windows-7-to-usb-external-hard-drive-must-read/)?

Reply

Jeremy October 9, 2011 at 19:40

Thank you! This looks very promising! I will post back to confirm for other users.

Reply

Jeremy October 11, 2011 at 13:26

Works a charm, took ~45 min start to finish on a 2.0 hub. Thx again for the link

Reply

David March 2, 2012 at 23:48

One thing I would like to add here that I have discovered.

When editing the BootDriverFlags key if you change the value to 6 this method boots sucesfully on usb hard drives.

I have tested your method, but using the value of 6 for BootDriverFlags with both windows 7 ultimate and Windows 8 Consumer Preview; as well as have tested it usin 2 different USB enclosures.

Figured I would post this so others could give it a shot.

Reply

vignesh May 4, 2012 at 4:38

Sorry the last post is wrong

To begin you will need the following:
32 GB or larger USB Drive (It can be a USB Hard Drive)
A Windows PC to build the USB drive on.
Windows Server 2008 R2 DVD ISO.
A copy of Imagex.exe from the Windows 7 Automated Installation Kit installed on Windows 7 or XP. ImageX can be found in C:\Program Files\Windows AIK\Tools\amd64 or C:\Program Files\Windows AIK\Tools\x86.
Creating the Windows Server 2008 R2 USB Device:
Windows Server 2008 R2 requires a specific partition setup in order to function. We will use diskpart to create the new partition setup. Launch an administrative level command prompt from the Start Screen.
Make sure that your USB Drive is plugged in and then type in diskpart and hit Enter.
Then list the available disks by running “list disk” and you should see your usb device.
Select your USB drive by typing “select disk #” and hit Enter.
Clean the partitions on the disk by typing “clean” and hit Enter.

Now create the partition by running the following command:

create partition primary

Select and format the new boot partition by running the following command:

format fs=ntfs quick
Set the partition active by typing “active” and hit Enter.

Exit Diskpart by typing Exit.

Now double click the Windows Server 2008 R2 ISO you downloaded to mount it in Windows Server 2008 R2. Browse to the ISO files in Windows Explorer and copy \sources\install.wim to the same folder as you copied Imagex.exe.

Identify the drive letter assigned to your USB drive by Windows Explorer and run the following command from the folder that contains Imagex.exe and install.wim:

imagex.exe /apply install.wim 1 d:\

Replace d with the drive letter of your USB drive.)

Once the image has applied you need to setup the boot record on the USB Drive. At the administrative level command prompt run:

bcdboot.exe d:\windows /s d: /f ALL

(Replace d with the drive letter of your USB drive.)

After the command has completed running you are ready to use your new Windows Server 2008 R2 USB device.

Reply

Leave a Reply

Previous post:

Next post: