File: scsiformat.8

package info (click to toggle)
scsitools 0.12-2.3
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,200 kB
  • ctags: 820
  • sloc: ansic: 6,043; tcl: 2,144; sh: 923; makefile: 132
file content (315 lines) | stat: -rw-r--r-- 8,155 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
.TH scsiformat 8 "23 August 1997" "scsiinfo 1.7" "Scsiinfo User's Guide"
.SH NAME
scsiformat \- low level format an scsi disk device
.SH SYNOPSIS
.BI "scsiformat [-" "options..." "] " device
.SH DESCRIPTION
Low level formats the SCSI device identified by the scsi disk or generic scsi device node
.IR device .
You must be root to perform this operation.
.B scsiformat
will ask a simple question to get your confirmation and check if partitions on
.I device
are still mounted. Possible swap spaces on
.I device
are
.BR swapoff (8)'ed
prior to formatting.

During formatting a file like
.I /tmp/scsiformat.xx:xx:xx:xx:xxxxxxxx
is used to hold some status information.

.SH OPTIONS
.B scsiformat
supports the following option switches:

.SS a) Controlling a/synchronous operation
.TP
.BI "-b " n
block during the format operation. This makes any display of
real progress indicators impossible. However, cheesy SCSI
devices	will need it. Scsiformat assumes that the operation
will need about
.I n
seconds and provides some progress indication
according to that.
.B -b0
does not print any process indication, just sits and blocks until
formatting completes.
.IP
Read the
.B BUGS
section below!

.TP
.B -T
just check for a running format command and output statistics.
A file
.I /tmp/scsiformat.*
is used to hold the starting time of
the format operation. If formatting completed, this file is
removed by the formatting
.B scsiformat
call (which forks of a child just for this purpose).
The exit state of
.B scsiformat
is true as long as the format operation is still in progress. A left over
.I /tmp/scsiformat.*
file will make scsiformat think a program still runs. It will not accept
and remove files older than 48h nevertheless.

.TP
.BI "-t " n
check progress every
.I n
seconds (default is 5).
.B -t0
makes scsiformat return without displaying progress.

.SS b) Interleave factor
.TP
.BI "-i " n
sets the sector interleave factor to be used. Usually you
should stick with the default
.B -i0
which selects a vendor specific default.

.SS c) Initialisation pattern
By default the target will initialise the formatted sectors with a vendor
specific test pattern.

.TP
.BI "-I" " sequence of bytes in hex"
the bytes given in hex characters are repeated and used to init all
blocks on the device.

.TP
.B -L
The first four bytes of each logical block are set to the number of the logical block.
.TP
.B -P
The first four bytes of each physical block are set to the number of logical block,
it will occur in.

.SS c) Defect management

.TP
.B -e
Erase the grown defect list prior to formatting. You can issue new defects for the
grown defect list nevertheless and media certification may add defects too.

.TP
.B -p
Ignore the vendor's primary defect list. This is not recommended as the vendor probably
had a reason to specify these primary defects.

.TP
.B -c
Do not perform a media surface certification. This may speed up formatting but is
also not recommended.

.TP
.B -s
Stop when unable to access primary or grown defects due to some internal error in the
target device. When not given, formatting continues but returns a recovered error upon
completion. (Which is probably not well supported by
.BR scsiformat ).

.TP
.B -S
Erase MODE SELECT settings stored in NVRAM. These are those you can set with
.BR scsiinfo "(8) or " scsi-config (8).

.TP
.BI "-d " int ", ..."
A comma separated list of logical blocks to mark as defect. Using this defect format
is discouraged as there no clear concept of what a logical block is here because the
format command may move around logical blocks and change the number of available blocks.

The number can be preceded by
.BR 0 " or " 0x
for octal or hexadecimal notation.

.TP
.BI "-D " int ":" int ":" int ", ..."
A comma separated list of expressions of the form
.B C:H:S
specifying a defect at physical location Cylinder:Head:Sector. A Sector
.B S
of
.B -1
marks the whole track as bad.

The number can be preceded by
.BR 0 " or " 0x
for octal or hexadecimal notation.

.TP
.BI "-B " int ":" int ":" int ", ..."
A comma separated list of expressions of the from
.B C:H:B
specifying defects at Cylinder:Head:Bytes from Index. Again, a Bytes from Index
value
.B B
of
.B -1
marks the whole track as bad.

