Already we have many tools available which guides how to make bootable pendrive/USB from ISO but here in this blog we will look on how to achieve it using a linux system by command line method.
Please follow the steps below guiding on how to make bootable USB using the linux terminal
Why using Linux terminal When GUI tools is available
Using the Linux terminal to create a bootable USB drive is much easier and way faster than with GUI tools. It is very useful to know how to do it in a terminal, because in most of the IT firms there isn’t always a GUI available in Linux system used in production environment . What can be challenging here is that there is no double-check option for dd
but once you are an expert on Linux it shouldn’t be much of a trouble.
Requirements
- Pendive /USB flash drive : 8 GB (Minimum)
- Linux system
- ISO Downloaded on your Linux system
Checking USB drive
Connect the USB flash drive to your machine and check if the Linux is able to detect the drive. Use the below command to verify
$ 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/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 /
The above output shows that the system is able to detect the pendrive and it is /dev/sdc1. Please note the device name for later use.
Let us unmount the using the below 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 /
Downloading the ISO Image
In this example we will download the Rocky Linux ISO from its official website Rocky Linux Download . Please download the image and keep it saved on your Linux system. You can also use the command line method to download the ISO using the wget or curl command
wget https://download.rockylinux.org/pub/rocky/8/isos/x86_64/Rocky-8.9-x86_64-dvd1.iso
curl -O https://download.rockylinux.org/pub/rocky/8/isos/x86_64/Rocky-8.9-x86_64-dvd1.iso
If your system is behind any corporate network please export proxy to connect to the Download page.
Creating the Bootable drive
We will be using the simple dd command to create the bootable flash drive
Syntax :
$ dd bs=4M if=/path/to/input.iso of=/dev/sd<?> conv=fdatasync
Please Be cautious using the dd command of overwriting or deleting your data. Make sure you have backup.
Where /path/to/input.iso is the path where .iso image is 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.
Example Command :
dd bs=4M if=/tmp/Rocky-8.9-x86_64-dvd1.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/Rocky-8.9-x86_64-dvd1.iso | pv | sudo dd of=/dev/sdc bs=4M conv=fdatasync
Once this process is completed you can use USB as a bootable drive for Rocky Linux installation or repair.
You can also refer our previous blog post which can guide you to further install the Rocky Linux 8
Other Tools
There are many tools available which can also be used to create the Bootable pendives. Here are some of the tools that would be helpful