dd Device Dump with conversion

Device Dump

copy and (Optionally) convert file

dd [operands … ]

Example: time sudo dd bs=1m if=SDcard.img of=/dev/disk2 # takes 1 minute/GB !

time sudo dd bs=2048 < /dev/disk2s0 > cd.dat # first partition ONLY

time sudo dd if=/dev/disk2 bs=1m | gzip >RaspRuuvi190309.gz

if=/dev/mt0 of=tapeimage bs=4096 skip=2 count=3 conv=ascii

When finished, displays the number of complete and partial input and output blocks, and truncated input records to stderr

Originally concieved as a means to transfer files to and from magnetic tape some options only make sense in that context. ed

partial copying
count=B Copy only B input blocks.
files=n Copy n input files. Only applicable when the input is a tape and refers to tape-marks ed.
specifying source & destination other than STDIN to STDOUT
if=file input from file
of=file output to file . Any regular output file is truncated(emptied) unless notrunc is specified.
If an initial portion of the output file is seeked past (see oseek ), the output file is truncated(emptied) at that point.
Specifying a starting point perhaps continuing from a previous execution
Skip B blocks from the beginning of the input before copying.
On input which supports seeks, an lseek(2) operation is used. Otherwise, input data is read and discarded.
For pipes, the correct number of bytes is read.
For all other devices, the correct number of blocks is read .
Seek on the output file B blocks. On non-tape devices, an lseek operation is used. Otherwise, existing blocks are read and the data discarded. using the tape ioctl(2) function calls.
If the seek is past the end of file, space from the current end-of-file to the specified offset is filled with blocks of 00 bytes.
Specifying block size
ibs=binput block size b bytes default 512.
obs=boutput block size "
bs=b block size of input and output superseding ibs and obs.
each input block is copied to the output as a single block without any aggregation of short blocks unless conversion options specify otherwise.
cbs=n Set the conversion record size to n bytes.
required by the record oriented conversions .
status=noxfer suppress transfer statistics not in BSD
Specifying options for conversion
IBM mainframes usually use EBCDIC and fixed length records where as
unix systems usually use ASCII and variable length records with a new-line termination character
conv=value[,value …

IBM to unix
unblock Treats the input as a sequence of fixed length records independent of input and output block boundaries as specified by cbs=b .
Trailing spaces are discarded and a new-line character is appended.


in additional to unblock, characters are translated from EBCDIC to ASCII. Implies unblock if cbs is also specified.
oldascii historic
unix to IBM
block Treats the input as a sequence of newline or end-of-file terminated variable length records independent of input and output block boundaries.
Trailing newline characters are discarded.
Input records are converted to a fixed length output records as specified by cbs=b.
by padding with spaces or truncated!
The number of truncated records, is reported to the standard error output at the completion of the copy.


in additional to block characters are also are translated from ASCII to EBCDIC
(Implies block if cbs=b is also specified.)
ebcdic , ( ibm is slightly different
lcase Transform uppercase characters into lowercase
ucase Transform lowercase characters into uppercase characters.
yes it's a B
Swap every pair of input bytes.
sync Pad input block to the input buffer size with spaces if a block oriented conversion,
otherwise NUL bytes are used.
osync Pad the final output block to the output block size.
If the input file is not a multiple of the output block size after conversion, forces the final output block to be the same size as preceding blocks for use on devices that require regularly sized blocks to be written.
Incompatible with use of the bs=b
Misc options
noerror Do not stop processing on an input error. Not on BSD aka Mac OS
Diagnostic message followed by the current input and output block counts will be written to the standard error output .
 If sync is also specified, missing input data will be replaced with NUL bytes (or with spaces if a block oriented conversion was specified) and processed as a normal input buffer.
 If sync is not specified, the input block is omitted from the output.
On input files which are not tapes or pipes, the file offset will be positioned past the block in which the error occurred using lseek(2).
notrunc Do not truncate the output file rather preserve any blocks in the output file not explicitly written by dd,
not supported for tapes.
sparse If one or more output blocks would consist solely of NUL bytes,
try to seek the output file by the required space instead of filling them with NULs, resulting in a sparse file.

Sizes are specified in decimal, octal, or hexadecimal bytes .
Suffix of blocks, k, m, g, or w, the number is multiplied by 512, 1,024 (1K), 1,048,576 (1M), 1,073,741,824 (1G) or the number of bytes in an integer, respectively. Two or more numbers may be separated by an x to indicate a product.

When finished displays the number of complete and partial input and output blocks, truncated input records and odd-length byte-swapping blocks to the standard error output. A partial input block is one where less than the input block size was read. A partial output block is one where less than the output block size was written.
Partial output blocks to tape devices are fatal errors. Otherwise, the rest of the block will be written.
Partial output blocks to character devices will produce a warning message. A truncated input block is one where a variable length record oriented conversion value was specified and the input line was too long to fit in the conversion record or was not newline terminated.

Normally, data resulting from input or conversion or both are aggregated into output blocks of the specified size. After the end of input is reached, any remaining output is written as a block. This means that the final output block may be shorter than the output block size.

If dd receives a SIGINFO ( aka sigstat default ^t see the status argument for stty signal, the current input and output block counts will be written to the standard error output in the same format as the standard completion message.

If dd receives a SIGINT signal it behaves as if the end of the input had been reached.


dd: /dev/disk2s1: Resource busy
sudo umount /dev/disk2s1

WARNING may stop on error without error message or log entry! Check records in / out

dd: unknown operand noerror

dd: bs: illegal argument combination or already set

exits 0 on success, and >0 if an error occurs.

load: 0.19  cmd: dd 89246 running 0.32u 1.99s
329272+0 records in
329272+0 records out
168587264 bytes transferred in 6.675876 secs (25253204 bytes/sec)

from 32GB raspberry pi SD   bs=1M
30436+1 records in
30436+1 records out
31,914,983,424 bytes transferred in 7,125.643065 secs (4,478,892 bytes/sec)  Nearly 2 hours !!


cp (copy), tr translate