Creating a bootable USB drive is an essential skill for every Linux user. A bootable USB drive allows you to install, test, or troubleshoot various Linux distributions without making changes to your existing system. In this in-depth guide, we will explore the tools and techniques used to create a bootable USB drive from an ISO file using the Linux terminal.
Before we begin, ensure you have the following:
- A USB drive with at least 4 GB of storage capacity
- An ISO file of the Linux distribution you want to make bootable
- A computer running Linux
Windows users read this: How to Create Ubuntu Bootable USB in Windows
Step 1: Identifying the USB drive
First, connect your USB drive to your computer. Open the terminal and use the lsblk command to list all connected storage devices:
Sample output:NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 238.5G 0 disk ├─sda1 8:1 0 512M 0 part /boot/efi └─sda2 8:2 0 238G 0 part / sdb 8:16 1 14.9G 0 disk
Find your USB drive in the list, typically labeled as /dev/sda or /dev/sdb. Note the device name for later use.
Step 2: Formatting the USB drive (optional)
It’s a good idea to format your USB drive before creating the bootable media. This ensures a clean and error-free environment. You can format the USB drive using the mkfs command:
sudo mkfs.vfat /dev/sdX
Replace /dev/sdX with the correct device name noted in Step
For example, if your USB drive is listed as /dev/sdb, the command should be:
sudo mkfs.vfat /dev/sdb
This command formats the USB drive using the FAT32 file system, which is compatible with both BIOS and UEFI boot modes.
Step 3: Creating the bootable USB using dd command
The dd command is a versatile and powerful utility for creating bootable USB drives. To use it, enter the following command in the terminal:
sudo dd if=~/Downloads/ubuntu-20.04.3-desktop-amd64.iso of=/dev/sda bs=4M status=progress
Sample output:2173700096 bytes (2.2 GB, 2.0 GiB) copied, 133 s, 16.3 MB/s 517+1 records in 517+1 records out 2168455168 bytes (2.2 GB, 2.0 GiB) copied, 156.245 s, 13.9 MB/s
Replace “~/Downloads/ubuntu-20.04.3-desktop-amd64.iso” with the actual path to the ISO file, and “/dev/sda” with the correct device name noted in Step 1. The “bs=4M” option sets the block size to 4 MB, which speeds up the process, while the “status=progress” option displays the progress.
After executing the command, wait for the process to complete. It may take a few minutes.
Step 4: Sync and eject the USB drive
Once the dd command finishes, you need to synchronize cached writes to the storage device to ensure that all data is written correctly. Use the sync command to perform this action:
This command may take a few seconds to complete. After the sync command has finished, it’s safe to remove the USB drive from your computer.
Step 5: Testing the bootable USB drive
Now that you have created the bootable USB drive, it’s time to test it. Reboot your computer and access the boot menu or BIOS/UEFI settings. Change the boot order to prioritize booting from the USB drive. Save the changes and restart your computer.
Your computer should now boot from the USB drive, allowing you to install, test, or troubleshoot the chosen Linux distribution.
Alternative tools: WoeUSB and Ventoy
Although the dd command is the most common method for creating a bootable USB drive, there are alternative tools available, such as WoeUSB and Ventoy.
- WoeUSB: WoeUSB is a user-friendly tool for creating bootable USB drives, especially for Windows ISO files. To install WoeUSB on Ubuntu, use the following commands:
sudo add-apt-repository ppa:tomtomtom/woeusb
sudo apt-get update
sudo apt-get install woeusb
After installation, use the woeusb command to create a bootable USB drive:
sudo woeusb --device /path/to/your/iso-file.iso /dev/sdX
Replace “/path/to/your/iso-file.iso” with the actual path to the ISO file, and `/dev/sdX` with the correct device name noted in Step 1.
- Ventoy: Ventoy is a powerful tool that allows you to create multiboot USB drives, enabling you to store multiple ISO files on a single USB drive and boot from any of them. To install Ventoy, download the latest release from the official website (https://www.ventoy.net/) and extract the archive. Open a terminal in the extracted folder and run the following command:
sudo ./Ventoy2Disk.sh -i /dev/sdX
Replace /dev/sdX with the correct device name noted in Step 1. Once Ventoy is installed, simply copy ISO files to the USB drive using your preferred file manager. Ventoy will automatically detect the ISO files, and you can choose which one to boot from when starting your computer.
In this in-depth guide, we explored various tools and techniques to create a bootable USB drive from an ISO file using the Linux terminal. With this knowledge, you can easily create bootable USB drives for different Linux distributions or even Windows operating systems, making it a valuable skill for every Linux user.