Windows

Configure a USB flash drive to be a Windows 7 installation platform

Greg Shultz shows you how to use the DiskPart utility to configure a bootable USB flash drive that you can then use to install the Microsoft Windows 7 operating system.
This blog post was originally published in August 2009, but it continues to be one of our most popular. We have been discussing the migration to Windows 7 lately, so it seems appropriate to revisit the post.

In a recent 10 Things blog, "10 Cool Things You Can Do with a USB Flash Drive," I presented 10 tasks that you can perform with a flash drive, including booting an operating system. However, I have since discovered a technique on the Microsoft TechNet Magazine site that describes how you can use a USB flash drive to install Windows 7.

This technique is very cool for two reasons: First, a flash drive is much more responsive than an optical drive, since it doesn't rely on physically moving components, so the installation procedure will be faster. Second, it provides an easy way to install Microsoft Windows 7 on a system that doesn't have a DVD drive, such as a netbook.

Since this technique would be a valuable addition to the 10 Things list as well as to users planning on installing Windows 7 on a netbook or who want to be able to quickly and easily install Windows 7, such as the Family Pack, on multiple systems without having to mess around with a DVD, I thought that I would examine the technique.

In this edition of the Windows Vista and Windows 7 Report, I'll show you how to use the DiskPart utility to configure a bootable USB flash drive that you can then use to install the Microsoft Windows 7 operating system.

This blog post is also available in PDF format in a free TechRepublic download.

Getting started

Of course, in order to employ this technique you'll need a USB flash drive that is big enough to hold the contents of the Windows 7 DVD. The Windows 7 RC DVD is about 2.5GB, and you can expect that the RTM DVD will be at least that if not more. For my test system I am using a 4GB USB flash drive.

Keep in mind that the procedure we will use will completely reformat the USB flash drive. So you want to make sure that you back up any data that you have on the drive before you begin.

The systems on which you want to install Windows 7 via the USB flash drive have to be able to be configured to boot from a USB drive. Most new systems have the capability to boot from a USB flash drive, and the operation can usually be configured in the BIOS or by simply pressing a certain key during bootup. You'll need to check your specific hardware in order to be sure.

Using the DiskPart utility

As you may know, the DiskPart utility is a command-line version of the Disk Management snap-in and is designed to allow you to manage disks, partitions, or volumes from within scripts or directly from a command prompt. We can use the DiskPart command in Windows Vista or in Windows 7 to configure a USB flash drive to be a bootable device. (Keep in mind that Windows XP's DiskPart command is unable to create a bootable USB flash drive.)

To begin, connect your USB flash drive to a computer on which you will be preparing the drive. For my example, I'll be using a Windows Vista system.

Now, locate the command Prompt shortcut on the Start menu, right-click on it, and select the Run as Administrator command. Then, respond appropriately to the UAC. You can now launch the DiskPart utility by typing DiskPart on the command line. You'll then see the DISKPART prompt, as shown in Figure A.

Figure A

DiskPart has its own command-line environment complete with a special prompt.
Now that you're in the DiskPart environment, you'll need to locate the USB flash drive using the List Disk command. As you can see in Figure B, the List Disk command has identified my USB flash drive as Disk 5. I can verify that my USB flash drive is indeed Disk 5 by checking the Size column, which lists the size as 3906MB, which is roughly 4GB.

Figure B

Using the List Disk command displays all the disks in the system.

(If you have difficulty identifying your USB flash drive using the List Disk command, you can try the List Volume command, which will provide the drive letter as well as the label, both of which can help you to identify the drive.)

Once you identify the drive number of your USB flash drive, you will need to set the focus of the DiskPart environment on that disk. (This is an extremely important step--Make sure that you select the correct drive or you could accidentally destroy valuable data!) On my example, the USB flash drive is Disk 5, so I will use the command Select Disk 5, as shown in Figure C.

Figure C

To shift the focus over to the USB flash drive you'll use the Select Disk command.
Now that your USB flash drive has the focus, you need to remove all the partition or volume formatting information from the disk. To do that, you'll use the Clean command. The Clean operation should occur rather quickly. When it is done, you will see a success message like the one shown in Figure D.

Figure D

In order to start with a clean slate, you'll use the Clean command to remove all partition and volume information from the USB flash drive.
You'll now use the Create Partition Primary command to create a primary partition on the disk. After you create the partition, you will see a success message and the focus will automatically shift to the new partition. You'll use the Active command to mark the partition as active, as shown in Figure E. Marking the partition as active will essentially allow the BIOS to recognize that the partition is a valid bootable system partition.

Figure E

Using the Create Partition Primary and the Active commands, you'll create a bootable partition on the USB flash drive.
With the partition created and active, you're now ready to quickly format the drive and set up the FAT32 file system using the Format fs=FAT32 quick command. (While you could format the drive as NTFS, the typical way to format a USB flash drive is to use FAT32.) Once the drive is formatted, you'll use the Assign command, as shown in Figure F, to allow the drive to be assigned a drive letter.

Figure F

To complete the preparation, you'll format the drive and assign it a drive letter.

The USB flash drive is now ready. At this point, you can use the Exit command to exit the DiskPart environment and then close the Command Prompt window.

Copying the Windows 7 files

Copying the Windows 7 files is easy. Just open Windows Explorer, access the Windows 7 DVD, select all the files and folders, and then drag and drop them on the USB flash drive icon, as shown in Figure G. Keep in mind that the copy operation will take a little while to complete.

Figure G

Once the USB flash drive is ready to go, you can copy all the files and folders from the Windows 7 DVD to the newly prepared bootable drive.

Installing Windows 7 from the USB flash drive

With the contents of the Windows 7 DVD on a bootable USB flash drive, installing the operating system is a snap. Just boot the system from the USB drive and the installation procedure will begin as it normally would, as shown in Figure H. However, the installation procedure will actually run quicker off a USB flash drive since it doesn't contain any physically moving components.

Figure H

Once the system boots from the USB flash drive, the Windows 7 installation will begin as normal, but it will actually run faster.

What's your take?

Have you ever wanted to be able to install an operating system from a USB flash drive? Now that you know how to do it, are you likely to employ this technique to install Windows 7 on a Netbook or on multiple computers? As always, if you have comments or information to share about these topics, please take a moment to drop by the TechRepublic Community Forums and let us hear from you.

TechRepublic's Windows Desktop Report newsletter, delivered twice a week, offers tips, news, and scuttlebutt on Windows. Automatically sign up today!

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

92 comments
andry gunawan
andry gunawan

If the computer is restart and there is no option like "press any key to boot from dvd / cd ... etc", enter the bios (do not the remove the flash drive) and change the boot sequence back from usb flash drive to a CD or hard disk. The installation process should run normally until complete.

regards

clark55555
clark55555

Attention people:   Some of you have the 'problem' that the installation keeps starting again.   Let me tell you why.   When you first see the message to "push any key to boot from DVD/CD", that is the ONLY time you want to do that.   All the rest of the restarts, just ignore the message and let the computer do it by itself, until it is finished.     Got it?

Nitin3233
Nitin3233

I am installing it but when it boots again for completing installation then its setup restarts again from (like expanding files)).. ?


