How to Make Bootable Pendrive Using CMD

Bootable Pendrive

How to Boot Pendrive

In older days, computers/laptops were available with DVD/CD drives. These drives were used to install any application or operating system. Nowadays, these drives are no longer available with new generations of computers/laptops. USB Pen Drives have taken the place of DVD/CD drives.

Why boot pendrive?

There are times when your operating system is corrupted or somehow, it is not working properly. A need to install the operating system arises. But, the problem is when your operating system doesn’t work, you cannot proceed beyond booting your computer. In such a situation, you can boot the operating system via bootable pendrive. 

There can be other symptoms that your operating system doesn’t work properly. Some of them are – hardware drivers are outdated or corrupted, some of the system files are corrupted, hard drive issues such as a bad sector or other hardware failures.

Bootable pendrive helps to repair, recover and re-install the operating system. The USB port(s) are available in all computers/laptops/MacBooks. It is a simple step thereafter. Insert your bootable pendrive in the USB port, select the bootable pendrive from your BIOS setup and continue the process of repairing the operating system. 

Assuming you already have created a bootable pendrive, let us see the steps how to boot the pendrive from different machines having Windows, Linus, Mac OS operating systems.

There are two ways to make the pendrive bootable. 

  • Make bootable pendrive using the User Interface
  • Make bootable pendrive using the Command Line option (CMD)

We will go through steps of making a bootable pendrive using CMD option in different operating systems.

Make Bootable Pendrive using CMD in Windows

A USB flash drive with at least 16 GB storage is required to make it bootable. Follow the steps below to create the USB pendrive bootable in Windows OS.

  1. Format the pendrive. We will use the command prompt for formatting the drive. 
    • Press the Windows key + X on your keyboard. The command window appears. 
    • Insert the pendrive in the USB slot of your computer/laptop.
    • Make sure you are in the “Windows → System32” directory. 
    • If not, type cd.. You will need to type this command till you are in your C:/ drive.
    • Then, enter cd Windows. You will be in the Windows directory. 
    • Enter cd System32. You will be in the System32 directory.
    • Enter the command, diskpart.
    • Press ENTER.
Bootable Pendrive in cmd
  1. Enter the command, list disk, press ENTER. You will see a list of disks available in your computer including your USB flash drive.
list disk
  1. In the screen above, the Disk 2 option with the 14GB size looks like it is the USB disk drive.
  2. Enter the command, select Disk 2. Press ENTER. You will see the message as the selected disk is now disk 2.
select Bootable Pendrive
  1. Enter the command, clean. Press ENTER. The formatting starts.
  2. Once the formatting process is finished,  you will see the success message.
clean pendrive
  1. After formatting the pendrive, you need to create the bootable. 
  2. Based on your Windows version, you can create the bootable format. There are 2 options for bootable format. 1) Master Boot Record – MBR (used for Windows 7) 2) GUID Partition Table – GPT (used for Window 8 and later)
  3. For Master Boot Record bootable:
  4. Enter the command, convert mbr
  5. Press ENTER. The successful conversion to the Master Boot Record format message appears as below.
convert mbr
  1. Enter the command, create partition primary. Press ENTER. 
  2. The partition success message appears as below.
create partion
  1. Enter the command, select partition 1 and press ENTER. 
select partition
  1. Enter the command, active. Press ENTER. The current partition is enabled.
active Bootable Pendrive
  1. Enter the command, format fs=ntfs quick. Press ENTER. The partition is formatted as NTFS file system. 
format Bootable Pendrive
  1. The formatting process of a pendrive is completed successfully. 
  2. Enter the exit command to come out from DISKPART. You have successfully created the Master Boot Record bootable format.
  3. For GUID Partition Table bootable:
  4. You will need to create two partitions instead of one. In this case, the Operating System (Windows 8 or later) recognises the FAT32 file format. 
  5. All the steps are the same as mentioned in the Master Boot Record formatting the drive.
  6. Enter the command, convert gpt. Press ENTER.
3Gd i6sfUWu9tAWoWRE8HRnC 952Gsm IRPqxWo6gmfh8S7L8vyxV4AmYdtHic0PHDJEBdzRZWd6ZK5L7crvq7sHNUJ zMRQL6HapQ0Hx9NmqkbIjvWnmhn4M80l2gY1X8 LyJ0
  1. Type the command, create partition primary size=64. Press ENTER. This creates an EFI partition. EFI partition supports the hard drive drivers available with Windows 8 or later.
  2. Now, type the command, create partition primary. Press ENTER. This creates a data partition.
