Peter Hinchley

Create Bootable USB Drive Using DiskPart

Tagged: cmd, usb

I often need to create a bootable USB drive. For example, today I needed to install Windows 7 on a netbook which did not have a DVD drive. In this situation, it's not enough to simply copy the source files from a DVD or a mounted ISO; you must first format the USB thumb drive such that it's bootable. This can be achieved using the DiskPart utility in Windows Vista/7.

To create a bootable USB drive:

  1. Insert the USB thumb drive into an existing computer.
  2. Open a command prompt as an administrator.
  3. Enter the command DiskPart. An interactive DiskPart command session will be started.
  4. Enter the command list disk. A list of disks will be displayed. Take note of the disk number of the USB drive you want to format. Usually the easiest way of determining the correct drive is to look at the size column.
  5. Enter select disk x where x is the disk number obtained from the previous step.
  6. Enter clean. This will erase the disk.
  7. Enter create partition primary to create a new partition on the disk.
  8. Enter active.
  9. Enter select partition 1 to select the new partition.
  10. Enter format fs=NTFS QUICK to perform a quick format of the partition with the NTFS filesystem.
  11. Enter assign to assign the formatted partition a drive letter.
  12. Enter exit.
  13. From the command prompt enter xcopy d:\*.* /s/e/f e:\ where d:\ represents the drive containing the Windows source media and e:\ represents the newly mounted USB drive. This command will copy the source files to the USB drive.
  14. Enter cd d:\boot, where once again it's assumed that d:\ holds the source media.
  15. Enter bootsect /nt60 e: where e: is the drive letter of the USB device.
  16. Eject the USB drive.

You can now use the thumb drive to boot and commence the install of Windows on any computer (assuming the boot order of the computer is set to boot from USB drives).

The Mob Hath Spoken

Jeff:

I'll say man, you're cool, you made me recall how these commands were used. Thank you very much. More power.

Chris:

Thanks, for the simple and clear tutorial. Excellent.

Your Say