dd
April 16, 2025
dd is a program for converting and copying files, with sometimes disastrous consequences. It is nicknamed “disk destroyer” for a reason. Be careful.
For tasks like copying an .iso to a drive to make bootable media, consider using something like Ventoy.
Formatting a Drive With An .iso
You can use use dd is to copy .iso image files to block media (like a USB drive) to make the media bootable. This is done by running:
dd if=your.iso of="/your/dev" bs=1M status=progress
It’s important that /your/dev is the path to the device itself, not any partitions on it. For example, if /dev/sda has partitions /dev/sda1 and /dev/sda2, these should be ignored in dd; of= should be set to /dev/sda.
You can change the number of bytes read and written at a time using the bs= argument. The default is 512.
Wiping a Drive
A drive can be wiped by overwriting it with random data, zeros, or something else. This is a good idea if you want to destroy a drive, or reuse a drive for another purpose.
To overwrite a drive with random data, simply run:
dd if=/dev/random of=/your/dev bs=1M status=progress
/dev/random and /dev/urandom are special files that provide random number generation specifically for these kinds of purposes. There is also /dev/zero, which overwrites the drive with all zeros.
There are other considerations for wiping drives that are not pertinent to the use of dd. This Arch Wiki article describes them.