0% found this document useful (0 votes)
28 views3 pages

RK For Some

The document discusses the dd command, which is used for data transfer and conversion. It can copy files and back up or restore partitions and drives. The document also covers using dd for tasks like data recovery, benchmarking drive performance, and forking projects like dcfldd and dc3dd.

Uploaded by

Šarah Jáponïa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views3 pages

RK For Some

The document discusses the dd command, which is used for data transfer and conversion. It can copy files and back up or restore partitions and drives. The document also covers using dd for tasks like data recovery, benchmarking drive performance, and forking projects like dcfldd and dc3dd.

Uploaded by

Šarah Jáponïa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

rk for some solid-state drives (flash drives).

As of 2017, it does not work on USB flash drives nor on Secure


Digital flash memories.[citation needed] When available, this is both faster than using dd, and more secure.[citation
needed]
On Linux machines it is accessible via the hdparm command's --security-erase-
enhanced option.
The shred program offers multiple overwrites, as well as more secure deletion of individual files.
Data recovery[edit]
Data recovery involves reading from a drive with some parts potentially inaccessible. dd is a good fit with
this job with its flexible skipping ( seek ) and other low-level settings. The vanilla dd , however, is clumsy to
use as the user has to read the error messages and manually calculate the regions that can be read. The
single block size also limits the granuarity of the recovery, as a trade-off has to be made: either use a small
one for more data recovered or use a large one for speed.
A C program called dd_rescue [21] was written in October 1999. It did away with the conversion functionality
of dd , and supports two block sizes to deal with the dilemma. If a read using a large size fails, it falls back to
the smaller size to gather as much as data possible. It can also run backwards. In 2003, a dd_rhelp script
was written to automate the process of using dd_rescue , keeping track of what areas have been read on
its own.[22]
In 2004, GNU wrote a separate utility, unrelated to dd , called ddrescue. It has a more sophisticated
dynamic block-size algorithm and keeps track of what has been read internally. The authors of
both dd_rescue and dd_rhelp consider it superior to their implementation.[23] To help distinguish the
newer GNU program from the older script, alternate names are sometimes used for GNU's ddrescue ,
including addrescue (the name on freecode.com and freshmeat.net), gddrescue (Debian package
name), and gnu_ddrescue (openSUSE package name).
Another open-source program called savehd7 uses a sophisticated algorithm, but it also requires the
installation of its own programming-language interpreter.
Benchmarking drive performance[edit]
To make drive benchmark test and analyze the sequential (and usually single-threaded) system read and
write performance for 1024-byte blocks:

 Write performance: dd if=/dev/zero bs=1024 count=1000000 of=1GB_file_to_write


 Read performance: dd if=1GB_file_to_read of=/dev/null bs=1024
Generating a file with random data[edit]
To make a file of 100 random bytes using the kernel random driver:

dd if=/dev/urandom of=myrandom bs=100 count=1

Converting a file to upper case[edit]


To convert a file to uppercase:

dd if=filename of=filename1 conv=ucase,notrunc

Progress indicator[edit]
Being a program mainly designed as a filter, dd normally does not provide any progress indication. This can
be overcome by sending an USR1 signal to the running GNU dd process (INFO on BSD systems), resulting
in dd printing the current number of transferred blocks.
The following one-liner results in continuous output of progress every 10 seconds until the transfer is
finished, when dd-pid is replaced by the process-id of dd:

while kill -USR1 dd-pid ; do sleep 10 ; done

Newer versions of GNU dd support the status=progress option, which enables periodic printing of
transfer statistics to stderr.[24]

Forks[edit]
dcfldd [edit]
dcfldd is a fork of GNU dd that is an enhanced version developed by Nick Harbour, who at the time was
working for the United States' Department of Defense Computer Forensics Lab.[25][26][27] Compared
to dd, dcfldd allows more than one output file, supports simultaneous multiple checksum calculations,
provides a verification mode for file matching, and can display the percentage progress of an operation. As
of February 2024, the last release was 1.9.1 from April 2023.[28]
dc3dd[edit]
dc3dd is another fork of GNU dd from the United States Department of Defense Cyber Crime Center (DC3).
It can be seen as a continuation of the dcfldd, with a stated aim of updating whenever the GNU upstream is
updated. As of June 2023, the last release was 7.3.1 from April 2023.[29]

See also[edit]

 Free and open-source software portal

 Backup
 Disk cloning
 Disk Copy
 Disk image
 .img (filename extension)
 List of Unix commands
 ddrescue a GNU version that copies data from corrupted files

References[edit]
1. ^ Austin Group. "POSIX standard: dd invocation". Archived from the original on 2010-03-10. Retrieved 2016-
09-29.
2. ^ Chessman, Sam. "How and when to use the dd command?". CodeCoffee. Archived from the original on 14
Feb 2008. Retrieved 2008-02-19.

Data transfer forms of dd


blocks=$(isosize -d 2048 /dev/sr0)
Creates an ISO disk image from a CD-
dd if=/dev/sr0 of=isoimage.iso bs=2048
count=$blocks status=progress ROM, DVD or Blu-ray disc.[18]

dd if=system.img of=/dev/sdc bs=64M Restores a hard disk drive (or an SD card, for
conv=noerror example) from a previously created image.

dd if=/dev/sdb2 of=partition.image Create an image of the partition sdb2, using a 64


bs=64M conv=noerror MiB block size.

dd if=/dev/sda2 of=/dev/sdb2 bs=64M


conv=noerror Clones one partition to another.

dd if=/dev/ad0 of=/dev/ad1 bs=64M


conv=noerror
Clones a hard disk drive "ad0" to "ad1".

The noerror option means to keep going if there is an error, while the sync option causes output blocks to
be padded.
In-place modification[edit]
dd can modify data in place. For example, this overwrites the first 512 bytes of a file with null bytes:

dd if=/dev/zero of=path/to/file bs=512 count=1 conv=notrunc

The notrunc conversion option means do not truncate the output file — that is, if the output file already
exists, just replace the specified bytes and leave the rest of the output file alone. Without this
option, dd would create an output file 512 bytes long.
Master boot record backup and restore[edit]
The example above can also be used to back up and restore any region of a device to a file, such as
a master boot record.
To duplicate the first two sectors of a floppy disk:

dd if=/dev/fd0 of=MBRboot.img bs=512 count=2

Disk wipe[edit]
Main article: Data erasure
For security reasons, it is sometimes neces
ows EOF).

You might also like