Create a bootable Live USB in Ubuntu through Command Line

A Live USB stick is the one which contains a bootable Operating System. In this article, we would create a bootable Live USB for a Linux distribution through command-line interface. Before making any changes it is advisable to take a backup of all the data present on our USB stick. The moment we start performing relevant operations, all your data already present on USB stick will be lost. Also, you need to have superuser privileges to make any modifications to the disk. If you don’t have one, please contact your system administrator for assistance.

Identify USB stick through lsblk command

To print the path of available block devices run the following in terminal,

lsblk -p

Output should resemble –

/dev/sda 8:0 0 465.8G 0 disk 
├─/dev/sda1 8:1 0 512M 0 part /boot/efi
├─/dev/sda2 8:2 0 4.7G 0 part 
└─/dev/sda3 8:5 0 414.6G 0 part /
/dev/sdc 8:32 1 7.2G 0 disk /media/<username>/UUID-Device
/dev/sr0 11:0 1 1024M 0 rom

From the output, we can identify the USB stick (/dev/sdc) of size 7.2G mounted on /media/<username>/UUID-Device.

Umount device and make USB stick bootable

Firstly, we will have to unmount our USB stick with the help of umount command. The naming scheme for disk devices is /dev/sdX, where X can be a,b,c, etc. It is order in which our disk device was found. In our case, /dev/sdX is /dev/sdc – identify one for your system. And, run the following command in terminal –

sudo umount /dev/sdc

Locate the directory where you have saved your .iso file and use cp command to copy the file to /dev/sdc. For instance –

sudo cp /path/to/iso/file.iso /dev/sdc

Wait for a few minutes before the file gets copied to your USB stick. Merely copying the .iso file will make your USB stick bootable as the .iso file itself contains all the relevant files needed.

So far, we have identified our device through lsblk command, unmounted it and made it bootable by using the cp command. Things have been pretty easy till now but, in case we would want the USB stick to act as storage device again. For this purpose, we will have to use the fdisk command which will be discussed next.

In conclusion, we have made our USB stick bootable. This could be done for any of the Linux distributions, provided we have .iso file available.