Copy bootable ISO-images to a USB drive using dd

There is a variety of tools to create bootable USB drives. Many of them come with a graphical user interface, a rich feature set and are convenient to use. You are probably familiar with UNetbootin or the Ubuntu Startup Disk Creator. While those programs do a fine job, not all people are aware that the versatile linux core util dd is also capable to perform this task. And sometimes dd is all you have (and need).

Here is what I usually do when I want to create a bootable USB flash drive:

I use lsblk to figure out under which device the USB flash drive is known to the system. You can also consult the kernel output using dmesg if it’s not that obvious. In any case you should be sure of picking the right target device, otherwise you might destroy the contents of your system hard drive. For the example we can be pretty sure that it’s /dev/sdb.

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 223,6G  0 disk 
├─sda1   8:2    0   8,0G  0 part [SWAP]
├─sda2   8:3    0 215,2G  0 part /
sdb      8:16   1   7,4G  0 disk 
├─sdb1   8:17   1   245M  0 part 
└─sdb2   8:18   1   3,1M  0 part 

Execute the dd command with the necessary parameters. My standard scenario is creating a bootable USB drive of GParted, a very powerful tool I use to copy, shrink or extend partitions.

$ sudo dd if=/path/to/gparted-live-0.24.0-2-amd64.iso of=/dev/sdb

When your ISO image is big or the copy process is just slow you might be interested in its progress. You can easily achieve this by sending the dd process the USR1 signal. In a separate shell you can find out the pid of your running dd process and send it the USR1 signal.

$ ps awx | grep dd
32609 pts/2    D+     0:00 dd if=/path/to/gparted-live-0.24.0-2-amd64.iso of=/dev/sdb
$ sudo kill -USR1 32609

Sending dd the USR1 signal will make it print the current copy progress on the original shell, e.g.:

382777+0 records in
382777+0 records out
195981824 bytes (196 MB) copied, 36,025 s, 5,4 MB/s

After dd has finished you might want to call sync, just to make sure that the filesystem cache is flushed to the USB drive.

$ sync

That’s it. Your bootable USB drive is ready for being used. By the way, the same procedure is applicable to SD memory cards.