dd Command
Advanced Disk & Storage man(1)Convert and copy data at block level
👁 12 views
📅 Updated: Mar 15, 2026
SYNTAX
dd [OPERAND]...
What Does dd Do?
dd copies and converts data at the block level. It reads from an input source, optionally transforms the data, and writes to an output destination. dd works with raw devices, making it essential for disk imaging, bootable USB creation, and low-level data operations.
dd operates below the filesystem level, copying raw bytes. This makes it powerful but dangerous — writing to the wrong device will destroy data with no undo.
Common uses include creating disk images, writing ISO files to USB drives, wiping disks, benchmarking I/O performance, and converting file formats.
dd operates below the filesystem level, copying raw bytes. This makes it powerful but dangerous — writing to the wrong device will destroy data with no undo.
Common uses include creating disk images, writing ISO files to USB drives, wiping disks, benchmarking I/O performance, and converting file formats.
Options & Flags
| Option | Description | Example |
|---|---|---|
| if= | Input file/device | dd if=/dev/sda of=disk.img |
| of= | Output file/device | dd if=ubuntu.iso of=/dev/sdb |
| bs= | Block size | dd if=/dev/zero of=test bs=1M count=100 |
| count= | Number of blocks to copy | dd if=/dev/urandom of=random.bin bs=1M count=10 |
| status=progress | Show progress during copy | dd if=image.iso of=/dev/sdb bs=4M status=progress |
| conv= | Conversion options | dd if=input conv=ucase of=output |
Practical Examples
#1 Write ISO to USB
Creates a bootable USB drive from an ISO file. VERIFY /dev/sdb is correct!
$ sudo dd if=ubuntu.iso of=/dev/sdb bs=4M status=progress#2 Create disk image
Creates a complete byte-for-byte disk image.
$ sudo dd if=/dev/sda of=/backup/disk.img bs=4M status=progress#3 Benchmark disk speed
Writes 1GB of zeros to measure write speed.
$ dd if=/dev/zero of=testfile bs=1M count=1024 status=progress
Output:
1073741824 bytes copied, 2.5 s, 429 MB/s
#4 Wipe disk
Overwrites entire disk with zeros. DESTRUCTIVE!
$ sudo dd if=/dev/zero of=/dev/sdb bs=4M status=progress#5 Create swap file
Creates a 2GB file filled with zeros for use as swap.
$ sudo dd if=/dev/zero of=/swapfile bs=1M count=2048#6 Backup MBR
Backs up the first 512 bytes (Master Boot Record).
$ sudo dd if=/dev/sda of=mbr_backup.bin bs=512 count=1Tips & Best Practices
VERIFY the target device: dd with wrong of= DESTROYS data permanently. Triple-check with lsblk before running dd to a device. There is no undo.
Use status=progress: Always add status=progress to see transfer speed and progress. Without it, dd runs silently until complete.
Block size matters: Larger block sizes (bs=4M or bs=1M) are much faster than the default 512 bytes. Always specify bs for better performance.
Frequently Asked Questions
How do I create a bootable USB?
sudo dd if=distro.iso of=/dev/sdX bs=4M status=progress. Replace sdX with the correct USB device (check lsblk).
How do I benchmark disk speed?
Write: dd if=/dev/zero of=test bs=1M count=1024. Read: dd if=test of=/dev/null bs=1M. Delete test file after.
How do I clone a disk?
sudo dd if=/dev/sda of=/dev/sdb bs=4M status=progress. Both disks must be the same size or destination must be larger.
Related Commands
More Disk & Storage Commands
Master Linux with Professional eBooks
Curated IT eBooks covering Linux, DevOps, Cloud, and more
Browse Books →