In this article, we would focus on how to create a Bootable USB in Ubuntu using cp command-line utility.
First, we will download a bootable ISO image (any supported Linux distribution). Then, identify USB disk through lsblk or fdisk command-line utility. Thereafter, copy bootable ISO image to the USB disk using cp command-line utility. That’s pretty much everything we need to make our USB bootable.
Later, we will also discuss how to format (revert it back to usual state) USB disk using GParted once we have made it bootable.
Note: Following operations would require you to have superuser privileges. In case you don’t have one, then contact your System Administrator for assistance. Once you make a USB disk bootable, all stored data will be lost. Hence, we advise you to take a backup of your USB disk beforehand.
Download a Bootable ISO Image
We can download any supported Linux distribution ISO image. For the purpose of this article, we downloaded Ubuntu Server 18.04.3 LTS ISO image (bionic-server-amd64.iso) from Ubuntu Server download page.
Identify USB disk through lsblk or fdisk
Mount your USB disk –
- Identify USB disk through lsblk – Open a terminal and issue the following –
lsblk
This would get us the output similar to –
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 512M 0 part /boot/efi ├─sda2 8:2 0 8G 0 part └─sda3 8:5 0 100G 0 part / sdb 8:16 1 7.2G 0 disk └─sdb1 8:17 1 7.2G 0 part /media/tp/USB Disk sr0 11:0 1 1024M 0 rom
From above, we can clearly identify our USB disk (block device) as /dev/sdb, it would be different for you – /dev/sdX.
where,
X – would be a,b,c etc. It would vary for different drives connected and wouldn’t be same all the time.
- Identify USB disk through fdisk – Open a terminal and issue the following –
sudo fdisk -l
This would get us the output similar to –
Disk /dev/sdb: 7.22 GiB, 7751073792 bytes, 15138816 sectors Disk model: Storage Media Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xbfd6b326 Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 15138815 15136768 7.2G 83 Linux
Scroll down to get information about your USB disk (block device) – /dev/sdb, it would be different for you – /dev/sdX.
where,
X – would be a,b,c etc. It would vary for different drives connected and wouldn’t be same all the time.
Copy bootable ISO image to the USB disk
Word of caution – Proceed below only if you have clearly identified your USB disk.
Now, we will copy our bootable ISO image to USB disk. Hence, head to the directory where our bootable ISO is stored –
cd /path/to/ISO/Image/
and,
sudo cp bootable.iso /dev/sdX
for instance,
sudo cp bionic-server-amd64.iso /dev/sdb
Once its done, we will get a bootable USB disk.
Restore bootable USB disk to its original state using GParted
GParted – GNOME Partition Editor is a graphical-tool with which we can manage our disk partitions.
To install GParted – open a terminal and issue the following –
sudo apt update sudo apt install gparted
Now, open GParted from Systems’ main menu. It will ask you to authenticate. And, select your device from the drop down menu at top right corner.
If mounted, then we need to unmount our USB disk. Select the USB disk and in Menu bar, click Partition and Unmount.
Then, to format USB disk –> Click Partition in Menu bar – Format to – choose file system type.
In conclusion, we have discussed how to create a Bootable USB in Ubuntu. We also discussed how to restore our bootable USB disk to its original state using graphical tool GParted.