CDs are long gone and if you want to reinstall an operating system, a bootable USB drive is the one required. Let’s learn how to create a bootable USB disk from Ubuntu using terminal today. We’ll be creating a bootable USB of the Ubuntu ISO file, but you can work with any ISO file that was designed to be written to a CD to be bootable.
The Steps to Create a Bootable USB Disk
So as I mentioned, we’re working with the Ubuntu ISO file here to create a bootable USB disk, but you can replace the ISO with any other ISO that’s built to be bootable and then follow the tutorial exactly as is.
For Ubuntu, we need a USB disk that’s 8GB so we can have all the files. If you’re working with any other ISO or operating system, the storage requirements will be different.
1. Download the ISO File
To create a bootable USB disk from the Ubuntu terminal, we need to download the ISO file first. In my case, I’m downloading the Ubuntu ISO file for version 20.04. You can choose to download the ISO for another operating system that you want to write to USB. You can follow this link to reach the Ubuntu download page – https://ubuntu.com/download/desktop
Select the package which you wish to set up your bootable USB drive with. For this demonstration, we are using the Ubuntu 20.04 (Codename Focal Fossa). You can either directly download the file by clicking on the Download link on the page or use the wget command to get the file on your system.
wget -c https://releases.ubuntu.com/20.04/ubuntu-20.04-desktop-amd64.iso
2. Connect the USB drive
Once we have downloaded the correct disk image file, we will open the terminal and connect our USB drive. One that’s done, our next step is to figure out the drive name using the Linux fdisk -l command
This will give you a list of all the disk drives that are available on the system. You’ll see a separate section with just a single disk path like /dev/sdb1 with a mount path that’s different from the common ones in Linux (like /home/, /etc/, /boot/ etc.). With Ubuntu, the default mount point is in the /media/ directory. Mine was mounted on the /mnt/
3. Unmount the USB stick
Since Ubuntu automounts any external device that’s connected, we need to unmount it so we can proceed to write the ISO to the USB. We use the umount command for this purpose. This action can be executed in two different methods.
The first method will involve using the path at which our USB device has been mounted. This command should look like this.
sudo umount /path/where/mounted
In this particular case, we will use the command as given below.
sudo umount /mnt
This will unmount the USB disk from our system.
Alternatively, we can use the device’s name in this format.
sudo umount /device/name
In this particular case, we will use the command as given below to unmount the USB disk.
sudo umount /dev/sdb1
Now that the device has been unmounted, we will make a bootable drive using it.
4. Write the ISO to the USB Disk
Our USB disk has been unmounted and our ISO file is already downloaded on our system. Now we will make this USB drive bootable for Ubuntu 20.04 using one single command. This is how you enter this command in the terminal.
sudo dd bs=4M if=/path/to/ISOfile of=/dev/sdx status=progress oflag=sync
- This command requires us to use sudo privileges.
- The bs tag reads the number of bytes which will be read from the source and written to the destination at a time.
- The second tag, if denotes the path of the input file for the function
- Whereas of denotes the path where the file has to be output to.
The thing about the dd command in Linux is that it will do anything you ask it to do without asking any questions. Hence, we need to use the command carefully. Before you begin writing, ensure that the output path is the path that you want to write the data to. There’s no turning back once the data has been written.
For our system, we will use the command as given below to create our bootable USB disk for Ubuntu 20.04.
sudo dd bs=4M if=/home/Downloads/ubuntu-20.04-live-server-amd64.iso of=/dev/sdb1 status=progress oflag=sync
This should start the process of writing the ISO image file on your USB disk and converting it into a bootable drive. You should see a screen as given below. Once you are done, which should take only a few minutes, your USB disk is ready to work as a USB bootable disk for Ubuntu 20.04.
There are multiple methods to create a bootable USB disk for the Ubuntu OS. Using the terminal for the task is a commonly used method because it eliminates the need for you to install any additional software. Further, it often takes less time to create a bootable USB disk from the Ubuntu terminal as compared to other methods like using the Startup Disk Creator or installing some other software.
Hence this method is advisable even if you are not much comfortable with the terminal-based commands. It eliminates the need for any GUI software, which may be unavailable in some situations. The only major flaw in this method is the lack of a safe-check with the dd command, but it can be eliminated by carefully entering the command. This tutorial aimed to help you create a bootable USB disk from the Ubuntu terminal. If you have any feedback, queries or suggestions, feel free to reach out to us in the comments below.