create partition primary
  1. Type the command, select partition 1. Press ENTER. The partition 1 is selected.
  2. Type the command, format fs=fat32 quick. Press ENTER. 
format drive
  1. Type the command, select partition 2. Press ENTER. The partition 2 is selected.
  2. Type the command, format fs=ntfs quick. Press ENTER. 
quick format
  1. For Master Boot Record bootable: Now, copy the ISO image file from your computer to your pendrive. NOTE: ISO image file is the image of a disc. The file format is .iso and used as a compressed format of installation software.
    • To do the above step, go to the directory where your ISO file is stored.
    • Type the command, copy f:\<filename>.ISO /s/e/f g:
    • Press ENTER. NOTE: In the above command, the f: drive is the source drive where your ISO file is located. You will need to replace <filename> to the actual ISO name. G: drive is your USD drive slot.
    • You have successfully created the bootable pendrive for Windows 7 or earlier versions.
  2. For GUID Partition Table bootable: Go to https://efi.akeo.ie/downloads/efifs-latest/.
    • Download these folders: ntfs_x64.efi, ntfs_ia32.efi, ntfs_aa64.efi, ntfs_arm.efi from the above URL.
    • Copy these folders in the partition 1 you have created in your pendrive.
    • Copy the ISO image of the operating system in the partition 2 you have created in your pendrive.
    • You have successfully created the bootable pendrive for Windows 8 or later versions.

Make Bootable USB using CMD in Linux

  1. Prerequisite – your computer should be powered on.
  2. Insert the USB pen drive in the USB slot of your computer/notebook.
  3. Open the terminal. To open the terminal, press the CTRL + ALT +T keys on your keyboard.
  4. Enter the command, dmesg. In the terminal window, you will see the message logs. In the screen below, TinaS is the name of the USB flash drive you have inserted in the USB slot.
  1. Type the command su. Press ENTER. 
  2. Enter the root password. Press ENTER.
  3. Now, enter the command, findmnt device. Replace device with the USB drive name you found in the above screen. 
find pendrive
  1. Press ENTER.
  1. The next step is to unmount the pendrive. 
  2. Look at the TARGET column in the above screen. It shows /mnt/iso.  
  3. Enter the command, umount /mnt/iso. Press ENTER. The unmount process is successful.
umount drive
  1. Enter the command, dd if =/image_direction/image.iso of =/dev/device bs=blocksize. Press ENTER. This command copies the installation ISO image directly to your pendrive. 
  2. In the above command, replace /image_directory/image.iso with the actual directory path of the ISO file you have stored. (The bs command is used to increase the speed of the writing process.)
  1. Let’s take an example: If the ISO image is located in /home/devuser/Downloads/rhel-server-7-x86_64-boot.iso and the detected device name is TinaS. The command will be as follows.
Y9o9XqNqJITipziBxfa8NVtDCoLIiub0an5xPvvx2YyI000HJJyNCWRcJK RnVwLC lOXQDJJW 0WAc8cbaigtOO6q47vvX8hMOWul0zIX2BalsbjKePiJAN90l49jzjqBNnFeU
  1. The command, dd will finish copying the image to the pendrive. 
  2. Wait for a few seconds to complete the process.
  3. Log out from the root account. Remove your USB drive from the USB slot of your computer. 
  4. You have successfully created the bootable pendrive.

Make Bootable USB using CMD in Mac OS

  1. Prerequisite – Your USB flash drive should have at least 12GB free space available.
  2. Make sure your USB flash drive is formatted as Mac OS Extended
  3. For more information, click here: https://support.apple.com/en-us/HT208496. You can perform the steps from the MacOS UtilitiesDisk Utility option.
  4. Inject your USB flash drive in any one of the USB slots of your Mac.
  5. Press the POWER button to start your Mac.
  6. Open the terminal.
    • Press the command + SPACEBAR keys on your keyboard. The spotlight search bar appears.
    • Enter the text, terminal.app and press ENTER. The terminal is open.
  7. Enter the command, createinstallmedia when you are in the Resources folder. The command will look like below. (For each Mac OS version, the command is given.) 
Bootable Pendrive
  1. In the above command, replace MyVolume with your USB drive name.
  2. Press ENTER after entering the createinstallmedia command.
  3. Enter your password when prompted. Press ENTER.
  4. Enter y when prompted. This will format the volume. Press ENTER.
Bootable Pendrive
  1. When it shows the Done message, and you are at root, quit the terminal. To quit the terminal, enter the command, exit. Press ENTER.
  2. Eject the USB flash drive. Your bootable USB drive is ready.

