Back to the command reference

dd

DisksAdvanced In real Linux

Copy and convert data block by block (e.g. boot USBs)

Name: dd: often read as data duplicator or disk dump; the name actually comes from IBM JCL's DD (data definition) statement

This command needs a real Linux system; you can practise it in real Linux mode.

Full man page

Description

dd copies data block by block from input to output, optionally converting it. It reads and writes devices directly, so it is used to write boot USB drives, image partitions, create files of a given size or wipe disks.

It never asks for confirmation; a wrong of= overwrites data instantly, hence the nickname "disk destroyer". Check device names with lsblk first.

Syntax

dd if=INPUT of=OUTPUT [OPTION]...

Common options

if= / of=Input file / output file
bs=Block size, e.g. 4M
count=Number of blocks
skip= / seek=Blocks to skip in the input / the output (start in the middle)
status=progressShow progress
conv=fsyncFlush the data to the device before finishing (for USB sticks)

Examples

  • $ sudo dd if=/dev/zero of=/dev/sda bs=1M count=1 status=progress

    Wipe the start of the practice disk (its partition table); a wrong of= destroys data!

    Explain
  • $ dd if=/dev/zero of=test.img bs=1M count=10

    Create a 10 MB file of zeros

    Explain

Related