The number can be preceded by
.BR 0 " or " 0x
for octal or hexadecimal notation.
.PP

You can specify more than one of the
.BR -d ", " -D ", " -B
options but you must stick to one defect format!

.SS d) Simple partitioning
For your convenience,
.B scsiformat
allow to preset the partition table in a simple way which often suffices for removable medias.
This is not intended as a replacement for
.BR fdisk (8)
though.

.TP
.BI "-f " arg
perform simple partitioning.
.B -fdos
sets up begin and start of the partition on cylinder boundaries.
.B -ftight
does use as much of the disk as possible (but may confuse OS's other than Linux).

If you do not specify
.B -f
at all,
.B scsiformat
will not initialise the partition table. As it has to tell the
kernel that the disk was reformatted and the kernel will try to
to read the partition table, you are like to get some kernel
warnings then.

.TP
.BI "-G " heads x sectors
set the disk geometry (Heads x Sectors) as DOS will see it
for use in the partition table. If you don't specify it,
scsiformat will ask the kernel what it thinks DOS will get from
the adapters BIOS. This call might fail or return bogus data
though. A wrong setting will not affect linux, but other OS's
and esp. DOS and the BIOS (for booting).

.TP
.BI "-y " type
set the type for the partition to set.
.I type
is a two digit hex number. See
.BR fdisk (8), command
.B t for a list. Defaults to
.B 83
(Linux native).

.TP
.BI "-M " size
Create a primary partition number 1 of maximal size
.IR size MB.
When
.I size
is
.BR 0 ,
no partition is created, and thus the partition table is
simply initialised to be valid (but empty). If the size
exceeds the disk capacity, a partition as large as possible is
made. Defaults to
.BR 99999 .

.SS e) Miscellaneous
.TP
.B -H
print some command line help to stdout.
.TP
.B -v
print version information.

.TP
.BI "-F " arg
forced operation, do not ask prior to format.
.I arg
must be
.B 'Ene\ Mene\ Meck,\ und\ Du\ bist\ weg!'
with proper spaces and capitalisation. (this is a German child rhyme
kissing someone goodbye...)

.TP
.B -V
print some debugging information.

.TP
.B -X
all output is printed in numerics, useful for GUI interfaces like
.BR tk_scsiformat (8).
Also makes all operations non blocking. (By forking of a child process for those scsi
operations which would block).

.TP
.B -o
The settings of the flags
.BR -c ", " -p ", " -s ", " -S ", " -I ", " -L ", " -P
are obeyed.  If you specify one of these,
.B -o
is silently added. Without
.B -o
or one of these flags some factory default is used.
Specifying
.B -o
explicitly will allow you to not use any of these options which might not be
the default chosen by the target device otherwise.

.SH RETURN CODES
Apart from the codes returned by the
.B -T
flag,
.B scsiformat
will generally return 1 for system errors, 2 for user errors, and 0 for successful operation.

.SH BUGS
Old status files in 
.I /tmp
will confuse the
.B -T
option. However, they are removed after 48 hours.

I was unable to get hold of a disk supporting querying the progress status (and which I could
stand to lose all data on). Therefore I commented out the support for this from the
source code using a
.BR BLOCKING_ONLY #define.
You are welcome to try and make this work.

Restrictions of the
.B SCSI_IOCTL_SEND_COMMAND
.BR ioctl (2)
call for the
.BR sd (4)
device make it impossible to issue a
.B FORMAT_UNIT
command with more than 4096 bytes of arguments. This could be avoided by using the proper
generic scsi device
.I /dev/sg*
instead, at least where the kernel is compiled to support it. Most of the time this is not needed
though and thus I'm myself to lazy to do it.
.SH FILES
.I /tmp/scsiformat.xx:xx:xx:xx:xxxxxxxx
.br
.I /dev/sd*
.br
.I /dev/sg*

.SH SEE ALSO
.BR tk_scsiformat (8),
.BR scsiinfo (8),
.BR scsi-config (8),
.BR fdisk (8),
.BR sd (4).

.SH AUTHOR
Michael Weller <eowmob@exp-math.uni-essen.de>