How to Make Bootable USB from ISO using Linux Terminal

Written by: Bobbin Zachariah   |   Last updated: July 26, 2022

There are many USB creator software available to create a bootable Linux USB Drive. Here I will show you how to create a bootable USB flash from ISO file using the Linux terminal.

Before we start make sure you have downloaded the .ISO file and have a USB flash drive with not less than 4GB capacity.

Make Bootable USB from ISO using Linux Terminal

Follow the steps to make a bootable USB from iso file using the terminal.

Step1: Check USB Drive

Connect the USB flash drive to your machine and check if it's connected successfully. Use lsblk command to list all information about the attached block devices.

$ lsblk

Sample Output:

$ lsblk
 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
 sdb 8:16 0 10G 0 disk
 └─sdb1 8:17 0 10G 0 part
 sr0 11:0 1 1024M 0 rom
 sdc 8:32 1 14.9G 0 disk
 ├─sdc2 8:34 1 2.3M 0 part
 └─sdc1 8:33 1 1.7G 0 part /media/linoxide/SANDISK
 sda 8:0 0 20G 0 disk
 ├─sda2 8:2 0 1K 0 part
 ├─sda5 8:5 0 1022M 0 part [SWAP]
 ├─sda3 8:3 0 7.9G 0 part
 └─sda1 8:1 0 9G 0 part /

From the list find your USB drive's mounted partition. In our case it's /dev/sdc1. It is mounted by default.

Next, we must unmount the USB flash drive by the following command:

$ umount /dev/sdc1

Make sure to change according to your USB drive and check if it has been unmounted again with lsblk command.

You must see the output without mount point in front of sdc1:

Sample Output:

$ lsblk
 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
 sdb 8:16 0 10G 0 disk
 └─sdb1 8:17 0 10G 0 part
 sr0 11:0 1 1024M 0 rom
 sdc 8:32 1 14.9G 0 disk
 ├─sdc2 8:34 1 2.3M 0 part
 └─sdc1 8:33 1 1.7G 0 part
 sda 8:0 0 20G 0 disk
 ├─sda2 8:2 0 1K 0 part
 ├─sda5 8:5 0 1022M 0 part [SWAP]
 ├─sda3 8:3 0 7.9G 0 part
 └─sda1 8:1 0 9G 0 part /

Step 2: Download Linux ISO File

Here we will create a Ubuntu bootable flash drive, first go to ubuntu website and download the iso file to your Linux computer. Or you can download iso file from the command line using wget or curl command.

This will download iso file to the current directory.

$ wget http://cdimage.ubuntu.com/focal/daily-live/current/focal-desktop-amd64.iso

or

$ curl -O http://cdimage.ubuntu.com/focal/daily-live/current/focal-desktop-amd64.iso

Step 3: Create Bootable Drive from Terminal

We are going to use dd command to create a bootable USB flash drive.

Be cautious using the dd command of overwriting or deleting your data. Make sure you have backup

Syntax:

$ dd bs=4M if=/path/to/input.iso of=/dev/sd<?> conv=fdatasync

Where /path/to/input.iso is the path where .iso image downloaded. Make sure to change <?> with your USB disk letter accordingly. The point here is to write the disk name itself (e.g. /dev/sdc) and not the partition (e.g. /dev/sdc1). Sets the block size to 4 megabytes, which can improve the speed of the data transfer.

For example:

$ dd bs=4M if=/tmp/ubuntu-20.04.1-desktop-amd64.iso of=/dev/sdc conv=fdatasync

Where bs is read and write BYTES bytes at a time, if is the input file, of is the output file. The conv=fdatasync bit is important as dd can return before the write operation finishes.

By default the progress of the command will not be displayed, to view the progress you can use pv command:

$ dd if=/tmp/ubuntu-18.04-desktop-amd64.iso | pv | sudo dd of=/dev/sdc bs=4M conv=fdatasync

Note: From the 8.24 version of GNU Coreutils, dd command has the option to show the progress (status=progress). Not all Linux distributions may have pv installed by default. If it is not installed on your system, you can usually install it using your distribution package manager.

After the process is finished you can use USB as a bootable drive for Ubuntu installation or repair.

Conclusion

Using the terminal to create a bootable USB drive is much easier and way faster than with GUI tools. Also, it is very useful to know how to do it in a terminal, because there isn't always a GUI available. The main disadvantage, in this case, is that there is no double-check option for dd. GUI tools help you to identify and select the target drive, and provide a final checkpoint, where you can double-check, that you will be writing to the correct drive.

About The Author

Bobbin Zachariah

Bobbin Zachariah

Bobbin Zachariah is an experienced Linux engineer who has been supporting infrastructure for many companies. He specializes in Shell scripting, AWS Cloud, JavaScript, and Nodejs. He has qualified Master’s degree in computer science. He holds Red Hat Certified Engineer (RHCE) certification and RedHat Enable Sysadmin.

SHARE

Comments

Please add comments below to provide the author your ideas, appreciation and feedback.

Leave a Reply

Leave a Comment