What will be the reason behind it what do I do for that?

proahmed
proahmed

thanks  thanks  thanks  thanks  thanks  thanks  thanks  thanks  thanks  thanks 

justrongfaith
justrongfaith

the tutorial is really good and worth taking. I tried to install windows 7 using my transcend flash of 16gb, but when it was about to complete the installation it had to restart which is normal. The problem is; every time it restarts it boots from the same same flash and thereby repeat copying files to begin the installation afresh. I tried to remove the flash upon restart and then plug it again to complete the installation but only the window could appear telling you windows failed to start. Please help me out there. Thanks.

Justin

midlantic
midlantic

Ever since I learned this trick I use it whenever I need to do an installation. Quicker and no DVD to fumble with!

NickSkol
NickSkol

I use this method all the time to create USB bootable media. It's nice to be able to sit at about any Win7 computer and pull this off. Thanks again! Like others mentioned, adding an unattended file and/or OEM distribution folders let you create unattended Win7 installs as well...

stottpj
stottpj

Thank you for that article Greg. Although I used to be a support guy 20 years ago, specializing in software development takes all my effort these days, so I'm out of touch with OS nitty gritty. I spent ages looking for a concise, coherent guide to making a bootable USB drive (following some bad advice along the way), before I found your excellent post!

laurajayneb
laurajayneb

thank you anytime upgrade wouldnt work nor usb untill i partioned it

kevinski87
kevinski87

Hi, am trying to make a bootable flash disk (8GB) so that i can install in my notebook but i cant get past the "Format fs=FAT32 quick" command since it it gives back this message, "FAT32 is not supported for the selected volume, please select a different file system type and try again". could anyone please help fix this.

CharlieSpencer
CharlieSpencer

Anybody know a way to get Bart-PE onto a W7-bootable USB drive?

steve6375
steve6375

RMPrepUSB will format a USB drive and add the correct bootloader for your OS with no danger of affecting your hard disks. There are many tutorials on the website, including how to have many Windows Vista/7/SVR2K8 install ISO files all on one flash drive and being able to boot from that flash drive and install any OS from any of the ISOs onto your systems hard drive.

helen
helen

Worked like a charm. So many thanks for that.

shmoiger
shmoiger

I installed windows xp a couple of times from a usb. was really much faster. only downside was that the usb was assigned C drive then came all cd dvd etc drives, then came the hdd with a letter f:

epo_guy
epo_guy

Great idea, just wish I could get it to work. Every time I create the bootable USB and try it, I get an "Invalid partition table" message

chronic8000
chronic8000

Try WinSetupFromUSB and create a bootable USB flash drive with an XP and Windows 7 installation on! Like to see you do that with diskpart! It has a GUI interface and is much easier to use than diskpart. Just select your Windows 7 and XP installation folders, tell it your formatted FAT32 USB flash drive letter and click go. It can also add linux ISO's to the boot menu too.

