· all posts

Make bootable USB drives with dd

There are many complex programs for burning an ISO to an external drive, some with graphical user interfaces and some without. However, if you’re using any Unix-like operating system, chances are you already have a utility that will do the job. It’s called dd.

Short version

  1. Locate your drive with sudo fdisk -l.
  2. Unmount the drive with umount /dev/sdb*. If fdisk shows your USB drive as something other than sdb, use that instead.
  3. dd if=/path/to/image.iso of=/dev/sdb (the whole device, not just sdb1)

Long version

If this is your first time working with these commands, it can be tempting to simply copy and paste, make your bootable drive, and forget about it. However, having an understanding of what each one does is beneficial because you’ll know the why in addition to the how, which in turn allows you to solve problems later on using these tools.

Let’s start with sudo fdisk -l. (Without sudo, you might get permission denied errors.) In the output, look for an entry like this one:

Disk /dev/sdb: 3.8 GiB, 4049600512 bytes, 7909376 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0b5e8681

Device     Boot Start    End Sectors  Size Id Type
/dev/sdb1  *        0 782335  782336  382M  0 Empty
/dev/sdb2        4076   9387    5312  2.6M ef EFI (FAT-12/16/32)

How do I know that this is my USB drive? I’m using the size to identify it, and since there are no other drives with a size of roughly 4 GB, this must be it.

Unmount the drive with umount /dev/sdb*. sdb1 and sdb2 refer to different partitions on the same drive. Using the wildcard *, we unmount all partitions at once.

Finally, use the dd utility to write the ISO image (a type of archive file) to the drive.

dd if=/path/to/image.iso of=/dev/sdb

if is the input file, which will be the ISO image. of is the output file, which will be the drive we want to write the image to. Note that we write to the file that represents the device, and not just a particular partition such as sdb1.

It might take a while to write to the drive, but eventually you will see output like this:

782336+0 records in
782336+0 records out
400556032 bytes (401 MB, 382 MiB) copied, 84.0998 s, 4.8 MB/s

Once you see this, the USB drive is ready.

dd is a versatile and powerful utility. Be careful when using it as you could easily write data to the wrong location, overwriting existing information and causing data loss. To explore the dd utility further, check out the man page: man dd