bootable usb

Gone are the days when computers usually had optical drives. Optical drives were a convenient medium for fresh Operating system installations. As those optical drives fade out, users have now resorted to using bootable USB drives to do the job. Lets deep dive into how we can create a Bootable USB Drive for Windows without any external tools.

[Disclaimer: There are a lot of different third party tools that can create bootable drives like Rufus or Microsoft’s in-house tool called Media Creation Tool. This post is intended for the purpose of learning what happens behind the scene and what really is going on.]

Choosing and Preparing USB Drive

USB drives need to have enough space to store the installation files of the selected version of windows. Depending on the size, choose your USB drive. It is recommended to have a USB drive with 8GB of storage. I am also using 8GB USB drive for the tutorial.

  1. Plug in your USB drive to your computer that you wish to use.
  2. Run CMD (Command Line) as an administrator. To run CMD as an administrator, press Start and type cmd, right click cmd and click Run as administrator. 
  3. Run diskpart by typing “diskpart” in cmd. Diskpart is a built-in command line tool inside windows to manage partitions in a drive.
  4. Once diskpart is running, type “list disk”, this will list all the disks that are active and connected. 
  5. Select the USB disk, which in our case is Disk 1. Type “select disk 1”. This will select the disk and the further commands will impact only the selected disk.
  6. Next, type “clean”. Be careful though, this command will completely erase/format your selected drive. So, backup anything important in the drive before you do this. Wait for the prompt that says “Diskpart succeeded in cleaning the disk”.
  7. Now, convert the selected disk to MBR by typing “convert mbr”;
    OR
    convert the selected disk to GPT by typing “convert gpt”. (Note: Older systems with legacy bios need MBR partition, whereas the newer devices that support UEFI non-CSM will require GPT partition.)

OR

Convert of GPT partition for UEFI Boot

Creating Partitions and Formatting

  1. Type “create partition primary” to create partition into your newly cleaned drive.
  2. Type “select partition 1” to select the partition you just created.
  3. Type “active” and hit Enter. This marks the partition as active partition in the drive.
  4. Format the partition as NTFS by typing “format fs=ntfs quick”
    OR
    format the partition as FAT32 by typing “format fs=fat32 quick” if you wish to UEFI Boot.
  5. Exit diskpart utility by typing “exit”.
partition diskpart

Writing Boot Sector

In order to make the drive bootable, we need to write the boot sector from the existing bootable(installation) media, that may be an ISO image or a physical optical media (CD/DVD) to the USB drive.

  1. Mount your ISO image by right clicking and selecting “Mount” option. This will mount the ISO image as a virtual drive in your system. Or, insert your CD/DVD to your optical drive.
drive list
  1. In CMD window, navigate to the installation media. In my case, the USB drive is G drive and the installation media is in F drive. So, I navigate to F drive by typing “f:”.
  2. Type “cd boot” to change active directory to boot inside Y drive. The prompt should now look like F:\boot>
  3. Type “bootsect /nt60 g:” , This creates a boot sector in x drive or your USB drive.
write boot sector
  1. Copy entire files contents from installation media to USB drive.

Additional Steps for UEFI Boot – Adding UEFI:NTFS drivers

  1. Download the latest UEFI:NTFS file system drivers from here
  2. Extract the file named uefi-ntfs.img and copy the file content to your USB drive. You can use 7-zip to extract the files from .img file.

That is all, your bootable USB drive is ready to be used for windows installations.