| Standard
dd options | Default | Brief
description | 
| bs=<block_size> | 512 | Number of bytes in each block | 
| count=<count_of_blocks> | blocks in input file | Number of blocks to copy | 
| if=<input_file> | stdin | file (or device) to read from | 
| of=<output_file> | stdout | file (or device) to write to.
sg_dd doesn't bother writing anything if <output_file> is
/dev/null or
. (period). | 
| Standard
dd options | Default | Brief
description | 
| ibs=<block_size> | same as bs | number of bytes in each block of
<input_file> | 
| iflag=<flags> | [new in sg3_utils 1.18] similar
to option found in recent GNU dd versions, see below | |
| obs=<block_size> | same as bs | number of bytes in each block of <output_file> | 
| oflag=<flags> | [new in sg3_utils 1.18] similar
to option found in recent GNU dd versions, see below | |
| seek=<n_blocks_of> | 0 | block number (origin 0) in
<output_file> to commence writing | 
| skip=<n_blocks_of> | 0 | block number (origin 0) in <input_file> 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=<n>' when "n > 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') | 
| 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 | 
| sgio | ignored | use SG_IO ioctl | ignored | access block device via SG_IO
ioctl (only supported in lk 2.6 series) | 
| extra
options in sg_dd | default | Brief
description | 
| append=0|1 | 0 | append to output file (rather
than overwrite). Better to use 'iflag=append' and/or 'oflag=append'. | 
| 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 | 128 or 32 | 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 | 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 | 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' | 
| dio=0|1 | 0 | direct IO (only via sg device
nodes) | 
| fua=0|1|2|3 | 0 | force_unit_access, 1->of, 2->if, 3->of+if . Better to use 'iflag=fua' and/or 'oflag=fua'. | 
| odir=0|1 | 0 | O_DIRECT flag on open() when set. Better to use 'iflag=direct' and/or 'oflag=direct'. | 
| sync=0|1 | 0 | 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 | when set print elapsed time and
throughput calculation at the completion of the copy | 
| verbose=<n> | 0 | larger <n> 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: 29th May 2006