dd (data duplicator) — Block-level copy and conversion
Linux / File and disk management / dd.html
A low-level tool that copies files or devices block by block and converts data to build images and bootable disks.
Basic Information
| Command Name | dd (data duplicator) |
|---|---|
| One-line Introduction | A low-level tool that copies files or devices block by block and converts data to build images and bootable disks. |
| Provided by | GNU coreutils (included in every Linux distribution) |
| Official Documentation | https://man7.org/linux/man-pages/man1/dd.1.html |
| Supported Operating Systems | Linux, macOS, BSD, WSL |
| Installation Status | Installed by default (no separate installation needed) |
| Category | Linux file and disk management (tags: disk, image, copy, bootable, backup) |
What is this command?
dd reads from an input and writes to an output in fixed-size blocks. Because it treats files, partitions and whole disks as plain byte streams, it is widely used for imaging and cloning.
The conv options add conversions such as case mapping, syncing or ignoring read errors, and status=progress reports how far a long-running copy has gone.
What problems does it solve?
- Backing up or restoring an entire disk as a single file.
- Writing an installation ISO directly to a USB stick.
- Saving only the boot sector at the start of a partition.
- Creating dummy files to measure disk write throughput.
Key features
Choosing the block size
The bs option sets how many bytes are read and written per operation, which controls throughput.
- When to use: Copying large disk images
- What you get: Larger blocks reduce system calls and usually increase speed
- Limitations: Very large values raise memory usage
Conversion options
conv=notrunc, sync or noerror changes how writes and read errors are handled.
- When to use: Overwriting only part of an existing file
- What you get: notrunc keeps the tail of the file intact
- Limitations: A wrong combination can corrupt data
Progress reporting
status=progress periodically prints transferred bytes and speed.
- When to use: Writing multi-gigabyte images
- What you get: You can estimate the remaining time
- Limitations: Not supported by some older coreutils versions
Installation and usage
Check whether it is installed
which dd
dd --version
It ships with coreutils, so no separate installation is needed. In minimal container images install the coreutils package with your distribution's package manager.
Real-world examples
Create a disk image
Clones a whole device into a file. Swapping if and of restores it.
# Save all of /dev/sdb as an image
dd if=/dev/sdb of=/backup/disk.img bs=4M status=progress
Write an ISO to USB
Writes an installer image straight to a USB device. Always verify the target device name first.
# Check the target device first
lsblk
sudo dd if=install.iso of=/dev/sdc bs=4M oflag=sync status=progress
Generate a test file
Creates a zero-filled file to measure write performance.
# Create a 1GB dummy file
dd if=/dev/zero of=/tmp/test.img bs=1M count=1024 status=progress