308Tom
308Tom

This is very cool, but failed to work for me for a Vista Ultimate to Win 7 Pro Custom Upgrade. The booting and start was OK, but the install refused to proceed beyond where it cautioned me about overwriting files. Finally switched to booting off the DVD and all went well. Something about finding extra disks (as the bootable flash drive was seen) and not knowing how to proceed.

louborok
louborok

Hewlett Packard says my bios can not be set to boot from a USB flash drive. Could they be wrong?

cwielgus
cwielgus

Thanks for a great article, I just ran across it. Looking forward to your script.

rapitorul
rapitorul

I managed to boot up and run the installer but it doesn't display my USB drive as a option to install to. Did anyone ACTUALLY did this? Or is it just theory? This tutorial conveniently stops just where things get complicated.

mblake
mblake

I have run through this process and when I try to boot from the Flash drive an error comes up "invalid partition table". It installs fine when you run it while the OS is going but I would like to run this when no OS is installed on the HD I want to install to.

MGuyM
MGuyM

I must be doing something wrong. I've gone through this process step by step and each time, my USB Drive is NOT bootable. Can someone please explain to me the specific step that applies the BootLoader to the USB Drive? The First time I missed the ASSIGN step and thought that was it, but the second time I went through this, my USB Drive was NOT bootable. I used RC of Win7 to create my USB Drive, but I copied the WinXP Files to my USB Drive instead of Win7 Files (just mounted the WinXP CD and Dragged the Files the same as Win7). And before anyone asks, yes my computer is capable of booting from USB as I have been able to create a USB DOS Drive just fine. Thanks!

vadodsantos
vadodsantos

Congratulations Greg. I always found the articles on this site useless and this one is the best I've read so far. Thanks for teaching. Regards.

inertman
inertman

another person asked why you can't do this w/ computer management console? it has all the same tools. second, why not the new fat format which 7 and vista uses for flash drives, exFAT?

msawyer91
msawyer91

This technique works great. I had a DVD drive fail in a laptop and needed to reimage it. Just boot it up and away it goes! This technique I've found works for installing Windows Vista, Server 2008, 7 and Server 2008 R2. Another area where I found this works as well is with my company's "gold disk" builds. These are pre-built OS installations with pre-installed drivers, applications, AV software, etc., all of which get installed through the WAIK/Windows PE. Some of these are larger than a single-layer DVD so a larger flash drive is needed, but it still works. Long story short, if you get all of the files from the installation medium copied to the flash drive, and you configured it as Greg noted above with diskpart, it should work.

wmorris
wmorris

I'm glad you reminded me of the Diskpart Util. I had completely forgot about that, using third party utilities spoils a person, and it isn't always the most efficient way to do things either. It is always good to remember the command line.

mykesoftouch
mykesoftouch

i never knew it is this easy to configure.thanks greg you are a genuis chima mike

odedszpiro
odedszpiro

Why configure the USB drive as FAT32? Is there a problem with NTFS? Is there an advantage in formating NTFS? Thanks in advance, Oded Szpiro CITP, London UK

imanother
imanother

Given your job role, epo_guy,I take it you have prepared the intended receiving partition correctly.

public
public

Are you sure that this works with all versions of Win 7? I tried to make a copy of my retail Win 7 Pro Upgrade so as to archive my factory media, and was not able to get it to complete the install. I tried all sorts of variations and the only way I could get it to work was by booting and installing from the factory DVD.

Greg Shultz
Greg Shultz

The most compelling reason for formatting a USB flash drive with FAT32 instead of NTFS is "abrupt pull" factor. Many folks have a tendency to yank a USB flash drive out of the port as soon as they are done with it rather than using the Safely Remove Hardware method. FAT32 is more forgiving of this type of termination than NTFS is. If you yank out an NTFS drive that has not yet completed working with the files on the USB flash drive, you could very well end up with corrupted data. Chances are that would not happen in this particular scenario since you aren't really writing to the disk; however, as a general rule using FAT32 on a drive that will likely be connected and removed regularly is just a safer bet in my book.

epo_guy
epo_guy

Thanks, imanother. Unfortunately, I followed the directions exactly as given in the post. They left out the part about running the command: "Bootsect.exe/NT60 :"

rapitorul
rapitorul

Oh .. sorry, I misunderstood. But since we are here, can that be done? (Install Windows 7 on a USB)

gcdimarketing
gcdimarketing

Not to mention that the NTFS file system is much larger then Fat32, which leaves extra room for MS to put in the inevitable Service Pack1 et. al.

odedszpiro
odedszpiro

Dear Mr. Shultz, Thank you for the answer and the explanation. Regards, Oded Szpiro, London UK

mrbobyu
mrbobyu

I remember installing windows xp on DVD disk where it countain the operating system and the drivers on it. I could browse the Internet and so on without worrying abt virus :). Actually it will run pretty fast on USB. You can probably find a tutorial about it. It's nothing new. Bob

Greg Shultz
Greg Shultz

... I have not investigated that possibility in any detail. However, I will take a look at it in the future. Don't hold your breath though... ;-)