dd
Linux · Files · available in the simulator
What it does
Copies and converts data block by block between files and devices. It is used to clone disks, create images or generate test files.
Syntax
dd [operando=valor]...
Options and parameters
if=ficheroInput file or device; if omitted, it reads from standard input.
of=ficheroOutput file or device; if omitted, it writes to standard output.
bs=tamañoBlock size for reading and writing, such as 4M.
count=NCopies only N input blocks.
skip=NSkips N blocks at the start of the input.
seek=NSkips N blocks at the start of the output.
status=progressShows copy progress while it works.
conv=fsyncForces the data to be physically written before finishing.
Usage examples
dd if=/dev/zero of=vacio.img bs=1M count=10Creates a 10 MiB file filled with zeros.
dd if=disco.img of=copia.img bs=4M status=progressCopies an image while showing progress.
dd if=/dev/urandom of=aleatorio.bin bs=1K count=64Creates a 64 KiB file of random data.
dd if=imagen.iso of=/dev/sdX bs=4M status=progress conv=fsyncWrites an image to a USB device. Replace sdX with great care.
Notes and common mistakes
- dd does not ask for confirmation: a wrong of= on a device such as /dev/sda destroys its data without warning.
- That is why it is jokingly called the disk destroyer; in the simulator it is safe to practice.
- Always check the target device with lsblk before writing.