Usually, We create bootable USB drives and install Linux and other operating systems. Of course there are many GUI applications to make bootable ISO are available for both Linux and Windows platforms such as,
- Unetbootin,
- Win32diskimager,
- Linux live usb,
- USB image writer,
- WinUSB,
- USB startup creator,
- And many.
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 dd tool in Linux. Most Linux distributions has preinstalled dd tool. We can also use dd in Windows but need to download and install it from internet.
dd is very powerful tool. dd stands for Data Duplicator which is make copy using block by block from one device into another device. So we can also use dd tool for data backup and restore from one device into another device.
Create Bootable USB Drive Using dd Command On Linux
First format your pen drive. In order to format our pen drive we need to unmount the device from the operating system. Unmount is nothing but an removing device from directory tree. Which prevents device from data loss.
umount /dev/sdb*
Note: sdb is my pen drive. That is assigned by Linux operating system automatically while inserting pen drive into our system. You can identify it by typing following command
sudo fdisk –l
After unmounting, we need to format our pen drive.
mkfs.vfat /dev/sdb –I
The above command will format the pen drive and maked FAT filesystem.
After that use dd command:
dd if=~/home/Buvanesh/iso/Ubuntu32.iso of=/dev/sdb
Here,
- 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
It takes some time to copy one disk to another disk. Usually dd tool does not show progressing status. But we can use a simple trick to monitor it.
To monitor dd progress, run:
pgrep –l ‘^dd$’
It will print process number for the dd tool. Note down it and open new terminal session and type:
kill –USR1 6762
Here 6762 is my dd process id. Now it will print copying process statics.
That’s all. You can use the same procedure to make any OS to make bootable USB drive.
Additional tip: While creating bootable USB by using above method, dd tool will make several partition on that pen drive. So after using bootable USB, It is best to format and use the pen drive for making another bootable ISO.
To format the USB drive, run the following command:
sudo mkfs.vfat /dev/sdb –I
For more details, refer man pages.
man dd
Suggested read:
- Etcher – A Beautiful App To Create Bootable USB Drives And SD Cards
- How To Create Multiboot USB Drives With Ventoy In Linux
- Popsicle – Create Multiple Bootable USB Drives At Once
- Bootiso Lets You Safely Create Bootable USB Drive
- MultiCD – Create Multiboot CD, DVD, and USB Images
- How To Write An ISO To The USB Drive Directly From The Internet
- How To Create An ISO From A Bootable USB Drive In Linux
- How To Create Custom Ubuntu Live CD Image
- How To Write ISO Images To USB Disks Directly Using Pv Command In Linux
11 comments
No need to format the USB memory stick at /dev/sdb if you are writing it all over with dd of=/dev/sdb in the command after.
Thanks for the correction Mr.Jackson. Will check and update.
I’m running Arch and I have found that when I run ‘mkfs.vfat’ with my volume, it comes back with ‘bash: mkfs.vfat: command not found’, it would appear that ‘vfat’ is not installed for whatever reason.
Hello! you just have to install dosfstools and ntfsprogs, then mkfs.vfat will work.
If you want to be sure you’re targeting a USB device (and not internal drive), or if you want autodetection of a USB device (through command line though) you can use ‘bootiso’ bash script https://github.com/jsamr/bootiso. And type:
bootiso -d /dev/sdb ~/home/Buvanesh/iso/Ubuntu32.iso
It will fail if /dev/sdb is not connected through USB, which is way more secure.
You can add
to the dd command to see the transfer progress, skipping the whole second part of the tutorial!
Thank you.
“mkfs.vfat /dev/sdb –I” fails, as the -I parameter has to be before the partition. Hence: mkfs.vfat -I /dev/sdb.
Another way to check the progress is by using the ‘status= progress’ option ,you will get period updates of the copying process. Also, people like to keep the block size to 1M or 4M instead of the default (512) to speed up the process. You can also use the sync option with the command to tell exactly when dd have finished the job.
thank you so much bro , you should make video on this
Hi, guys
This worked fine for me, using sudo in all commands.
I managed to successfully burn the xubuntu 20 iso to an USB in a debian 10 machine. It boots fine!!
For the people that can’t use mkfs.vfat, fdisk -l, etc. the problem is that these programs are in /usr/sbin, so are only avaliable trough the use of sudo, you could add /usr/sbin to path, but I think it isn’t in PATH for security reasons. You could create aliases to omit typing sudo everytime.