1- .TH SG_FORMAT "8" "February 2016" "sg3_utils\- 1.42 " SG3_UTILS
1+ .TH SG_FORMAT "8" "February 2016" "sg3_utils\- 1.43 " SG3_UTILS
22.SH NAME
33sg_format \- format, resize a SCSI disk or format a tape
44.SH SYNOPSIS
@@ -9,7 +9,8 @@ sg_format \- format, resize a SCSI disk or format a tape
99[\fI \-\- mode=MP \fR ] [\fI \-\- pfu=PFU \fR ] [\fI \-\- pie=PIE \fR ] [\fI \-\- pinfo \fR ]
1010[\fI \-\- poll=PT \fR ] [\fI \-\- resize \fR ] [\fI \-\- rto_req \fR ]
1111[\fI \-\- security \fR ] [\fI \-\- six \fR ] [\fI \-\- size=SIZE \fR ] [\fI \-\- tape=FM \fR ]
12- [\fI \-\- verbose \fR ] [\fI \-\- verify \fR ] [\fI \-\- version \fR ] [\fI \-\- wait \fR ]
12+ [\fI \-\- timeout=SEC \fR ] [\fI \-\- verbose \fR ] [\fI \-\- verify \fR ]
13+ [\fI \-\- version \fR ] [\fI \-\- wait \fR ]
1314\fI DEVICE \fR
1415.SH DESCRIPTION
1516.\" Add any additional description here
@@ -266,6 +267,18 @@ set to \fIFM\fR. This option is used to prepare a tape (i.e. the "medium")
266267in a tape drive for use. Values for \fI FM \fR include 0 to do the "default"
267268format; 1 to partition a volume and 2 to do a default format then partition.
268269.TP
270+ \fB \- m \fR , \fB \-\- timeout \fR =\fI SEC \fR
271+ where \fI SEC \fR is the FORMAT UNIT or FORMAT MEDIUM command timeout in
272+ seconds. \fI SEC \fR will only be used if it exceeds the internal timeout
273+ which is 20 seconds if the IMMED bit is set and 72000 seconds (20 hours)
274+ if the IMMED bit is not set. If the timeout is exceeded then the
275+ operating system will typically abort the command. Aborting a command
276+ may escalate to a LUN reset (or worse). A timeout may also leave
277+ the disk or tape format operation incomplete. And that may result in the
278+ disk or tape being in a "format corrupt" state requiring another format
279+ to remedy the situation. So for various reasons timeouts are best
280+ avoided.
281+ .TP
269282\fB \- v \fR , \fB \-\- verbose \fR
270283increase the level of verbosity, (i.e. debug output). "\- vvv" gives
271284a lot more debug output.
@@ -280,12 +293,10 @@ print the version string and then exit.
280293\fB \- w \fR , \fB \-\- wait \fR
281294the default format action is to set the "IMMED" bit in the FORMAT UNIT
282295command's (short) parameter header. If this option (i.e. \fI \-\- wait \fR ) is
283- given then the "IMMED" bit is not set. If \fI \-\- wait \fR is given the
284- FORMAT UNIT command waits until the format operation completes before
285- returning its response. This can be many hours on large disks. This
286- utility sets a 15 hour timeout on such a FORMAT UNIT command! Some recent
287- SSDs go to the other extreme of completing a format operation in 1.5
288- seconds hence waiting is not an issue.
296+ given then the "IMMED" bit is not set. If \fI \-\- wait \fR is given then the
297+ FORMAT UNIT or FORMAT MEDIUM command waits until the format operation
298+ completes before returning its response. This can be many hours on large
299+ disks. See the \fI \-\- timeout=SEC \fR option.
289300.SH LISTS
290301The SBC\- 3 draft (revision 36) defines PLIST, CLIST, DLIST and GLIST in
291302section 4.13 on "Medium defects". Briefly, the PLIST is the "primary"
@@ -381,15 +392,18 @@ can be terminated (e.g. with control\-C) without affecting the format
381392operation which continues. However a target or device reset (or a power
382393cycle) will probably cause the device to become "format corrupt".
383394.PP
384- When the \fI \-\- format \fR and \fI \-\- wait \fR options are both given then
385- this utility may take a long time to return. In this case care should be
386- taken not to send any other SCSI commands to the disk as it may not respond
387- leaving those commands queued behind the active format command. This may
388- cause a timeout in the OS driver (in a lot shorter period than 15 hours
389- applicable to some format operations). This may result in the OS resetting
390- the disk leaving the format operation incomplete. This may leave the
391- disk in a "format corrupt" state requiring another format to remedy
392- the situation.
395+ When the \fI \-\- format \fR (or \fI \-\- tape \fR ) and \fI \-\- wait \fR options are
396+ both given then this utility may take a long time to return. In this case
397+ care should be taken not to send any other SCSI commands to the disk as it
398+ may not respond leaving those commands queued behind the active format
399+ command. This may cause a timeout in the OS driver (in a lot shorter period
400+ than 20 hours applicable to some format operations). This may result in the
401+ OS resetting the disk leaving the format operation incomplete. This may leave
402+ the disk in a "format corrupt" state requiring another format to remedy
403+ the situation. Modern SCSI devices should yield a "not ready" sense key
404+ with an additional sense indicating a format is in progress. With older
405+ devices the user should take precautions that nothing attempts to access
406+ a device while it is being formatted.
393407.PP
394408When the block size (i.e. the number of bytes in each block) is changed
395409on a disk two SCSI commands must be sent: a MODE SELECT to change the block
0 commit comments