aboutsummaryrefslogtreecommitdiff
path: root/sg_dd.8
diff options
context:
space:
mode:
Diffstat (limited to 'sg_dd.8')
-rw-r--r--sg_dd.844
1 files changed, 35 insertions, 9 deletions
diff --git a/sg_dd.8 b/sg_dd.8
index b4a2107d..cedd447d 100644
--- a/sg_dd.8
+++ b/sg_dd.8
@@ -1,6 +1,6 @@
-.TH SG_DD "8" "September 2001" "sg3_utils-0.95" SG3_UTILS
+.TH SG_DD "8" "February 2002" "sg3_utils-0.98" SG3_UTILS
.SH NAME
-copies data to and from sg and raw devices
+sg_dd \- copies data to and from sg and raw devices
.SH SYNOPSIS
.B sg_dd
[\fIOPTION\fR]...
@@ -25,6 +25,10 @@ which permits "bs" to be an integral multiple. Default is 512 which
is usually correct for disks but incorrect for cdroms (which normally
have 2048 byte blocks).
.TP
+cdbsz=6 | 10 | 12 | 16
+size of SCSI READ and/or WRITE commands issued on sg device names.
+Default is 10 byte SCSI command blocks
+.TP
count=BLOCKS
copy this number of blocks. Default is minimum number that sg devices
return from READ CAPACITY (if that works) or 0
@@ -35,6 +39,10 @@ IO which, if not available, falls back to indirect IO and notes this
at completion. If direct IO is selected and /proc/scsi/sg/allow_dio
has the value of 0 then a warning is issued (and indirect IO is performed)
.TP
+gen=0 | 1
+the default action (when "gen=0") is to require that either "if" or "of"
+is a sg or raw device name. To remove this restriction set "gen=1"
+.TP
ibs=BYTES
if given must be the same as bs
.TP
@@ -52,14 +60,22 @@ skip BLOCKS bs-sized blocks at start of output
.TP
skip=BLOCKS
skip BLOCKS bs-sized blocks at start of input
+.TP
+time=0 | 1
+when 1, times transfer and does throughput calculation, outputting the
+results (to stderr) at completion. When 0 (default) doesn't perform timing
+.TP
+--version
+outputs version number information and exits
.PP
-Either the input file or the output file must be a sg or raw device.
+Either the input file or the output file must be a sg or raw device,
+unless "gen=1".
A raw device must be bound to a block device prior to using sg_dd.
See
.B raw(8)
for more information about binding raw devices. To be safe, the sg device
-mapping to SCSI block devices should be checked with "cat /proc/scsi/scsi"
-before use.
+mapping to SCSI block devices should be checked with "cat /proc/scsi/scsi",
+or sg_map before use.
.PP
The count is only deduced for sg devices (minimum > 0 if both input and
output are sg devices) otherwise it defaults to 0. This is for safety!
@@ -77,10 +93,11 @@ this data into user memory (write operations reverse this sequence).
This is called "indirect IO" and there is a "dio" option to select
"direct IO" which will DMA directly into user memory. Due to some
issues "direct IO" is disabled in the sg driver and needs a
-configuration change to activate it.
+configuration change to activate it. This is typically done with
+"echo 1 > /proc/scsi/sg/allow_dio".
.PP
All informative, warning and error output is sent to stderr so that
-dd\'s output file can be stdout and remain unpolluted. If no options
+dd's output file can be stdout and remain unpolluted. If no options
are given, then the usage message is output and nothing else happens.
.SH EXAMPLES
.PP
@@ -95,7 +112,7 @@ equivalent to:
.PP
dd if=/dev/sda of=t bs=512 count=1000000
.PP
-although dd\'s speed may improve if bs was larger and count was suitably
+although dd's speed may improve if bs was larger and count was suitably
reduced. Using a raw device to do something similar on a IDE disk:
.PP
raw /dev/raw/raw1 /dev/hda
@@ -112,6 +129,15 @@ This assumes a valid partition is found on the SCSI disk at the given
skip block address (past the 5 GB point of that disk) and that
the partition goes to the end of the SCSI disk. An explicit count
is probably a safer option.
+.PP
+To time a streaming read of the first 1 GB on a disk this command
+could be used:
+.PP
+ sg_dd if=/dev/sg0 of=/dev/null bs=512 count=2m time=1
+.PP
+On completion this will output a line like:
+"time to transfer data was 26.020794 secs, 41.26 MB/sec". The "MB/sec"
+in this case is 1,000,000 bytes per second.
.SH NOTE
For sg devices this command issues READ_10 and WRITE_10 SCSI commands which
are appropriate for disks and CDROM players. Those commands are not
@@ -128,7 +154,7 @@ Written by Doug Gilbert and Peter Allworth.
.SH "REPORTING BUGS"
Report bugs to <dgilbert@interlog.com>.
.SH COPYRIGHT
-Copyright \(co 2000, 2001 Douglas Gilbert
+Copyright \(co 2000-2002 Douglas Gilbert
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.