How to boot pendrive in Windows 10

  1. In the USB slot of your computer, insert the pendrive which is bootable.
  2. Press the POWER button to start your computer/laptop.
  3. Press the F2 key on your keyboard. You will be on the BIOS setup of your machine. 
  4. Make sure you are on the Main tab of the window.
  5. Press the RIGHT-ARROW key on your keyboard to navigate to the Boot tab. You will see the Boot Settings section as shown below.
boot utility
  1. Make sure you are on the Boot Device Priority menu. Press the UP ARROW key if required to be there. 
  2. Press ENTER. Make sure you are on the 1st Boot Device list item.
Bootable Pendrive
  1. Press the UP ARROW key if required to navigate to the 1st Boot Device list item.
  2. Press ENTER. The list of options appears. For example – CD/DVD drive, HDD or USB Flash drive.
  3. Select the USB-HDD option.
  4. Press ENTER. The option is selected.
  5. Press the F10 key to save and reflect the changes. 
  6. Press the ESCAPE key. You will be moved out from the BIOS menu.
  7. Now, your operating system, Window 10 will be loaded from the bootable pendrive.

How to boot pendrive in Windows 7

  1. Insert the pendrive which is bootable in the USB port of your computer/laptop.
  2. Press the POWER button to start your computer/laptop. 
  3. While booting, the Boot Menu prompt appears. (In some computers, you may not have this option. In that case, press F2 to open the BIOS setup and change the boot settings from there.)
select Bootable Pendrive
  1. Use the ARROW keys of your keyboard and go to the Removable Devices option. 
  2. Press ENTER. Select the USB option from the list.

OR

  1. Alternatively, from the BIOS menu, select the Advanced BIOS Features list item.
  2. Make sure the First Boot Device list item is highlighted. If not, please press the UP ARROW key on your keyboard to go there.
cmos setup
  1. Press ENTER. A menu with the list of options appears.
bvMU2WFBnAKPQIngl0UgBUp37PCJVBBOupwtEfNKzo0KmQyv3ZpxNDsT7naAzMd69F FRiNy9hUFUNsrlLAsqFY5fnlTnGUSgsNiciNTMLt1EvkYuePtKL 0gcccomPfNLtNW k
  1. Move to the USB-HDD option using the DOWN ARROW key on the keyboard. 
  2. Press ENTER. The above mentioned option is selected with a square bullet sign in the square brackets. 
  3. Press the F10 key to reflect the changes of your bootable device option. 
  4. Press the ESC key to exit the BIOS setup.

How to boot Pendrive in Linux

  1. Press the POWER button to switch off your computer/laptop.
  2. Insert your bootable pendrive in the USB slot of your computer/laptop.
  3. Press the POWER button again to power on your machine.
  4. Press the F2 key or the F10 key of your keyboard. You will see the list of methods in the list.
  5. Choose the boot method as Full installation media (DVD or USB).
  6. The Linux operating system will automatically be loaded from the inserted bootable pendrive.

How to boot Pendrive in Mac OS

  1. Power of your MacBook.
  2. Insert your bootable pendrive in the USB slot of your Mac.
  3. Use the POWER button to switch on your Mac.
  4. Press and hold the Option (alt) key quickly on the startup. The macOS Utilities screen appears.
Boot Pendrive in Mac
  1. Click to select the Reinstall macOS option. Click the Continue button.
select disk
  1. Click the USB drive icon where Install MacOS Mojave label option is shown. The Mac OS will be loaded from the USB drive.

We have seen the steps of booting the different operating systems from the USB drive using the Boot menu option from the BIOS. In the next section, we will see how to make a USB drive or a pendrive bootable. 

Operating systems are installed from the hard disk drive of your computer/laptop. If the operating system is not working properly or giving issues booting from your machine’s hard drive, there is a need to make the bootable pendrive. To repair and re-install the operating system, a bootable pendrive can be used to fix the issue.

Conclusion

It is recommended to make pendrive bootable or your USB drive bootable with the command line (CMD) window. There are chances that your drive is not formatted properly using the User Interface (UI) or the partitions may not get created appropriately using the User Interface. 

The steps to make a bootable device via CMD are lengthy, but it ensures that the bootable drive is made without any errors and while you want to load the operating system using your bootable pendrive, it loads successfully.

It is always suggested to keep the USB drive bootable of your operating system and keep it as backup. Whenever you encounter any issues with the operating system, you are ready with the bootable pendrive.

Read: How to update BIOS software of computer