Linux dd Command Guide
"Data Description" or "Disk Destroyer"? A powerful utility for copying and converting files.
⚠️ WARNING: DOUBLE CHECK YOUR TARGET
The dd command is merciless. If you type
of=/dev/sda instead of of=/dev/sdb, you will wipe your operating
system instantly. Always check your drive letters using lsblk first.
Basic Syntax
dd if=[INPUT_SOURCE] of=[OUTPUT_DESTINATION] [OPTIONS]
- if (Input File): Where to read data from (e.g., an ISO file, a disk).
- of (Output File): Where to write data to (e.g., a USB drive, an image file).
Common Use Cases
1. Create a Bootable Linux USB
sudo dd if=ubuntu-22.04.iso of=/dev/mmcblk0 bs=4M status=progress
Parameters explained:
bs=4M: Block size. Reads/writes 4MB chunks at a time (faster).status=progress: Shows a progress bar (otherwise dd is silent).
2. Backup an Entire Disk to an Image
sudo dd if=/dev/sda of=backup_image.img bs=64K conv=noerror,sync status=progress
conv=noerror: Continue even if read errors occur.sync: Fill bad blocks with zeros instead of skipping them.
3. Wipe a Disk (Secure Erase)
sudo dd if=/dev/zero of=/dev/sdX bs=1M status=progress
This overwrites every bit on the drive with a zero.
Monitoring Progress
If you forgot to add status=progress, you can check the status of a running dd
process by sending it a specific signal:
# Send signal USR1 to the dd process
sudo kill -USR1 $(pgrep ^dd)