ibs=512, obs=512
If input reads are short, input from multiple reads are aggregated to form the output block.
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=n
Copy onlyn 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
iseek=B
SkipB blocks on the input
.
On input which supports seeks, lseek is used. Otherwise, input data is read and discarded.
For pipes, the correct number of bytes is read .
oseek=B
seek=B
Seek the output fileB blocks.
On non-tape devices: lseek is used.
On tape devices: blocks are read and the data discarded.
If the seek is encounters the end-of-file, additional blocks of zeros are inserted to the specified offset.
Specifying block size
ibs=b
input block size b bytes default 512.
obs=b
output block size.
bs=b
block size of both 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=b
Set the conversion block size to b 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 ed.
conv=value[,value …
IBM to unix ( text file only )
unblock
input is fixed length blocks
Trailing spaces are discarded and a new-line character is appended,
making the output size in characters to be different from the number of bytes read.
ascii
oldascii
characters are translated from EBCDIC to ASCII in additional to unblock,
. Implies unblock if cbs is also specified. ascii Note: EBCDIC numeric characters are F0 F1 F2 … F9, space is 40
Alphabetic upper case C1 C2 C3 … C8 C9 D1 D2 … D9 E1 E2 … E9
Alphabetic lower case 91 92 93 … 98 99 A1 A2 … A9 B1 B2 … B9 oldascii historic
unix to IBM (text file only)
block
input is a sequence of newline or end-of-file terminated
blocks.
Trailing newline characters are discarded.
Output blocks are written with length specified by cbs=b
by padding with spaces or truncating!,
making the output size in bytes to be different from the number of characters read.
The number of truncated records, is reported to standard error at completion .
ebcdic†
oldebcdic
ibm
oldibm
Characters are translated from
ASCII† to EBCDIC
in additional to block
Implies block if cbs=b is also specified. EBCDIC
ibm is slightly different .
lcase
Translate uppercase characters to lowercase
ucase
Translate lowercase characters to uppercase
swab yes it's a B
Swap every pair of input bytes.
sync
Pad input blocks to the ibs with spaces
if a block oriented conversion,
otherwise nulls are used.
osync
Pad output blocks to the obs.
Incompatible with 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,i.e. append.
not supported for tapes.
sparse
If an output blocks would consist solely of nulls,
seek the output file by the required amount instead of filling it 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.
Two or more numbers may be separated by an x to indicate a product example 80x100.
When finished the number of complete records + (partial input and output blocks, truncated input records and odd-length byte-swapping blocks ) is displayed to standard error.
A partial input block is one where less than the input block size was read (not bad).
A partial output block is one where less than the output block size was written (not bad if partial input also).
Partial output blocks to tape devices are fatal errors. (?)
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 (bad).
Normally, data resulting from input or conversion or both are aggregated into output blocks of
the specified size. When the end of input is reached, any remaining output is written as a
block, causing the final output block to 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
regular completion message.
If dd receives a SIGINT signal it behaves as if the end of the input had been reached (probably badly).
Diagnostics
Exits with 0 on success, and >0 if an error occurs.
dd: /dev/disk2s1: Resource busy
sudo umount /dev/disk2s1
On mac os may need to
sudo diskutil umountDisk /dev/disk2
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
dd: bin: Is a directory
Example using SD card
Commas added by ed
From SD card to file
> sudo umount /dev/disk2s1 # (on Mac os or other system that auto mounts the SD card when insserted)
> sudo dd if=/dev/disk2 bs=1m | gzip >RaspRuuvi230115.gz # 8GB card
^t
load: 2.07 cmd: dd 35324 uninterruptible 0.00u 14.28s
1640+0 records in
1640+0 records out
1719664640 bytes transferred in 298.852621 secs (5754223 bytes/sec)
7580+0 records in
7580+0 records out
7,948,206,080 bytes transferred in 1,248.505112 secs (6,366,178 bytes/sec) > 2,641,908,089 (2.6GB)
From SD card to file
sudo dd if=/dev/disk2 bs=1m | gzip >RaspRuuvi230118.g # 8GB card
7580+0 records in
7580+0 records out
7,948,206,080 bytes transferred in 1,171.250605 secs( 20 minutes) (6,786,085 bytes/sec) > 2,327,670,704 slightly smaller
file to SD card
sudo gzip -d RaspRuuvi230118.gz | dd bs=1m of=/dev/disk2
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 !!
0 an SD card
sudo dd if=/dev/zero of=/dev/disk2 bs=1m
dd: /dev/disk2: end of device
7581+0 records in
7580+1 records out
7,948,210,176 bytes transferred in 2,934.646728 secs 48 minutes for 8GB (2,708,404 bytes/sec) slower than from gzip !!