aboutsummaryrefslogtreecommitdiff
path: root/doc/sg_write_same.8
diff options
context:
space:
mode:
Diffstat (limited to 'doc/sg_write_same.8')
-rw-r--r--doc/sg_write_same.831
1 files changed, 27 insertions, 4 deletions
diff --git a/doc/sg_write_same.8 b/doc/sg_write_same.8
index 01edfa07..019f1562 100644
--- a/doc/sg_write_same.8
+++ b/doc/sg_write_same.8
@@ -1,4 +1,4 @@
-.TH SG_WRITE_SAME "8" "January 2011" "sg3_utils\-1.31" SG3_UTILS
+.TH SG_WRITE_SAME "8" "May 2011" "sg3_utils\-1.32" SG3_UTILS
.SH NAME
sg_write_same \- send the SCSI WRITE SAME command
.SH SYNOPSIS
@@ -15,8 +15,8 @@ Send the SCSI WRITE SAME (10, 16 or 32 byte) command to \fIDEVICE\fR. This
command writes the given block \fINUM\fR times to consecutive blocks on
the \fIDEVICE\fR starting at logical block address \fILBA\fR.
.PP
-The length of the block to be written multiple times is obtained from
-the \fILEN\fR argument, the length of the given input file \fIIF\fR,
+The length of the block to be written multiple times is obtained from either
+the \fILEN\fR argument, or the length of the given input file \fIIF\fR,
or by calling READ CAPACITY(16) on \fIDEVICE\fR. The contents of the
block to be written are obtained from the input file \fIIF\fR or
zeroes are used. If READ CAPACITY(16) is called (which implies \fIIF\fR
@@ -182,12 +182,35 @@ in the sg3_utils(8) man page.
.SH EXIT STATUS
The exit status of sg_write_same is 0 when it is successful. Otherwise see
the sg3_utils(8) man page.
+.SH EXAMPLES
+One simple usage is to write blocks of zero from (and including) a given LBA:
+.PP
+ sg_write_same \-\-lba=0x1234 \-\-num=63 /dev/sdc
+.PP
+Since \fI\-\-xferlen=LEN\fR has not been given, then this utility will
+call the READ CAPACITY command on /dev/sdc to determine the number
+of bytes in a logical block. Let us assume that is 512 bytes. Since
+\fI\-\-in=IF\fR is not given a block of zeroes is assumed. So 63 blocks
+of zeroes (each block containing 512 bytes) will be written from (and
+including) LBA 0x1234 . Note that only one block of zeroes is passed
+to the SCSI WRITE SAME command in the data out buffer (as required by
+SBC\-3).
+.PP
+A similar example follows but in this case the blocks
+are "unmapped" ("trimmed" in ATA speak) rather than zeroed:
+.PP
+ sg_write_same \-\-unmap \-L 0x1234 \-n 63 /dev/sdc
+.PP
+Note that if the LBPRZ bit in the READ CAPACITY(16) response is set (i.e.
+LPPRZ is an acronym for logical block provisioning read zeroes) then these
+two examples do the same thing, at least seen from the point of view of
+subsequent reads.
.SH AUTHORS
Written by Douglas Gilbert.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2009\-2010 Douglas Gilbert
+Copyright \(co 2009\-2011 Douglas Gilbert
.br
This software is distributed under a FreeBSD license. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.