Making a bootable USB drive for your favorite operating system is very easy. The command line ‘dd’ tool can do that for you, writing an image ISO file to a USB drive with minimal effort.
Usually, we create bootable USB drives and install Linux and other operating systems. Of course, many GUI applications to make bootable ISO are available such as Unetbootin, balenaEtcher, etc.
Related: Ventoy: How to Create a Multiboot USB Drive with Multiple ISO Files
But there is an easy command line way too. There is no need for the above applications. We can make bootable ISO, for any operating system, by using the dd
tool in Linux. Most Linux distributions have preinstalled dd tool.
The dd
(Data Duplicator) utility is a powerful tool that makes copies using block by block from one device to another. So we can also use the dd tool for data backup and restoration from one device to another.
Create Bootable USB Drive Using dd Command
This assumes you already have an ISO file that you want to move to an external “thumb drive” type of USB storage volume.
First, connect the USB drive and unmount it, assuming you know its designation, with something like the following:
umount /dev/sdb*
This assumes that your USB drive is showing as /dev/sdb
.
If you have multiple hard drives already connected to your machine, the drive you’d like to target might be like /dev/sdc
or /dev/sdd
or /dev/sde
. You get the picture.
We can have a look at the partitions and file systems on the system with this command:
sudo lsblk
After confirming which is your target drive and unmounting it, we need to format the unmounted drive. Let’s do this formatting with:
sudo mkfs.vfat /dev/sdb
We’re all ready to copy the ISO file to the USB drive using the dd command.
I’d recommend navigating to the directory where you downloaded the ISO. For this example, let’s say you put the ISO in your user’s /home/Downloads
directory.
cd ~/Downloads
Since we’re already in the right directory, we can use:
sudo dd if=name-of-iso.iso of=/dev/sdb status=progress
Where name-of-iso.iso
is, of course, replaced by the actual name of your ISO file.
-
if
stands for “input file.” It is used to specify the location of the ISO file. -
of
stands for “output file.” It specifies where to write the ISO file. In our case, it’s/dev/sdb
This may take several minutes to execute. You should see something like these results returned:
That’s all. You can use the same procedure to make any OS a bootable USB drive.
Conclusion
As you can see, creating a bootable Linux USB drive is a relatively straightforward task.
You can load your USB drive with your preferred Linux distribution and use it to install the operating system on your PC or laptop in minutes.
Thanks, amazing tutorial!
P.S. If “sudo mkfs.vfat /dev/sdb” gives “Partitions or virtual mappings on device ‘/dev/sdb’, not making filesystem” error, try overriding with -I ( sudo mkfs.vfat /dev/sdb -I )
lsblk will show you partitions of drive /dev/sdb
Try to use /dev/sdb1 where sdb1 is the partition of that drive
lsblk will show you partitions of drive /dev/sdb
Try to use /dev/sdb1 where sdb1 is the partition of that drive
this is really well written. would be interesting to see an article about how the formatting was chosen and what are the considerations.
I believe that depends on the size of the required install and the operating system in use. If you’re installing a windows OS I believe NFTS is the desired format, and in other cases FAT32 works. Although fat32 has a size limitation so sometimes you’ll need exFAT instead.
Writing a bootable Windows 10 iso does not work this way.
This may be due to:
~$: man mkfs.vfat
“…
BUGS mkfs.fat can not create boot-able filesystems. This isn’t as easy as you might think at first glance for various reasons and has been discussed a lot already. mkfs.fat simply will not support it 😉 “
The “sudo mkfs.vfat /dev/sdb” step is unnecessary and can be skipped. ‘dd’ is going to overwrite it, anyway.