Skip to content

Commit de30b43

Browse files
committed
doco: improve sg_format.8 examples; other cleanups
git-svn-id: svn://localhost/trunk@438 6180dd3e-e324-4e3e-922d-17de1ae2f315
1 parent 9a25bdf commit de30b43

33 files changed

+134
-64
lines changed

COPYING

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ The author's intention is that the (Free-) BSD licensed code can be used
2727
freely by others. On Debian systems, the complete text of the BSD License
2828
can be found in `/usr/share/common-licenses/BSD'.
2929

30-
Doug Gilbert
30+
Douglas Gilbert
3131
4th January 2009

COVERAGE

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,5 @@ SMART READ DATA examples/sg_sat_smart_rd_data
9595
(3) this command was known as SET DEVICE IDENTIFIER prior to spc4r07
9696

9797

98-
Doug Gilbert
98+
Douglas Gilbert
9999
21st June 2011

CREDITS

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,5 @@ Trent Piepho <xyzzy at speakeasy dot org> print out some "sense key specific"
104104
data and "-6" switch for sg_modes
105105

106106

107-
Doug Gilbert
107+
Douglas Gilbert
108108
18th May 2011

ChangeLog

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Each utility has its own version number, date of last change and
22
some description at the top of its ".c" file. All utilities in the main
33
directory have their own "man" pages. There is also a sg3_utils man page.
44

5-
Changelog for sg3_utils-1.34 [20120125] [svn: r437]
5+
Changelog for sg3_utils-1.34 [20120210] [svn: r438]
66
- sg_pt_linux: expand DID_ (host_byte) codes
77

88
Changelog for sg3_utils-1.33 [20120118] [svn: r435]

README

+1-1
Original file line numberDiff line numberDiff line change
@@ -369,5 +369,5 @@ Other SCSI and storage tools
369369
See http://sg.danny.cz/sg/tools.html
370370

371371

372-
Doug Gilbert
372+
Douglas Gilbert
373373
19th January 2012

README.freebsd

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,5 @@ utilities.
133133

134134

135135

136-
Doug Gilbert
136+
Douglas Gilbert
137137
17th January 2012

README.sg_start

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ Postscript
3434
sg_start has been reworked to allow a block device (e.g. /dev/sda) in
3535
addition to the sg device name (e.g. /dev/sg0) in the lk 2.6 series.
3636
sg_start now has more command line options, see its man page.
37-
Doug Gilbert <dgilbert at interlog dot com> 2004/5/8
37+
38+
Douglas Gilbert <dgilbert at interlog dot com> 2004/5/8

README.solaris

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,5 @@ present (perhaps externally or within a HBA) then that would allow SATA
135135
disks to accept SCSI commands including the SCSI ATA PASS THROUGH commands.
136136

137137

138-
Doug Gilbert
138+
Douglas Gilbert
139139
21st June 2011

README.tru64

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,5 @@ function "getopt_long()" has been placed in the "getopt_long"
9292
subdirectory. Currently only the Tru64 port uses it.
9393

9494

95-
Doug Gilbert
95+
Douglas Gilbert
9696
21st June 2011

README.win32

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ Linux idiosyncrasies to be easily ported. A new package called 'ddpt'
99
contains a utility with similar functionality to sg_dd and is available
1010
for Windows.
1111

12+
The Windows port uses the Microsoft SCSI Pass Through (SPT) interface.
13+
It has two variants: "SPT" where data is double buffered; and "SPTD"
14+
where data pointers to the user space are passed to the OS. Only Windows
15+
2000 and later (i.e. not 95, 98 or ME) support SPT.
16+
1217
Two build environments are catered for: cygwin (see www.cygwin.com) and
1318
MinGW ("Minimalist GNU for Windows", see www.mingw.org). Both are based in
1419
the gcc compiler (although other C compilers should have little problem with
@@ -209,5 +214,5 @@ problem by changing what it knows to be binary output files to "binary
209214
mode" with the setmode() Windows command.
210215

211216

212-
Doug Gilbert
213-
21st June 2011
217+
Douglas Gilbert
218+
4th February 2012

debian/changelog

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,43 @@ sg3-utils (1.34-0.1) unstable; urgency=low
22

33
* New upstream version
44

5-
-- Doug Gilbert <[email protected]> Thu, 19 Jan 2012 18:00:00 -0500
5+
-- Douglas Gilbert <[email protected]> Thu, 19 Jan 2012 18:00:00 -0500
66

77
sg3-utils (1.33-0.1) unstable; urgency=low
88

99
* New upstream version
1010

11-
-- Doug Gilbert <[email protected]> Wed, 18 Jan 2012 14:00:00 -0500
11+
-- Douglas Gilbert <[email protected]> Wed, 18 Jan 2012 14:00:00 -0500
1212

1313
sg3-utils (1.32-0.1) unstable; urgency=low
1414

1515
* New upstream version
1616

17-
-- Doug Gilbert <[email protected]> Wed, 22 Jun 2011 16:00:00 -0400
17+
-- Douglas Gilbert <[email protected]> Wed, 22 Jun 2011 16:00:00 -0400
1818

1919
sg3-utils (1.31-0.1) unstable; urgency=low
2020

2121
* New upstream version
2222

23-
-- Doug Gilbert <[email protected]> Wed, 16 Feb 2011 16:00:00 -0500
23+
-- Douglas Gilbert <[email protected]> Wed, 16 Feb 2011 16:00:00 -0500
2424

2525
sg3-utils (1.30-0.1) unstable; urgency=low
2626

2727
* New upstream version
2828

29-
-- Doug Gilbert <[email protected]> Fri, 05 Nov 2010 10:30:00 -0400
29+
-- Douglas Gilbert <[email protected]> Fri, 05 Nov 2010 10:30:00 -0400
3030

3131
sg3-utils (1.29-0.1) unstable; urgency=low
3232

3333
* New upstream version
3434

35-
-- Doug Gilbert <[email protected]> Wed, 31 Mar 2010 23:00:00 -0400
35+
-- Douglas Gilbert <[email protected]> Wed, 31 Mar 2010 23:00:00 -0400
3636

3737
sg3-utils (1.28-0.1) unstable; urgency=low
3838

3939
* New upstream version
4040

41-
-- Doug Gilbert <[email protected]> Fri, 02 Oct 2009 00:20:00 -0400
41+
-- Douglas Gilbert <[email protected]> Fri, 02 Oct 2009 00:20:00 -0400
4242

4343
sg3-utils (1.27-0.1) unstable; urgency=low
4444

doc/README

+7-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ http://sg.danny.cz/sg/sg_dd.html
1212
- discussion and examples of the sg_dd utility which is a dd variant
1313
(also discusses the sgm_dd, sgp_dd and sg_read utilities)
1414

15+
http://sg.danny.cz/sg/sg_ses.html
16+
- discussion and examples of the sg_ses utility. SCSI Enclosure
17+
Services (SES) devices may contain a lot of information,
18+
structured in a non-trivial way.
19+
1520
http://sg.danny.cz/sg/sg_io.html
1621
- discussion of Linux SG_IO ioctl (SCSI pass-through)
1722

@@ -25,5 +30,5 @@ the Makefile logic (rule in Makefile.am) copying the appropriate one to
2530
sg_scan.8 . sg_scan is not supported for other ports.
2631

2732

28-
Doug Gilbert
29-
4th November 2010
33+
Douglas Gilbert
34+
10th February 2010

doc/sg_dd.8

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ to exit.
457457
An additional exit status of 90 is generated if the flock flag is given
458458
and some other process holds the advisory exclusive lock.
459459
.SH AUTHORS
460-
Written by Doug Gilbert and Peter Allworth.
460+
Written by Douglas Gilbert and Peter Allworth.
461461
.SH "REPORTING BUGS"
462462
Report bugs to <dgilbert at interlog dot com>.
463463
.SH COPYRIGHT

doc/sg_format.8

+62-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH SG_FORMAT "8" "January 2012" "sg3_utils\-1.33" SG3_UTILS
1+
.TH SG_FORMAT "8" "February 2012" "sg3_utils\-1.33" SG3_UTILS
22
.SH NAME
33
sg_format \- format or resize a SCSI disk (perhaps change its block size)
44
.SH SYNOPSIS
@@ -164,8 +164,11 @@ associated with a FORMAT UNIT command to \fIPIE\fR. The default value is 0.
164164
This field first appeared in SBC\-3 revision 18.
165165
.TP
166166
\fB\-p\fR, \fB\-\-pinfo\fR
167-
The option is deprecated, use the \fI\-\-fmtpinfo=FPI\fR option instead.
168-
If used, then it sets bit 7 of byte 1 in the FORMAT UNIT cdb.
167+
this option is deprecated, use the \fI\-\-fmtpinfo=FPI\fR option instead.
168+
If used, then it sets bit 7 of byte 1 in the FORMAT UNIT cdb and that
169+
is equivalent to setting \fI\-\-fmtpinfo=2\fR. [So if \fI\-\-pinfo\fR is
170+
used (plus \fI\-\-fmtpinfo=FPI\fR and \fI\-\-pfu=PFU\fR are not given or
171+
their arguments are 0) then protection type 1 is selected.]
169172
.TP
170173
\fB\-x\fR, \fB\-\-poll\fR=\fIPT\fR
171174
where \fIPT\fR is the type of poll used. If \fIPT\fR is 0 then a TEST UNIT
@@ -251,7 +254,7 @@ information" section (section 4.21 in draft SBC\-3 rev 29). 8 bytes of
251254
protection information are added to each logical block (a 2 byte "logical
252255
block guard" (CRC), a 2 byte "logical block application guard", and a 4
253256
byte "logical block reference tag"). SBC\-3 defines 4 protection
254-
types (types 0 to 4) with protection type 0 meaning no protection information
257+
types (types 0 to 3) with protection type 0 meaning no protection information
255258
is maintained.
256259
.PP
257260
A device that supports protection information (i.e. supports one or more
@@ -266,11 +269,22 @@ Given that a device supports a particular protection type, a user can then
266269
then choose to format that disk with that protection type by setting
267270
the "FMTPINFO" and "Protection Field Usage" fields in the FORMAT UNIT
268271
command. Those fields correspond to the \fI\-\-fmtpinfo=FPI\fR and the
269-
\fI\-\-pfu=PFU\fR options in this utility. If \fIFPI\fR and \fIPFU\fR are
270-
both 0 (their default values) then protection type 0 is chosen. If \fIFPI\fR
271-
is 2 and \fIPFU\fR is 0 then protection type 1 is chosen. If \fIFPI\fR is 3
272-
and \fIPFU\fR is 0 then protection type 2 is chosen. If \fIFPI\fR is 3 and
273-
\fIPFU\fR is 1 then protection type 3 is chosen.
272+
\fI\-\-pfu=PFU\fR options in this utility. The list below shows the four
273+
protection types followed by the options of this utility needed to select
274+
them:
275+
.br
276+
\fB0\fR : \-\-fmtpinfo=0 \-\-pfu=0
277+
.br
278+
\fB1\fR : \-\-fmtpinfo=2 \-\-pfu=0
279+
.br
280+
\fB2\fR : \-\-fmtpinfo=3 \-\-pfu=0
281+
.br
282+
\fB3\fR : \-\-fmtpinfo=3 \-\-pfu=1
283+
.br
284+
The default value of \fIFPI\fR (in \fI\-\-fmtpinfo=FPI\fR) is 0 and the
285+
default value of \fIPFU\fR (in \fI\-\-pfu=PFU\fR) is 0. So if neither
286+
\fI\-\-fmtpinfo=FPI\fR nor \fI\-\-pfu=PFU\fR are given then protection
287+
type 0 (i.e. no protection information) is chosen.
274288
.SH NOTES
275289
The SBC\-2 standard states that the REQUEST SENSE command should be used
276290
for obtaining progress indication when the format command is underway.
@@ -358,42 +372,72 @@ size derived from two sources: a block descriptor in a MODE SELECT command
358372
response and from the response of a READ CAPACITY commands. No changes
359373
are made:
360374
.PP
361-
sg_format /dev/sdm
375+
# sg_format /dev/sdm
362376
.PP
363377
Now a simple format, leaving the block count and size as they were previously.
364378
The FORMAT UNIT command is executed in IMMED mode and the device is polled
365379
every 60 seconds to print out a progress indication:
366380
.PP
367-
sg_format \-\-format /dev/sdm
381+
# sg_format \-\-format /dev/sdm
368382
.PP
369383
Now the same format, but waiting (passively) until the format operation is
370384
complete:
371385
.PP
372-
sg_format \-\-format \-\-wait /dev/sdm
386+
# sg_format \-\-format \-\-wait /dev/sdm
373387
.PP
374388
Next is a format in which the block size is changed to 520 bytes and the block
375389
count is set to the manufacturer's maximum value (for that block size). Note,
376390
not all disks support changing the block size:
377391
.PP
378-
sg_format \-\-format \-\-size=520 /dev/sdm
392+
# sg_format \-\-format \-\-size=520 /dev/sdm
379393
.PP
380394
Now a resize operation so that only the first 0x10000 (65536) blocks on a disk
381395
are accessible. The remaining blocks remain unaltered.
382396
.PP
383-
sg_format \-\-resize \-\-count=0x10000 /dev/sdm
397+
# sg_format \-\-resize \-\-count=0x10000 /dev/sdm
384398
.PP
385399
Now resize the disk back to its normal (maximum) block count:
386400
.PP
387-
sg_format \-\-resize \-\-count=\-1 /dev/sdm
401+
# sg_format \-\-resize \-\-count=\-1 /dev/sdm
402+
.PP
403+
One reason to format a SCSI disk is to add protection information. First
404+
check which protection types are supported by a disk (by checking the SPT
405+
field in the Extended inquiry VPD page together with the Protect bit in the
406+
standard inquiry response):
407+
.PP
408+
# sg_vpd -p ei -l /dev/sdb
409+
.br
410+
extended INQUIRY data VPD page:
411+
.br
412+
ACTIVATE_MICROCODE=0
413+
.br
414+
SPT=1 [protection types 1 and 2 supported]
415+
.br
416+
....
388417
.PP
389418
Format with type 1 protection:
390419
.PP
391-
sg_format \-\-format \-\-fmtpinfo=2 /dev/sdm
420+
# sg_format \-\-format \-\-fmtpinfo=2 /dev/sdm
421+
.PP
422+
After a successful format with type 1 protection, READ CAPACITY(16)
423+
should show something like this:
424+
.PP
425+
# sg_readcap -l /dev/sdm
426+
.br
427+
Read Capacity results:
428+
.br
429+
Protection: prot_en=1, p_type=0, p_i_exponent=0 [type 1 protection]
430+
.br
431+
Logical block provisioning: lbpme=0, lbprz=0
432+
.br
433+
....
392434
.PP
393-
Format with type 3 protection:
435+
To format with type 3 protection:
394436
.PP
395-
sg_format \-\-format \-\-fmtpinfo=3 \-\-pfu /dev/sdm
437+
# sg_format \-\-format \-\-fmtpinfo=3 \-\-pfu=1 /dev/sdm
396438
.PP
439+
For the disk shown above this will probably fail because the Extended inquiry
440+
VPD page showed only types 1 and 2 protection are supported.
397441
.SH EXIT STATUS
398442
The exit status of sg_format is 0 when it is successful. Otherwise see
399443
the sg3_utils(8) man page. Unless the \fI\-\-wait\fR option is given, the

doc/sg_inq.8

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ can also be used to show the contents of VPD pages.
350350
Further examples of sg_inq together with some typical output can be found
351351
on http://sg.danny.cz/sg/sg3_utils.html web page.
352352
.SH AUTHOR
353-
Written by Doug Gilbert
353+
Written by Douglas Gilbert
354354
.SH "REPORTING BUGS"
355355
Report bugs to <dgilbert at interlog dot com>.
356356
.SH COPYRIGHT

doc/sg_logs.8

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ print out version string then exit.
334334
\fB\-?\fR
335335
output usage message then exit.
336336
.SH AUTHOR
337-
Written by Doug Gilbert
337+
Written by Douglas Gilbert
338338
.SH "REPORTING BUGS"
339339
Report bugs to <dgilbert at interlog dot com>.
340340
.SH COPYRIGHT

doc/sg_map.8

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ By process of elimination /dev/sg3 must be the scanner.
155155
The exit status of sg_map is 0 when it is successful. Otherwise see
156156
the sg3_utils(8) man page.
157157
.SH AUTHOR
158-
Written by Doug Gilbert
158+
Written by Douglas Gilbert
159159
.SH "REPORTING BUGS"
160160
Report bugs to <dgilbert at interlog dot com>.
161161
.SH COPYRIGHT

doc/sg_modes.8

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ print out version string then exit.
262262
\fB\-?\fR
263263
output usage message then exit. Ignore all other parameters.
264264
.SH AUTHOR
265-
Written by Doug Gilbert
265+
Written by Douglas Gilbert
266266
.SH "REPORTING BUGS"
267267
Report bugs to <dgilbert at interlog dot com>.
268268
.SH COPYRIGHT

doc/sg_opcodes.8

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ Task Management Functions supported by device:
223223
Query task
224224
.br
225225
.SH AUTHOR
226-
Written by Doug Gilbert
226+
Written by Douglas Gilbert
227227
.SH "REPORTING BUGS"
228228
Report bugs to <dgilbert at interlog dot com>.
229229
.SH COPYRIGHT

doc/sg_persist.8

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ The above sequence of commands was tested successfully on a Seagate Savvio
388388
The exit status of sg_persist is 0 when it is successful. Otherwise see
389389
the sg3_utils(8) man page.
390390
.SH AUTHOR
391-
Written by Doug Gilbert
391+
Written by Douglas Gilbert
392392
.SH "REPORTING BUGS"
393393
Report bugs to <dgilbert at interlog dot com>.
394394
.SH COPYRIGHT

doc/sg_rbuf.8

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ increase level of verbosity. Can be used multiple times.
166166
\fB\-V\fR
167167
print out version string then exit.
168168
.SH AUTHOR
169-
Written by Doug Gilbert
169+
Written by Douglas Gilbert
170170
.SH "REPORTING BUGS"
171171
Report bugs to <dgilbert at interlog dot com>.
172172
.SH COPYRIGHT

doc/sg_read.8

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ output of third command will look like this:
167167
The exit status of sg_read is 0 when it is successful. Otherwise see
168168
the sg3_utils(8) man page.
169169
.SH AUTHORS
170-
Written by Doug Gilbert.
170+
Written by Douglas Gilbert.
171171
.SH "REPORTING BUGS"
172172
Report bugs to <dgilbert at interlog dot com>.
173173
.SH COPYRIGHT

doc/sg_sat_identify.8

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ USB mass storage limited sense data to 18 bytes which made the
104104
The exit status of sg_sat_identify is 0 when it is successful. Otherwise
105105
see the sg3_utils(8) man page.
106106
.SH AUTHOR
107-
Written by Doug Gilbert
107+
Written by Douglas Gilbert
108108
.SH "REPORTING BUGS"
109109
Report bugs to <dgilbert at interlog dot com>.
110110
.SH COPYRIGHT

doc/sg_sat_phy_event.8

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ USB mass storage limited sense data to 18 bytes which made the
9696
The exit status of sg_sat_identify is 0 when it is successful. Otherwise
9797
see the sg3_utils(8) man page.
9898
.SH AUTHOR
99-
Written by Doug Gilbert
99+
Written by Douglas Gilbert
100100
.SH "REPORTING BUGS"
101101
Report bugs to <dgilbert at interlog dot com>.
102102
.SH COPYRIGHT

0 commit comments

Comments
 (0)