Home Bootable USB How To Create Bootable USB Drive Using dd Command

How To Create Bootable USB Drive Using dd Command

By editor
Published: Last Updated on 94.5K views

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
fdisk command output

fdisk command output

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.

Create bootable USB drive using dd command in Linux

Create bootable USB drive using dd command in Linux

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:


You May Also Like

11 comments

Anders Jackson March 9, 2016 - 4:36 am

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.

Reply
SK March 9, 2016 - 11:18 am

Thanks for the correction Mr.Jackson. Will check and update.

Reply
projectFirehive June 6, 2017 - 8:41 pm

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.

Reply
jodeteeeee June 17, 2017 - 12:16 am

Hello! you just have to install dosfstools and ntfsprogs, then mkfs.vfat will work.

Reply
Jules Randolph April 10, 2018 - 5:41 am

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.

Reply
John July 31, 2018 - 1:50 am

You can add

status=progress

to the dd command to see the transfer progress, skipping the whole second part of the tutorial!

Reply
Peter Kehl November 2, 2018 - 10:41 am

Thank you.
“mkfs.vfat /dev/sdb –I” fails, as the -I parameter has to be before the partition. Hence: mkfs.vfat -I /dev/sdb.

Reply
Khaithang Haokip February 24, 2019 - 7:32 am

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.

Reply
sahil August 12, 2020 - 10:36 pm

thank you so much bro , you should make video on this

Reply
ajbg96r December 4, 2020 - 8:53 pm

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!!

Reply
Someone October 31, 2021 - 7:27 pm

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.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More