Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
dd if=INPUT of=OUTPUT bs=SIZE count=N reads blocks from the input and writes them to the output. It works on files and on raw devices (whole disks), so it can copy or destroy anything — people call it "disk destroyer" for a reason. Always check of=.
Options are written as name=value, not with dashes.
Zo schrijf je het
dd [OPERAND]...Opties 15
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 11
$ als gewone gebruiker# als root (of met sudo)
1Create a file of 1 GiB with zeros
dd if=/dev/zero of=/swapfile bs=1M count=1024Good for swap files (no holes).
2Write an ISO to a USB stick
dd if=rhel-10.0-x86_64-dvd.iso of=/dev/sdc bs=4M status=progress oflag=sync/dev/sdc is the whole stick (no number). Check with lsblk first!
3Back up a partition to an image
dd if=/dev/vdb1 of=/backup/vdb1.img bs=4M status=progressUnmount it first for a consistent copy.
4Back up the MBR (first 512 bytes)
dd if=/dev/vda of=/root/mbr.bin bs=512 count=1Boot code and MBR table.
5Wipe the start of a disk
dd if=/dev/zero of=/dev/vdb bs=1M count=10Removes partition table and signatures at the start (wipefs is cleaner).
6Test write speed
dd if=/dev/zero of=/var/tmp/test bs=1M count=1024 oflag=direct status=progressdirect skips the cache; delete the file after.
7Test read speed
dd if=/var/tmp/test of=/dev/null bs=1M iflag=directReal disk reads.
8A busy CPU process for labs
dd if=/dev/zero of=/dev/null &Practice top, nice and kill.
9Random data file
dd if=/dev/urandom of=random.bin bs=1M count=10Test files that do not compress.
10Copy a failing disk and go on after errors
dd if=/dev/sdb of=/backup/sdb.img bs=64K conv=noerror,sync status=progressBad blocks become zeros (ddrescue is better for this).
11Restore only the boot code
dd if=/root/mbr.bin of=/dev/vda bs=446 count=1Restores only the boot code, not the partition table (446 bytes).
Niets past bij dit filter.
Let op
of=on the wrong disk destroys it at once. There is no question and no undo.- Without status=progress dd prints nothing until it is done; send
kill -USR1 PIDfor a status.
Exitcodes
0 :: Done. 1 :: Error.