| Basic
dd
option | Default | Brief
description | 
| bs=BS | 512 | Number of bytes in each block. | 
| count=COUNT | blocks in IFILE | Number of blocks to copy. | 
| if=IFILE | stdin | file (or device) to read from. | 
| of=OFILE | stdout | file (or device) to write to. | 
| dd
option | Default | Brief
description | 
| ibs=BS | same as bs=BS | number of bytes in each block of
      IFILE | 
| iflag=FLAGS | similar
to option found in recent GNU dd versions, see below | |
| obs=BS | same as bs=BS | number of bytes in each block of OFILE | 
| oflag=FLAGS | similar
to option found in recent GNU dd versions, see below | |
| seek=SEEK | 0 | block number (origin 0) in OFILE to commence writing | 
| skip=SKIP | 0 | block number (origin 0) in IFILE to commence reading | 
| --help | print usage message then exit | |
| --version | print version number and its
date then exit | 
| Multiplier | Meaning | 
| x<n> | *<n> | 
| c | *1 | 
| w | *2 | 
| b | *512 | 
| k  K  KiB | *1024 | 
| KB | *1000 | 
| m  M  MiB | *1048576 | 
| MB | *1000000 | 
| g  G  GiB | 2**30 | 
| GB | 10**9 | 
| t  T  TiB | 2**40 | 
| TB | 10**12 | 
| flag | sg
device | block
device | regular
file | comments | 
| append | ignored | applied on OFILE | applied on OFILE | use O_APPEND open flag.
Conflicts with 'seek=SEEK'
when "SEEK > 0" | 
| coe | applied | applied if using SG_IO ioctl | ignored | continue on error; best effort recovery then continue. N.B. can be used multiple times (e.g. 'iflag=coe,coe'). See section on continue on error. | 
| direct | applied | applied | applied | use O_DIRECT open flag, no
effect with sg devices | 
| dpo | applied | applied if using SG_IO ioctl | ignored | "disable page out" set for READ and/or WRITE SCSI commands | 
| dsync | applied | applied | applied | use O_SYNC open flag, no effect
with sg devices | 
| excl | applied | applied | applied | Use O_EXCL open flag | 
| fua | applied | applied if using SG_IO ioctl | ignored | "force unit access" set for READ
and/or WRITE SCSI commands | 
| nocache | ignored | applied | applied | Use posix_fadvise(POSIX_FADV_DONTNEED) to suggest minimal use of file buffers (kernel cache) associated with files being copied. | 
| null | ignored | ignored | ignored | this flag is just a place holder | 
| sgio | ignored | use SG_IO ioctl | ignored | access block device via SG_IO
ioctl (only supported in lk 2.6 series) | 
| sparse | applied on OFILE | applied on OFILE | applied on OFILE | don't write output buffers
(except the last one) that are full of zeros. See section on sparse writes . OFILE cannot be a stream (e.g.
stdout) when this flag is given | 
| extra
option
in sg_dd | default | sgm_dd
      and sgp_dd | Brief
description | 
| blk_sgio=0 | 1 | 0 | when set access devices via SCSI
commands (SG_IO ioctl). May use iflag=sgio and/or oflag=sgio
instead. | |
| bpt=BPT | 128 or 32 | both | where BPT is the blocks per transfer
(granularity
of each IO). Default is 128 when BS
< 2048 (bytes) else the default
is 32. For block devices (BPT
* BS) is constrained by /sys/block/<device>/queue/max_sectors_kb
. | 
| cdbsz=6 | 10 | 12 | 16 | 10 or 16 | both | cdb size of SCSI READ and/or
WRITE commands. Only applicable to sg devices or when the SG_IO ioctl
is being used (e.g. when blk_sgio=1). Defaults to 10 byte cdb unless
the largest address exceeds 32 bits or BPT exceeds 16 bits. In either
case a 16 cdb is used. | 
| coe=0 | 1 | 2 | 3 | 0 | sgp_dd | when non-zero, continue_on_error
for
sg devices and block devices using the SG_IO ioctl. May use iflag=coe
and/or oflag=coe
instead. An equivalent of coe=2 is 'iflag=coe,coe'. See section on continue on error. | 
| coe_limit=CL | 0 |  | number of consecutive "bad" block errors allowed when reading and 'coe > 0'. Default of 0 is interpreted as no limit. See section on continue on error. | 
| dio=0 | 1 | 0 | both | direct IO (only via sg device
nodes) | 
| odir=0 | 1 | 0 | O_DIRECT flag on open() when set. Better to use iflag=direct and/or oflag=direct. | |
| retries=RETR | 0 | number of times to retry an
error on a sg device READ or WRITE command | |
| sync=0 | 1 | 0 | both | when set, sends SYNCHRONIZE
CACHE SCSI command to OFILE
if it is a sg device or accessed
via the SG_IO ioctl. | 
| time=0 | 1 | 0 | both | when set print elapsed time and
throughput calculation at the completion of the copy | 
| verbose=VERB | 0 | sgm_dd | larger VERB is the greater
the debug output. 1 and 2 print the cdbs for setup commands; 3 and 4
print the cdbs for all commands | 
| File
type | open
[when
input] | open
[when
output] | IO
method | Notes | 
| normal | O_RDONLY | O_WRONLY | O_CREAT | Unix read() write() | N.B. A normal output file is
overwritten (not truncated). | 
| stdin or stdout | [do nothing] | [do nothing] | Unix read() write() | hence open() flags have no
effect (e.g. 'oflag=direct' is ignored) | 
| /dev/null or . (period) | O_RDONLY | [do nothing] | Unix read() if input | if output file then nothing is
written | 
| block device | O_RDONLY | O_WRONLY | O_CREAT | Unix read() write() | |
| block device [sgio flag given] | O_RDWR or O_RDONLY | O_RDWR | SCSI commands | Opens input O_RDONLY if O_RDWR fails. The blk_sgio=1 option equates to both iflag=sgio and oflag=sgio. Partitions ignored. | 
| sg device | O_RDWR or O_RDONLY | O_RDWR | SCSI commands | Opens input O_RDONLY if O_RDWR fails | 
| raw device | O_RDONLY | O_WRONLY | Unix read() write() | O_DIRECT open flag in lk 2.6
series is a replacement for raw devices | 
| scsi tape device | x | x | no IO | error reported | 
Return to main page.
Last updated: 28th May 2010