- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a Bootable USB from ISO in Linux?
To create a bootable USB drive from an ISO file in Linux, we find it useful when installing a new operating system or running a live environment without affecting my existing system. It's also an excellent option when my computer lacks a CD/DVD drive, as USB drives are more common and easier to use.
To start the process, we use the "lsblk" command to find the device name of the USB drive and then download the ISO file. we then mount the ISO file and use the mount and dd commands to copy its contents to the USB drive.
When using the dd command, make sure to specify the input file (if=) and output file (of=), as well as the block size (bs=) and status of the copy operation (status=). After copying, eject the USB drive using the eject command to ensure that all data is written before removing it. Overall, with practice and the right command lines tools like dd and mount, this process can be straightforward.
Step 1 − Insert your USB drive.
The first step is to insert it into the computer's USB port. We will make sure the drive is pushed in until it clicks into place. Before beginning, we will check that the drive is empty or backed up, as using it may require reformatting and erasing data. Once it's ready, we can use the drive for the desired task, such as installing a new operating system like Linux.
Step 2 − Find the device name.
After inserting the USB drive, you need to find its device name in Linux since all devices are represented as files. To do this, you will open a terminal window and enter the "lsblk" command to list all connected block devices. USB drive's device name will typically start with "sdb" or "sdc" and will be followed by a number. Once you have found the USB drive's device name, you can use it to access and perform tasks on the drive. It's important to note that the exact process may vary slightly depending on the specific Linux distribution being used.
Input command to find device name −
Output may look like this −
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 232.9G 0 disk ├─sda1 8:1 0 487M 0 part /boot ├─sda2 8:2 0 46.6G 0 part / └─sda3 8:3 0 185.7G 0 part /home sdb 8:16 1 7.4G 0 disk └─sdb1 8:17 1 7.4G 0 part /media/usb0
Step 3 − Download the ISO file.
After inserting the USB drive and finding its device name, the next step is to download the ISO file for the Linux distribution to be installed. We will move to the website of the Linux distribution, look for the proper link to which you want to download the ISO file, and start the download. After the ISO file has been downloaded, we will verify its purity using a checksum utility like md5sum or sha256sum to ensure that it has not been corrupted during the download.
Step 4 − Mount the ISO file.
When we mount an ISO file, we are doing is setting up a virtual disk drive on the computer that can read the ISO file as if it were an actual physical disk or not. This is really handy because we can access all the files and folders contained within the ISO file, just as if they were saved on my computer's hard drive.
sudo mount -o loop path/to/iso/file /path/to/mount/point
Mounting an ISO file creates a virtual disk drive that helps you access the ISO's contents as if it were a physical disk present in your system. To mount an ISO file on a Linux system we can use the "mount" command in the terminal. The "-o loop" option is associated with an ISO file to be mounted as a loop device, just like a disk image. Remember to use "sudo" to run the command or it won't work if you will run only the sudo command it may give you an error.
$ sudo mount -o loop path/to/iso/file /path/to/mount/point [sudo] password for username:
When running this command, the system will ask for your password to ensure elevated privileges. Once you enter it and hit enter, the command will execute and the ISO file will be mounted to the specified mount point. If everything goes smoothly, you won't see any output from the command. The example above shows what a successful execution of the command would look like.
Step 5 − Copy the contents of the ISO file to your USB drive.
we can able to transfer the ISO file contents to the particular USB drive. To accomplish this task, we will be using the dd command use in Linux which can allow users to copy and convert data at a low level.
sudo dd if=/path/to/iso/file of=/dev/sdb bs=4M status=progress && sync
1096476672 bytes (1.1 GB, 1.0 GiB) copied, 47 s, 23.3 MB/s 261+1 records in 261+1 records out 1099512672 bytes (1.1 GB, 1.0 GiB) copied, 48.7658 s, 22.5 MB/s
In this example, the dd command is copying the ISO file located in the user's downloads folder to the /dev/sdb device. The "status=progress" option shows the progress of the copying of the IOS file also including the amount of data transferred and the transfer rate. Once the copy operation is complete, the sync command confirms that all data is written to the USB drive before it is ejected. The final output shows the total number of bytes that were copied and the transfer rate.
Step 6 − Eject the USB drive.
Once the copying process is complete, it's important to check the proper ejection of the USB drive before removing it from your computer otherwise it will damage the USB drive. Ejecting the drive ensures that all data has been written to the drive and that it's safe to remove.
To eject the USB drive, we use the eject command followed by the device name of the USB drive. In our example, the device name of the USB drive is /dev/sdb, but the device name may be different for your computer. You can find the device name of your USB drive by running the lsblk command as described in step 2.
Here's an example of an input command −
sudo eject /dev/sdb
Output may look like this −
eject: /dev/sdb ejected
This means that you have successfully ejected or removed the USB drive from the computer with the device name /dev/sdb. Keep in mind that the output may look slightly different depending on your system and device name. The output will show only ejected message.
To sum up, creating a bootable USB drive from an ISO file in Linux is an easy and practical process that can assist you in installing a new operating system or performing various other tasks like you can copy data from another system. By employing the correct tools and following a few basic commands, you can create a bootable USB drive quickly and without any difficulty.
To create a bootable USB drive in Linux, you will need to first identify the proper device name of your USB drive also confirm that the name you use is correct, then download the ISO file, mount the ISO file, copy the contents of the ISO file to the USB drive and remove the USB drive. By adhering to these instructions, you can successfully produce a bootable USB drive that can be utilized to install Linux or any other operating system on your computer. This is the easy and quick way to create a Bootable USB from ISO in Linux.
Kickstart Your Career
Get certified by completing the courseGet Started