xref: /freebsd/sbin/camcontrol/camcontrol.8 (revision 80976615e3207fbb987d41c744a4d519dc0b09d0)
1525689f1SJustin T. Gibbs.\"
2f553b7b3SKenneth D. Merry.\" Copyright (c) 1998, 1999, 2000, 2002, 2005, 2006, 2007 Kenneth D. Merry.
3525689f1SJustin T. Gibbs.\" All rights reserved.
4525689f1SJustin T. Gibbs.\"
5525689f1SJustin T. Gibbs.\" Redistribution and use in source and binary forms, with or without
6525689f1SJustin T. Gibbs.\" modification, are permitted provided that the following conditions
7525689f1SJustin T. Gibbs.\" are met:
8525689f1SJustin T. Gibbs.\" 1. Redistributions of source code must retain the above copyright
9525689f1SJustin T. Gibbs.\"    notice, this list of conditions and the following disclaimer.
10525689f1SJustin T. Gibbs.\" 2. Redistributions in binary form must reproduce the above copyright
11525689f1SJustin T. Gibbs.\"    notice, this list of conditions and the following disclaimer in the
12525689f1SJustin T. Gibbs.\"    documentation and/or other materials provided with the distribution.
13525689f1SJustin T. Gibbs.\" 3. The name of the author may not be used to endorse or promote products
14525689f1SJustin T. Gibbs.\"    derived from this software without specific prior written permission.
15525689f1SJustin T. Gibbs.\"
16525689f1SJustin T. Gibbs.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17525689f1SJustin T. Gibbs.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18525689f1SJustin T. Gibbs.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19525689f1SJustin T. Gibbs.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20525689f1SJustin T. Gibbs.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21525689f1SJustin T. Gibbs.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22525689f1SJustin T. Gibbs.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23525689f1SJustin T. Gibbs.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24525689f1SJustin T. Gibbs.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25525689f1SJustin T. Gibbs.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26525689f1SJustin T. Gibbs.\" SUCH DAMAGE.
27525689f1SJustin T. Gibbs.\"
287f3dea24SPeter Wemm.\" $FreeBSD$
29525689f1SJustin T. Gibbs.\"
3080976615SAlexander Motin.Dd September 4, 2009
31525689f1SJustin T. Gibbs.Dt CAMCONTROL 8
3233fab22eSKenneth D. Merry.Os
33525689f1SJustin T. Gibbs.Sh NAME
34525689f1SJustin T. Gibbs.Nm camcontrol
35525689f1SJustin T. Gibbs.Nd CAM control program
36525689f1SJustin T. Gibbs.Sh SYNOPSIS
377c7fb079SRuslan Ermilov.Nm
3833fab22eSKenneth D. Merry.Aq Ar command
39c60e19a8SKenneth D. Merry.Op device id
40525689f1SJustin T. Gibbs.Op generic args
41525689f1SJustin T. Gibbs.Op command args
427c7fb079SRuslan Ermilov.Nm
4333fab22eSKenneth D. Merry.Ic devlist
44525689f1SJustin T. Gibbs.Op Fl v
457c7fb079SRuslan Ermilov.Nm
4633fab22eSKenneth D. Merry.Ic periphlist
47c60e19a8SKenneth D. Merry.Op device id
48525689f1SJustin T. Gibbs.Op Fl n Ar dev_name
49525689f1SJustin T. Gibbs.Op Fl u Ar unit_number
507c7fb079SRuslan Ermilov.Nm
5133fab22eSKenneth D. Merry.Ic tur
52c60e19a8SKenneth D. Merry.Op device id
53525689f1SJustin T. Gibbs.Op generic args
547c7fb079SRuslan Ermilov.Nm
5533fab22eSKenneth D. Merry.Ic inquiry
56c60e19a8SKenneth D. Merry.Op device id
57525689f1SJustin T. Gibbs.Op generic args
58525689f1SJustin T. Gibbs.Op Fl D
59525689f1SJustin T. Gibbs.Op Fl S
60525689f1SJustin T. Gibbs.Op Fl R
617c7fb079SRuslan Ermilov.Nm
6252c9ce25SScott Long.Ic identify
6352c9ce25SScott Long.Op device id
6452c9ce25SScott Long.Op generic args
6552c9ce25SScott Long.Nm
6642cb6a80SKenneth D. Merry.Ic reportluns
6742cb6a80SKenneth D. Merry.Op device id
6842cb6a80SKenneth D. Merry.Op generic args
6942cb6a80SKenneth D. Merry.Op Fl c
7042cb6a80SKenneth D. Merry.Op Fl l
7142cb6a80SKenneth D. Merry.Op Fl r Ar reporttype
7242cb6a80SKenneth D. Merry.Nm
73f553b7b3SKenneth D. Merry.Ic readcap
74f553b7b3SKenneth D. Merry.Op device id
75f553b7b3SKenneth D. Merry.Op generic args
76f553b7b3SKenneth D. Merry.Op Fl b
77f553b7b3SKenneth D. Merry.Op Fl h
78f553b7b3SKenneth D. Merry.Op Fl H
79f553b7b3SKenneth D. Merry.Op Fl N
80f553b7b3SKenneth D. Merry.Op Fl q
81f553b7b3SKenneth D. Merry.Op Fl s
82f553b7b3SKenneth D. Merry.Nm
8333fab22eSKenneth D. Merry.Ic start
84c60e19a8SKenneth D. Merry.Op device id
85525689f1SJustin T. Gibbs.Op generic args
867c7fb079SRuslan Ermilov.Nm
8733fab22eSKenneth D. Merry.Ic stop
88c60e19a8SKenneth D. Merry.Op device id
89525689f1SJustin T. Gibbs.Op generic args
907c7fb079SRuslan Ermilov.Nm
91f9cecca2SMatthew N. Dodd.Ic load
92f9cecca2SMatthew N. Dodd.Op device id
93f9cecca2SMatthew N. Dodd.Op generic args
94f9cecca2SMatthew N. Dodd.Nm
9533fab22eSKenneth D. Merry.Ic eject
96c60e19a8SKenneth D. Merry.Op device id
97525689f1SJustin T. Gibbs.Op generic args
987c7fb079SRuslan Ermilov.Nm
9933fab22eSKenneth D. Merry.Ic rescan
1005710d224SKenneth D. Merry.Aq all | bus Ns Op :target:lun
1017c7fb079SRuslan Ermilov.Nm
10233fab22eSKenneth D. Merry.Ic reset
1035710d224SKenneth D. Merry.Aq all | bus Ns Op :target:lun
1047c7fb079SRuslan Ermilov.Nm
10533fab22eSKenneth D. Merry.Ic defects
106c60e19a8SKenneth D. Merry.Op device id
107525689f1SJustin T. Gibbs.Op generic args
108525689f1SJustin T. Gibbs.Aq Fl f Ar format
109525689f1SJustin T. Gibbs.Op Fl P
110525689f1SJustin T. Gibbs.Op Fl G
1117c7fb079SRuslan Ermilov.Nm
11233fab22eSKenneth D. Merry.Ic modepage
113c60e19a8SKenneth D. Merry.Op device id
114525689f1SJustin T. Gibbs.Op generic args
1159916c5d2SRuslan Ermilov.Aq Fl m Ar page | Fl l
1161ac2383cSBill Fumerola.Op Fl P Ar pgctl
1177e32b20dSKelly Yancey.Op Fl b | Fl e
118525689f1SJustin T. Gibbs.Op Fl d
1197c7fb079SRuslan Ermilov.Nm
12033fab22eSKenneth D. Merry.Ic cmd
121c60e19a8SKenneth D. Merry.Op device id
122525689f1SJustin T. Gibbs.Op generic args
12380976615SAlexander Motin.Aq Fl a Ar cmd Op args
124525689f1SJustin T. Gibbs.Aq Fl c Ar cmd Op args
125525689f1SJustin T. Gibbs.Op Fl i Ar len Ar fmt
126525689f1SJustin T. Gibbs.Bk -words
127525689f1SJustin T. Gibbs.Op Fl o Ar len Ar fmt Op args
12880976615SAlexander Motin.Op Fl r Ar fmt
129525689f1SJustin T. Gibbs.Ek
1307c7fb079SRuslan Ermilov.Nm
13133fab22eSKenneth D. Merry.Ic debug
132525689f1SJustin T. Gibbs.Op Fl I
133a7e5261eSNate Lawson.Op Fl P
134525689f1SJustin T. Gibbs.Op Fl T
135525689f1SJustin T. Gibbs.Op Fl S
136a7e5261eSNate Lawson.Op Fl X
13794d09127SKenneth D. Merry.Op Fl c
138525689f1SJustin T. Gibbs.Aq all|off|bus Ns Op :target Ns Op :lun
1397c7fb079SRuslan Ermilov.Nm
14033fab22eSKenneth D. Merry.Ic tags
141c60e19a8SKenneth D. Merry.Op device id
1429deea857SKenneth D. Merry.Op generic args
1439deea857SKenneth D. Merry.Op Fl N Ar tags
1449deea857SKenneth D. Merry.Op Fl q
1459deea857SKenneth D. Merry.Op Fl v
1467c7fb079SRuslan Ermilov.Nm
14733fab22eSKenneth D. Merry.Ic negotiate
148c60e19a8SKenneth D. Merry.Op device id
1499deea857SKenneth D. Merry.Op generic args
1509deea857SKenneth D. Merry.Op Fl c
1519deea857SKenneth D. Merry.Op Fl D Ar enable|disable
1529deea857SKenneth D. Merry.Op Fl O Ar offset
1539deea857SKenneth D. Merry.Op Fl q
1549deea857SKenneth D. Merry.Op Fl R Ar syncrate
1559deea857SKenneth D. Merry.Op Fl T Ar enable|disable
1569deea857SKenneth D. Merry.Op Fl U
1579deea857SKenneth D. Merry.Op Fl W Ar bus_width
1589deea857SKenneth D. Merry.Op Fl v
1597c7fb079SRuslan Ermilov.Nm
16033fab22eSKenneth D. Merry.Ic format
16196a93c63SKenneth D. Merry.Op device id
16296a93c63SKenneth D. Merry.Op generic args
16396a93c63SKenneth D. Merry.Op Fl q
164e9e4d3e4SKenneth D. Merry.Op Fl r
16596a93c63SKenneth D. Merry.Op Fl w
16696a93c63SKenneth D. Merry.Op Fl y
1677c7fb079SRuslan Ermilov.Nm
16833fab22eSKenneth D. Merry.Ic help
169525689f1SJustin T. Gibbs.Sh DESCRIPTION
170e1205e80SPhilippe CharnierThe
1717c7fb079SRuslan Ermilov.Nm
172e1205e80SPhilippe Charnierutility is designed to provide a way for users to access and control the
17333fab22eSKenneth D. Merry.Fx
174525689f1SJustin T. GibbsCAM subsystem.
175525689f1SJustin T. Gibbs.Pp
176e1205e80SPhilippe CharnierThe
1777c7fb079SRuslan Ermilov.Nm
178e1205e80SPhilippe Charnierutility
1799806e231SRuslan Ermilovcan cause a loss of data and/or system crashes if used improperly.
1809806e231SRuslan ErmilovEven
1819deea857SKenneth D. Merryexpert users are encouraged to exercise caution when using this command.
182525689f1SJustin T. GibbsNovice users should stay away from this utility.
183525689f1SJustin T. Gibbs.Pp
184e1205e80SPhilippe CharnierThe
1857c7fb079SRuslan Ermilov.Nm
186e1205e80SPhilippe Charnierutility has a number of primary functions, many of which support an optional
1879806e231SRuslan Ermilovdevice identifier.
1889806e231SRuslan ErmilovA device identifier can take one of three forms:
1891252c1bbSRuslan Ermilov.Bl -tag -width 14n
190c60e19a8SKenneth D. Merry.It deviceUNIT
191c60e19a8SKenneth D. MerrySpecify a device name and unit number combination, like "da5" or "cd3".
1929806e231SRuslan ErmilovNote that character device node names (e.g.\& /dev/da0) are
193c60e19a8SKenneth D. Merry.Em not
194c60e19a8SKenneth D. Merryallowed here.
195c60e19a8SKenneth D. Merry.It bus:target
1969806e231SRuslan ErmilovSpecify a bus number and target id.
1979806e231SRuslan ErmilovThe bus number can be determined from
198c60e19a8SKenneth D. Merrythe output of
199c60e19a8SKenneth D. Merry.Dq camcontrol devlist .
200c60e19a8SKenneth D. MerryThe lun defaults to 0.
201c60e19a8SKenneth D. Merry.It bus:target:lun
2029806e231SRuslan ErmilovSpecify the bus, target and lun for a device.
2039806e231SRuslan Ermilov(e.g.\& 1:2:0)
204c60e19a8SKenneth D. Merry.El
205c60e19a8SKenneth D. Merry.Pp
206c60e19a8SKenneth D. MerryThe device identifier, if it is specified,
207c60e19a8SKenneth D. Merry.Em must
208c60e19a8SKenneth D. Merrycome immediately after the function name, and before any generic or
2099806e231SRuslan Ermilovfunction-specific arguments.
2109806e231SRuslan ErmilovNote that the
211c60e19a8SKenneth D. Merry.Fl n
212c60e19a8SKenneth D. Merryand
213c60e19a8SKenneth D. Merry.Fl u
214c60e19a8SKenneth D. Merryarguments described below will override any device name or unit number
2159806e231SRuslan Ermilovspecified beforehand.
2169806e231SRuslan ErmilovThe
217c60e19a8SKenneth D. Merry.Fl n
218c60e19a8SKenneth D. Merryand
219c60e19a8SKenneth D. Merry.Fl u
220c60e19a8SKenneth D. Merryarguments will
221c60e19a8SKenneth D. Merry.Em not
22296a93c63SKenneth D. Merryoverride a specified bus:target or bus:target:lun, however.
223c60e19a8SKenneth D. Merry.Pp
224c60e19a8SKenneth D. MerryMost of the
2257c7fb079SRuslan Ermilov.Nm
226c60e19a8SKenneth D. Merryprimary functions support these generic arguments:
2271252c1bbSRuslan Ermilov.Bl -tag -width 14n
228525689f1SJustin T. Gibbs.It Fl C Ar count
2299806e231SRuslan ErmilovSCSI command retry count.
2309806e231SRuslan ErmilovIn order for this to work, error recovery
2311252c1bbSRuslan Ermilov.Pq Fl E
232525689f1SJustin T. Gibbsmust be turned on.
233525689f1SJustin T. Gibbs.It Fl E
234525689f1SJustin T. GibbsInstruct the kernel to perform generic SCSI error recovery for the given
2359806e231SRuslan Ermilovcommand.
2369806e231SRuslan ErmilovThis is needed in order for the retry count
2371252c1bbSRuslan Ermilov.Pq Fl C
2389806e231SRuslan Ermilovto be honored.
2399806e231SRuslan ErmilovOther than retrying commands, the generic error recovery in
240525689f1SJustin T. Gibbsthe code will generally attempt to spin up drives that are not spinning.
241525689f1SJustin T. GibbsIt may take some other actions, depending upon the sense code returned from
242525689f1SJustin T. Gibbsthe command.
243525689f1SJustin T. Gibbs.It Fl n Ar dev_name
2449806e231SRuslan ErmilovSpecify the device type to operate on, e.g.\& "da", "cd".
245525689f1SJustin T. Gibbs.It Fl t Ar timeout
2469806e231SRuslan ErmilovSCSI command timeout in seconds.
2479806e231SRuslan ErmilovThis overrides the default timeout for
248525689f1SJustin T. Gibbsany given command.
249525689f1SJustin T. Gibbs.It Fl u Ar unit_number
2509806e231SRuslan ErmilovSpecify the device unit number, e.g.\& "1", "5".
251525689f1SJustin T. Gibbs.It Fl v
252525689f1SJustin T. GibbsBe verbose, print out sense information for failed SCSI commands.
253525689f1SJustin T. Gibbs.El
254525689f1SJustin T. Gibbs.Pp
255d13d1cd2SKenneth D. MerryPrimary command functions:
256525689f1SJustin T. Gibbs.Bl -tag -width periphlist
25733fab22eSKenneth D. Merry.It Ic devlist
258525689f1SJustin T. GibbsList all physical devices (logical units) attached to the CAM subsystem.
259525689f1SJustin T. GibbsThis also includes a list of peripheral drivers attached to each device.
260525689f1SJustin T. GibbsWith the
261525689f1SJustin T. Gibbs.Fl v
262525689f1SJustin T. Gibbsargument, SCSI bus number, adapter name and unit numbers are printed as
263525689f1SJustin T. Gibbswell.
26433fab22eSKenneth D. Merry.It Ic periphlist
265525689f1SJustin T. GibbsList all peripheral drivers attached to a given physical device (logical
266525689f1SJustin T. Gibbsunit).
26733fab22eSKenneth D. Merry.It Ic tur
268525689f1SJustin T. GibbsSend the SCSI test unit ready (0x00) command to the given device.
269e1205e80SPhilippe CharnierThe
2707c7fb079SRuslan Ermilov.Nm
271e1205e80SPhilippe Charnierutility will report whether the device is ready or not.
27233fab22eSKenneth D. Merry.It Ic inquiry
2739806e231SRuslan ErmilovSend a SCSI inquiry command (0x12) to a device.
2749806e231SRuslan ErmilovBy default,
2757c7fb079SRuslan Ermilov.Nm
276525689f1SJustin T. Gibbswill print out the standard inquiry data, device serial number, and
2779806e231SRuslan Ermilovtransfer rate information.
2789806e231SRuslan ErmilovThe user can specify that only certain types of
279525689f1SJustin T. Gibbsinquiry data be printed:
2801252c1bbSRuslan Ermilov.Bl -tag -width 4n
281525689f1SJustin T. Gibbs.It Fl D
282525689f1SJustin T. GibbsGet the standard inquiry data.
283525689f1SJustin T. Gibbs.It Fl S
2849806e231SRuslan ErmilovPrint out the serial number.
2859806e231SRuslan ErmilovIf this flag is the only one specified,
2867c7fb079SRuslan Ermilov.Nm
287525689f1SJustin T. Gibbswill not print out "Serial Number" before the value returned by the drive.
288525689f1SJustin T. GibbsThis is to aid in script writing.
289525689f1SJustin T. Gibbs.It Fl R
290525689f1SJustin T. GibbsPrint out transfer rate information.
291525689f1SJustin T. Gibbs.El
29252c9ce25SScott Long.It Ic identify
29352c9ce25SScott LongSend a ATA identify command (0xec) to a device.
29442cb6a80SKenneth D. Merry.It Ic reportluns
29542cb6a80SKenneth D. MerrySend the SCSI REPORT LUNS (0xA0) command to the given device.
29642cb6a80SKenneth D. MerryBy default,
29742cb6a80SKenneth D. Merry.Nm
29842cb6a80SKenneth D. Merrywill print out the list of logical units (LUNs) supported by the target device.
29942cb6a80SKenneth D. MerryThere are a couple of options to modify the output:
3008266d476SRuslan Ermilov.Bl -tag -width 14n
30142cb6a80SKenneth D. Merry.It Fl c
30242cb6a80SKenneth D. MerryJust print out a count of LUNs, not the actual LUN numbers.
30342cb6a80SKenneth D. Merry.It Fl l
30442cb6a80SKenneth D. MerryJust print out the LUNs, and don't print out the count.
30542cb6a80SKenneth D. Merry.It Fl r Ar reporttype
30642cb6a80SKenneth D. MerrySpecify the type of report to request from the target:
30742cb6a80SKenneth D. Merry.Bl -tag -width 012345678
30842cb6a80SKenneth D. Merry.It default
30942cb6a80SKenneth D. MerryReturn the default report.
31042cb6a80SKenneth D. MerryThis is the
31142cb6a80SKenneth D. Merry.Nm
31242cb6a80SKenneth D. Merrydefault.
31342cb6a80SKenneth D. MerryMost targets will support this report if they support the REPORT LUNS
31442cb6a80SKenneth D. Merrycommand.
31542cb6a80SKenneth D. Merry.It wellknown
31642cb6a80SKenneth D. MerryReturn only well known LUNs.
31742cb6a80SKenneth D. Merry.It all
31842cb6a80SKenneth D. MerryReturn all available LUNs.
31942cb6a80SKenneth D. Merry.El
32042cb6a80SKenneth D. Merry.El
32142cb6a80SKenneth D. Merry.Pp
32242cb6a80SKenneth D. Merry.Nm
32342cb6a80SKenneth D. Merrywill try to print out LUN numbers in a reasonable format.
32442cb6a80SKenneth D. MerryIt can understand the peripheral, flat, LUN and extended LUN formats.
325f553b7b3SKenneth D. Merry.It Ic readcap
326f553b7b3SKenneth D. MerrySend the SCSI READ CAPACITY command to the given device and display
327f553b7b3SKenneth D. Merrythe results.
328f553b7b3SKenneth D. MerryIf the device is larger than 2TB, the SCSI READ CAPACITY (16) service
329f553b7b3SKenneth D. Merryaction will be sent to obtain the full size of the device.
330f553b7b3SKenneth D. MerryBy default,
331f553b7b3SKenneth D. Merry.Nm
332f553b7b3SKenneth D. Merrywill print out the last logical block of the device, and the blocksize of
333f553b7b3SKenneth D. Merrythe device in bytes.
334f553b7b3SKenneth D. MerryTo modify the output format, use the following options:
335f553b7b3SKenneth D. Merry.Bl -tag -width 5n
336f553b7b3SKenneth D. Merry.It Fl b
337f553b7b3SKenneth D. MerryJust print out the blocksize, not the last block or device size.
338f553b7b3SKenneth D. MerryThis cannot be used with
339f553b7b3SKenneth D. Merry.Fl N
340f553b7b3SKenneth D. Merryor
341f553b7b3SKenneth D. Merry.Fl s .
342f553b7b3SKenneth D. Merry.It Fl h
343f553b7b3SKenneth D. MerryPrint out the device size in human readable (base 2, 1K == 1024) format.
344f553b7b3SKenneth D. MerryThis implies
345f553b7b3SKenneth D. Merry.Fl N
346f553b7b3SKenneth D. Merryand cannot be used with
347f553b7b3SKenneth D. Merry.Fl q
348f553b7b3SKenneth D. Merryor
349f553b7b3SKenneth D. Merry.Fl b .
350f553b7b3SKenneth D. Merry.It Fl H
351f553b7b3SKenneth D. MerryPrint out the device size in human readable (base 10, 1K == 1000) format.
352f553b7b3SKenneth D. Merry.It Fl N
353f553b7b3SKenneth D. MerryPrint out the number of blocks in the device instead of the last logical
354f553b7b3SKenneth D. Merryblock.
355f553b7b3SKenneth D. Merry.It Fl q
356f553b7b3SKenneth D. MerryQuiet, print out the numbers only (separated by a comma if
357f553b7b3SKenneth D. Merry.Fl b
358f553b7b3SKenneth D. Merryor
359f553b7b3SKenneth D. Merry.Fl s
360f553b7b3SKenneth D. Merryare not specified).
361f553b7b3SKenneth D. Merry.It Fl s
362f553b7b3SKenneth D. MerryPrint out the last logical block or the size of the device only, and omit
363f553b7b3SKenneth D. Merrythe blocksize.
364f553b7b3SKenneth D. Merry.El
36533fab22eSKenneth D. Merry.It Ic start
366525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the
367525689f1SJustin T. Gibbsstart bit set.
36833fab22eSKenneth D. Merry.It Ic stop
369525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the
370525689f1SJustin T. Gibbsstart bit cleared.
371f9cecca2SMatthew N. Dodd.It Ic load
372f9cecca2SMatthew N. DoddSend the SCSI Start/Stop Unit (0x1B) command to the given device with the
373f9cecca2SMatthew N. Doddstart bit set and the load/eject bit set.
37433fab22eSKenneth D. Merry.It Ic eject
375525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the
376f9cecca2SMatthew N. Doddstart bit cleared and the load/eject bit set.
37733fab22eSKenneth D. Merry.It Ic rescan
3785710d224SKenneth D. MerryTell the kernel to scan all busses in the system (with the
3795710d224SKenneth D. Merry.Ar all
3805710d224SKenneth D. Merryargument), the given bus (XPT_SCAN_BUS), or bus:target:lun
3819806e231SRuslan Ermilov(XPT_SCAN_LUN) for new devices or devices that have gone away.
3829806e231SRuslan ErmilovThe user
3839806e231SRuslan Ermilovmay specify a scan of all busses, a single bus, or a lun.
3849806e231SRuslan ErmilovScanning all luns
3850227791bSRuslan Ermilovon a target is not supported.
38633fab22eSKenneth D. Merry.It Ic reset
3875710d224SKenneth D. MerryTell the kernel to reset all busses in the system (with the
3885710d224SKenneth D. Merry.Ar all
3895710d224SKenneth D. Merryargument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus
390a2a44836SMatt Jacobreset for that bus, or to reset the given bus:target:lun
391a2a44836SMatt Jacob(XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after
392ef8f7ac9SSheldon Hearnconnecting to that device.
393ef8f7ac9SSheldon HearnNote that this can have a destructive impact
394a2a44836SMatt Jacobon the system.
39533fab22eSKenneth D. Merry.It Ic defects
396525689f1SJustin T. GibbsSend the SCSI READ DEFECT DATA (10) command (0x37) to the given device, and
397525689f1SJustin T. Gibbsprint out any combination of: the total number of defects, the primary
398525689f1SJustin T. Gibbsdefect list (PLIST), and the grown defect list (GLIST).
3991252c1bbSRuslan Ermilov.Bl -tag -width 11n
400525689f1SJustin T. Gibbs.It Fl f Ar format
401525689f1SJustin T. GibbsThe three format options are:
402525689f1SJustin T. Gibbs.Em block ,
403525689f1SJustin T. Gibbsto print out the list as logical blocks,
404525689f1SJustin T. Gibbs.Em bfi ,
405525689f1SJustin T. Gibbsto print out the list in bytes from index format, and
406525689f1SJustin T. Gibbs.Em phys ,
4079806e231SRuslan Ermilovto print out the list in physical sector format.
4089806e231SRuslan ErmilovThe format argument is
4099806e231SRuslan Ermilovrequired.
4109806e231SRuslan ErmilovMost drives support the physical sector format.
4119806e231SRuslan ErmilovSome drives
4129806e231SRuslan Ermilovsupport the logical block format.
4130227791bSRuslan ErmilovMany drives, if they do not support the
414525689f1SJustin T. Gibbsrequested format, return the data in an alternate format, along with sense
4150227791bSRuslan Ermilovinformation indicating that the requested data format is not supported.
416e1205e80SPhilippe CharnierThe
4177c7fb079SRuslan Ermilov.Nm
418e1205e80SPhilippe Charnierutility
419525689f1SJustin T. Gibbsattempts to detect this, and print out whatever format the drive returns.
4200227791bSRuslan ErmilovIf the drive uses a non-standard sense code to report that it does not
421525689f1SJustin T. Gibbssupport the requested format,
4227c7fb079SRuslan Ermilov.Nm
423525689f1SJustin T. Gibbswill probably see the error as a failure to complete the request.
424525689f1SJustin T. Gibbs.It Fl G
4259806e231SRuslan ErmilovPrint out the grown defect list.
4269806e231SRuslan ErmilovThis is a list of bad blocks that have
427525689f1SJustin T. Gibbsbeen remapped since the disk left the factory.
428525689f1SJustin T. Gibbs.It Fl P
429525689f1SJustin T. GibbsPrint out the primary defect list.
430525689f1SJustin T. Gibbs.El
431525689f1SJustin T. Gibbs.Pp
432525689f1SJustin T. GibbsIf neither
433525689f1SJustin T. Gibbs.Fl P
434525689f1SJustin T. Gibbsnor
435525689f1SJustin T. Gibbs.Fl G
436525689f1SJustin T. Gibbsis specified,
4377c7fb079SRuslan Ermilov.Nm
438525689f1SJustin T. Gibbswill print out the number of defects given in the READ DEFECT DATA header
439525689f1SJustin T. Gibbsreturned from the drive.
44033fab22eSKenneth D. Merry.It Ic modepage
4419806e231SRuslan ErmilovAllows the user to display and optionally edit a SCSI mode page.
4429806e231SRuslan ErmilovThe mode
443525689f1SJustin T. Gibbspage formats are located in
444525689f1SJustin T. Gibbs.Pa /usr/share/misc/scsi_modes .
445525689f1SJustin T. GibbsThis can be overridden by specifying a different file in the
446525689f1SJustin T. Gibbs.Ev SCSI_MODES
44733fab22eSKenneth D. Merryenvironment variable.
44833fab22eSKenneth D. MerryThe
44933fab22eSKenneth D. Merry.Ic modepage
45033fab22eSKenneth D. Merrycommand takes several arguments:
4511252c1bbSRuslan Ermilov.Bl -tag -width 12n
4529deea857SKenneth D. Merry.It Fl d
453525689f1SJustin T. GibbsDisable block descriptors for mode sense.
4547e32b20dSKelly Yancey.It Fl b
4557e32b20dSKelly YanceyDisplays mode page data in binary format.
456525689f1SJustin T. Gibbs.It Fl e
4579806e231SRuslan ErmilovThis flag allows the user to edit values in the mode page.
4589806e231SRuslan ErmilovThe user may
4597e32b20dSKelly Yanceyeither edit mode page values with the text editor pointed to by his
4607e32b20dSKelly Yancey.Ev EDITOR
4617e32b20dSKelly Yanceyenvironment variable, or supply mode page values via standard input, using
4627e32b20dSKelly Yanceythe same format that
4637c7fb079SRuslan Ermilov.Nm
4649806e231SRuslan Ermilovuses to display mode page values.
4659806e231SRuslan ErmilovThe editor will be invoked if
4667c7fb079SRuslan Ermilov.Nm
4677e32b20dSKelly Yanceydetects that standard input is terminal.
4687e32b20dSKelly Yancey.It Fl l
4697e32b20dSKelly YanceyLists all available mode pages.
470525689f1SJustin T. Gibbs.It Fl m Ar mode_page
471525689f1SJustin T. GibbsThis specifies the number of the mode page the user would like to view
4729806e231SRuslan Ermilovand/or edit.
4739806e231SRuslan ErmilovThis argument is mandatory unless
4749402dd99SKelly Yancey.Fl l
4759402dd99SKelly Yanceyis specified.
4761ac2383cSBill Fumerola.It Fl P Ar pgctl
4779806e231SRuslan ErmilovThis allows the user to specify the page control field.
4789806e231SRuslan ErmilovPossible values are:
479525689f1SJustin T. Gibbs.Bl -tag -width xxx -compact
48046a1f3b4SKenneth D. Merry.It 0
481525689f1SJustin T. GibbsCurrent values
48246a1f3b4SKenneth D. Merry.It 1
483525689f1SJustin T. GibbsChangeable values
48446a1f3b4SKenneth D. Merry.It 2
485525689f1SJustin T. GibbsDefault values
48646a1f3b4SKenneth D. Merry.It 3
487525689f1SJustin T. GibbsSaved values
488525689f1SJustin T. Gibbs.El
489525689f1SJustin T. Gibbs.El
49033fab22eSKenneth D. Merry.It Ic cmd
49180976615SAlexander MotinAllows the user to send an arbitrary ATA or SCSI CDB to any device.
49233fab22eSKenneth D. MerryThe
49333fab22eSKenneth D. Merry.Ic cmd
494525689f1SJustin T. Gibbsfunction requires the
495525689f1SJustin T. Gibbs.Fl c
49680976615SAlexander Motinargument to specify SCSI CDB or the
49780976615SAlexander Motin.Fl a
49880976615SAlexander Motinargument to specify ATA Command Block registers values.
4999806e231SRuslan ErmilovOther arguments are optional, depending on
5009806e231SRuslan Ermilovthe command type.
5019806e231SRuslan ErmilovThe command and data specification syntax is documented
502525689f1SJustin T. Gibbsin
50396a93c63SKenneth D. Merry.Xr cam_cdbparse 3 .
504525689f1SJustin T. GibbsNOTE: If the CDB specified causes data to be transfered to or from the
505525689f1SJustin T. GibbsSCSI device in question, you MUST specify either
506525689f1SJustin T. Gibbs.Fl i
507525689f1SJustin T. Gibbsor
508525689f1SJustin T. Gibbs.Fl o .
5091252c1bbSRuslan Ermilov.Bl -tag -width 17n
51080976615SAlexander Motin.It Fl a Ar cmd Op args
51180976615SAlexander MotinThis specifies the content of 12 ATA Command Block registers (command,
51280976615SAlexander Motinfeatures, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp.
51380976615SAlexander Motinlba_high_exp, features_exp, sector_count, sector_count_exp).
514525689f1SJustin T. Gibbs.It Fl c Ar cmd Op args
5159806e231SRuslan ErmilovThis specifies the SCSI CDB.
51680976615SAlexander MotinSCSI CDBs may be 6, 10, 12 or 16 bytes.
517525689f1SJustin T. Gibbs.It Fl i Ar len Ar fmt
518525689f1SJustin T. GibbsThis specifies the amount of data to read, and how it should be displayed.
519525689f1SJustin T. GibbsIf the format is
520525689f1SJustin T. Gibbs.Sq - ,
521525689f1SJustin T. Gibbs.Ar len
522525689f1SJustin T. Gibbsbytes of data will be read from the device and written to standard output.
523525689f1SJustin T. Gibbs.It Fl o Ar len Ar fmt Op args
524525689f1SJustin T. GibbsThis specifies the amount of data to be written to a device, and the data
5259806e231SRuslan Ermilovthat is to be written.
5269806e231SRuslan ErmilovIf the format is
527525689f1SJustin T. Gibbs.Sq - ,
528525689f1SJustin T. Gibbs.Ar len
529525689f1SJustin T. Gibbsbytes of data will be read from standard input and written to the device.
53080976615SAlexander Motin.It Fl r Ar fmt
53180976615SAlexander MotinThis specifies that 11 result ATA Command Block registers should be displayed
53280976615SAlexander Motin(status, error, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp,
53380976615SAlexander Motinlba_high_exp, sector_count, sector_count_exp), and how.
53480976615SAlexander MotinIf the format is
53580976615SAlexander Motin.Sq - ,
53680976615SAlexander Motin11 result registers will be written to standard output in hex.
537525689f1SJustin T. Gibbs.El
53833fab22eSKenneth D. Merry.It Ic debug
5399806e231SRuslan ErmilovTurn on CAM debugging printfs in the kernel.
5409806e231SRuslan ErmilovThis requires options CAMDEBUG
5419806e231SRuslan Ermilovin your kernel config file.
5429806e231SRuslan ErmilovWARNING: enabling debugging printfs currently
5439806e231SRuslan Ermilovcauses an EXTREME number of kernel printfs.
5449806e231SRuslan ErmilovYou may have difficulty
545525689f1SJustin T. Gibbsturning off the debugging printfs once they start, since the kernel will be
546525689f1SJustin T. Gibbsbusy printing messages and unable to service other requests quickly.
54733fab22eSKenneth D. MerryThe
54833fab22eSKenneth D. Merry.Ic debug
54933fab22eSKenneth D. Merryfunction takes a number of arguments:
5501252c1bbSRuslan Ermilov.Bl -tag -width 18n
551525689f1SJustin T. Gibbs.It Fl I
552525689f1SJustin T. GibbsEnable CAM_DEBUG_INFO printfs.
553a7e5261eSNate Lawson.It Fl P
554a7e5261eSNate LawsonEnable CAM_DEBUG_PERIPH printfs.
555525689f1SJustin T. Gibbs.It Fl T
556525689f1SJustin T. GibbsEnable CAM_DEBUG_TRACE printfs.
557525689f1SJustin T. Gibbs.It Fl S
558525689f1SJustin T. GibbsEnable CAM_DEBUG_SUBTRACE printfs.
559a7e5261eSNate Lawson.It Fl X
560a7e5261eSNate LawsonEnable CAM_DEBUG_XPT printfs.
561d05caa00SKenneth D. Merry.It Fl c
5629806e231SRuslan ErmilovEnable CAM_DEBUG_CDB printfs.
5639806e231SRuslan ErmilovThis will cause the kernel to print out the
564d05caa00SKenneth D. MerrySCSI CDBs sent to the specified device(s).
565525689f1SJustin T. Gibbs.It all
566525689f1SJustin T. GibbsEnable debugging for all devices.
567525689f1SJustin T. Gibbs.It off
568525689f1SJustin T. GibbsTurn off debugging for all devices
569525689f1SJustin T. Gibbs.It bus Ns Op :target Ns Op :lun
5709806e231SRuslan ErmilovTurn on debugging for the given bus, target or lun.
5719806e231SRuslan ErmilovIf the lun or target
5729806e231SRuslan Ermilovand lun are not specified, they are wildcarded.
5739806e231SRuslan Ermilov(i.e., just specifying a
574525689f1SJustin T. Gibbsbus turns on debugging printfs for all devices on that bus.)
575525689f1SJustin T. Gibbs.El
57633fab22eSKenneth D. Merry.It Ic tags
5779deea857SKenneth D. MerryShow or set the number of "tagged openings" or simultaneous transactions
5789806e231SRuslan Ermilovwe attempt to queue to a particular device.
5799806e231SRuslan ErmilovBy default, the
58033fab22eSKenneth D. Merry.Ic tags
5819806e231SRuslan Ermilovcommand, with no command-specific arguments (i.e., only generic arguments)
5829deea857SKenneth D. Merryprints out the "soft" maximum number of transactions that can be queued to
5839806e231SRuslan Ermilovthe device in question.
5849806e231SRuslan ErmilovFor more detailed information, use the
5859deea857SKenneth D. Merry.Fl v
5869deea857SKenneth D. Merryargument described below.
5871252c1bbSRuslan Ermilov.Bl -tag -width 7n
5889deea857SKenneth D. Merry.It Fl N Ar tags
5899806e231SRuslan ErmilovSet the number of tags for the given device.
5909806e231SRuslan ErmilovThis must be between the
5919806e231SRuslan Ermilovminimum and maximum number set in the kernel quirk table.
5929806e231SRuslan ErmilovThe default for
5939deea857SKenneth D. Merrymost devices that support tagged queueing is a minimum of 2 and a maximum
5949806e231SRuslan Ermilovof 255.
5959806e231SRuslan ErmilovThe minimum and maximum values for a given device may be
5969deea857SKenneth D. Merrydetermined by using the
5979deea857SKenneth D. Merry.Fl v
5989806e231SRuslan Ermilovswitch.
5999806e231SRuslan ErmilovThe meaning of the
6009deea857SKenneth D. Merry.Fl v
6019deea857SKenneth D. Merryswitch for this
6027c7fb079SRuslan Ermilov.Nm
6039deea857SKenneth D. Merrysubcommand is described below.
6049deea857SKenneth D. Merry.It Fl q
6050227791bSRuslan ErmilovBe quiet, and do not report the number of tags.
6069806e231SRuslan ErmilovThis is generally used when
6079deea857SKenneth D. Merrysetting the number of tags.
6089deea857SKenneth D. Merry.It Fl v
6099deea857SKenneth D. MerryThe verbose flag has special functionality for the
6109deea857SKenneth D. Merry.Em tags
6119806e231SRuslan Ermilovargument.
6129806e231SRuslan ErmilovIt causes
6137c7fb079SRuslan Ermilov.Nm
6149deea857SKenneth D. Merryto print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB:
6151252c1bbSRuslan Ermilov.Bl -tag -width 13n
6169deea857SKenneth D. Merry.It dev_openings
6179deea857SKenneth D. MerryThis is the amount of capacity for transactions queued to a given device.
6189deea857SKenneth D. Merry.It dev_active
6199deea857SKenneth D. MerryThis is the number of transactions currently queued to a device.
6209deea857SKenneth D. Merry.It devq_openings
6219806e231SRuslan ErmilovThis is the kernel queue space for transactions.
6229806e231SRuslan ErmilovThis count usually mirrors
6239deea857SKenneth D. Merrydev_openings except during error recovery operations when
6249deea857SKenneth D. Merrythe device queue is frozen (device is not allowed to receive
6259deea857SKenneth D. Merrycommands), the number of dev_openings is reduced, or transaction
6269deea857SKenneth D. Merryreplay is occurring.
6279deea857SKenneth D. Merry.It devq_queued
6289deea857SKenneth D. MerryThis is the number of transactions waiting in the kernel queue for capacity
6299806e231SRuslan Ermilovon the device.
6309806e231SRuslan ErmilovThis number is usually zero unless error recovery is in
6319deea857SKenneth D. Merryprogress.
6329deea857SKenneth D. Merry.It held
6339deea857SKenneth D. MerryThe held count is the number of CCBs held by peripheral drivers that have
6349deea857SKenneth D. Merryeither just been completed or are about to be released to the transport
6359806e231SRuslan Ermilovlayer for service by a device.
6369806e231SRuslan ErmilovHeld CCBs reserve capacity on a given
6379deea857SKenneth D. Merrydevice.
6389deea857SKenneth D. Merry.It mintags
6399deea857SKenneth D. MerryThis is the current "hard" minimum number of transactions that can be
6409806e231SRuslan Ermilovqueued to a device at once.
6419806e231SRuslan ErmilovThe
6429deea857SKenneth D. Merry.Ar dev_openings
6439806e231SRuslan Ermilovvalue above cannot go below this number.
6449806e231SRuslan ErmilovThe default value for
6459deea857SKenneth D. Merry.Ar mintags
6469deea857SKenneth D. Merryis 2, although it may be set higher or lower for various devices.
6479deea857SKenneth D. Merry.It maxtags
6489deea857SKenneth D. MerryThis is the "hard" maximum number of transactions that can be queued to a
6499806e231SRuslan Ermilovdevice at one time.
6509806e231SRuslan ErmilovThe
6519deea857SKenneth D. Merry.Ar dev_openings
6529806e231SRuslan Ermilovvalue cannot go above this number.
6539806e231SRuslan ErmilovThe default value for
6549deea857SKenneth D. Merry.Ar maxtags
6559deea857SKenneth D. Merryis 255, although it may be set higher or lower for various devices.
6569deea857SKenneth D. Merry.El
6579deea857SKenneth D. Merry.El
65833fab22eSKenneth D. Merry.It Ic negotiate
6599806e231SRuslan ErmilovShow or negotiate various communication parameters.
6609806e231SRuslan ErmilovSome controllers may
6619806e231SRuslan Ermilovnot support setting or changing some of these values.
6629806e231SRuslan ErmilovFor instance, the
6639deea857SKenneth D. MerryAdaptec 174x controllers do not support changing a device's sync rate or
6649deea857SKenneth D. Merryoffset.
665e1205e80SPhilippe CharnierThe
6667c7fb079SRuslan Ermilov.Nm
667e1205e80SPhilippe Charnierutility
6689deea857SKenneth D. Merrywill not attempt to set the parameter if the controller indicates that it
6699806e231SRuslan Ermilovdoes not support setting the parameter.
6709806e231SRuslan ErmilovTo find out what the controller
6719deea857SKenneth D. Merrysupports, use the
6729deea857SKenneth D. Merry.Fl v
6739806e231SRuslan Ermilovflag.
6749806e231SRuslan ErmilovThe meaning of the
6759deea857SKenneth D. Merry.Fl v
6769deea857SKenneth D. Merryflag for the
67733fab22eSKenneth D. Merry.Ic negotiate
6789806e231SRuslan Ermilovcommand is described below.
6790227791bSRuslan ErmilovAlso, some controller drivers do not support
6809deea857SKenneth D. Merrysetting negotiation parameters, even if the underlying controller supports
6819806e231SRuslan Ermilovnegotiation changes.
6829806e231SRuslan ErmilovSome controllers, such as the Advansys wide
6839deea857SKenneth D. Merrycontrollers, support enabling and disabling synchronous negotiation for
6849deea857SKenneth D. Merrya device, but do not support setting the synchronous negotiation rate.
6851252c1bbSRuslan Ermilov.Bl -tag -width 17n
6869deea857SKenneth D. Merry.It Fl a
6879deea857SKenneth D. MerryAttempt to make the negotiation settings take effect immediately by sending
6889deea857SKenneth D. Merrya Test Unit Ready command to the device.
6899deea857SKenneth D. Merry.It Fl c
6909806e231SRuslan ErmilovShow or set current negotiation settings.
6919806e231SRuslan ErmilovThis is the default.
6929deea857SKenneth D. Merry.It Fl D Ar enable|disable
6939deea857SKenneth D. MerryEnable or disable disconnection.
6949deea857SKenneth D. Merry.It Fl O Ar offset
6959deea857SKenneth D. MerrySet the command delay offset.
6969deea857SKenneth D. Merry.It Fl q
6970227791bSRuslan ErmilovBe quiet, do not print anything.
6989806e231SRuslan ErmilovThis is generally useful when you want to
6990227791bSRuslan Ermilovset a parameter, but do not want any status information.
7009deea857SKenneth D. Merry.It Fl R Ar syncrate
7019806e231SRuslan ErmilovChange the synchronization rate for a device.
7029806e231SRuslan ErmilovThe sync rate is a floating
7039806e231SRuslan Ermilovpoint value specified in MHz.
7049806e231SRuslan ErmilovSo, for instance,
7059deea857SKenneth D. Merry.Sq 20.000
7069deea857SKenneth D. Merryis a legal value, as is
7079deea857SKenneth D. Merry.Sq 20 .
7089deea857SKenneth D. Merry.It Fl T Ar enable|disable
7099deea857SKenneth D. MerryEnable or disable tagged queueing for a device.
7109deea857SKenneth D. Merry.It Fl U
7119806e231SRuslan ErmilovShow or set user negotiation settings.
7129806e231SRuslan ErmilovThe default is to show or set
7139deea857SKenneth D. Merrycurrent negotiation settings.
7149deea857SKenneth D. Merry.It Fl v
7159deea857SKenneth D. MerryThe verbose switch has special meaning for the
71633fab22eSKenneth D. Merry.Ic negotiate
7179806e231SRuslan Ermilovsubcommand.
7189806e231SRuslan ErmilovIt causes
7197c7fb079SRuslan Ermilov.Nm
7209deea857SKenneth D. Merryto print out the contents of a Path Inquiry (XPT_PATH_INQ) CCB sent to the
7219deea857SKenneth D. Merrycontroller driver.
7229deea857SKenneth D. Merry.It Fl W Ar bus_width
7239806e231SRuslan ErmilovSpecify the bus width to negotiate with a device.
7249806e231SRuslan ErmilovThe bus width is
7259806e231SRuslan Ermilovspecified in bits.
7269806e231SRuslan ErmilovThe only useful values to specify are 8, 16, and 32
7279806e231SRuslan Ermilovbits.
7289806e231SRuslan ErmilovThe controller must support the bus width in question in order for
7299deea857SKenneth D. Merrythe setting to take effect.
7309deea857SKenneth D. Merry.El
7319deea857SKenneth D. Merry.Pp
7329deea857SKenneth D. MerryIn general, sync rate and offset settings will not take effect for a
7339806e231SRuslan Ermilovdevice until a command has been sent to the device.
7349806e231SRuslan ErmilovThe
7359deea857SKenneth D. Merry.Fl a
7369deea857SKenneth D. Merryswitch above will automatically send a Test Unit Ready to the device so
7379deea857SKenneth D. Merrynegotiation parameters will take effect.
73833fab22eSKenneth D. Merry.It Ic format
73996a93c63SKenneth D. MerryIssue the
74096a93c63SKenneth D. Merry.Tn SCSI
74196a93c63SKenneth D. MerryFORMAT UNIT command to the named device.
74296a93c63SKenneth D. Merry.Pp
74396a93c63SKenneth D. Merry.Em WARNING! WARNING! WARNING!
74496a93c63SKenneth D. Merry.Pp
7459806e231SRuslan ErmilovLow level formatting a disk will destroy ALL data on the disk.
7469806e231SRuslan ErmilovUse
7479806e231SRuslan Ermilovextreme caution when issuing this command.
7489806e231SRuslan ErmilovMany users low-level format
7499806e231SRuslan Ermilovdisks that do not really need to be low-level formatted.
7509806e231SRuslan ErmilovThere are
75196a93c63SKenneth D. Merryrelatively few scenarios that call for low-level formatting a disk.
75296a93c63SKenneth D. MerryOne reason for
75396a93c63SKenneth D. Merrylow-level formatting a disk is to initialize the disk after changing
7549806e231SRuslan Ermilovits physical sector size.
7559806e231SRuslan ErmilovAnother reason for low-level formatting a disk
75696a93c63SKenneth D. Merryis to revive the disk if you are getting "medium format corrupted" errors
75796a93c63SKenneth D. Merryfrom the disk in response to read and write requests.
75896a93c63SKenneth D. Merry.Pp
7599806e231SRuslan ErmilovSome disks take longer than others to format.
7609806e231SRuslan ErmilovUsers should specify a
7619806e231SRuslan Ermilovtimeout long enough to allow the format to complete.
7629806e231SRuslan ErmilovThe default format
7639806e231SRuslan Ermilovtimeout is 3 hours, which should be long enough for most disks.
7649806e231SRuslan ErmilovSome hard
76596a93c63SKenneth D. Merrydisks will complete a format operation in a very short period of time
7669806e231SRuslan Ermilov(on the order of 5 minutes or less).
7679806e231SRuslan ErmilovThis is often because the drive
7680227791bSRuslan Ermilovdoes not really support the FORMAT UNIT command -- it just accepts the
76996a93c63SKenneth D. Merrycommand, waits a few minutes and then returns it.
77096a93c63SKenneth D. Merry.Pp
77196a93c63SKenneth D. MerryThe
77296a93c63SKenneth D. Merry.Sq format
7739806e231SRuslan Ermilovsubcommand takes several arguments that modify its default behavior.
7749806e231SRuslan ErmilovThe
77596a93c63SKenneth D. Merry.Fl q
77696a93c63SKenneth D. Merryand
77796a93c63SKenneth D. Merry.Fl y
77896a93c63SKenneth D. Merryarguments can be useful for scripts.
77996a93c63SKenneth D. Merry.Pp
7801252c1bbSRuslan Ermilov.Bl -tag -width 6n
78196a93c63SKenneth D. Merry.It Fl q
7820227791bSRuslan ErmilovBe quiet, do not print any status messages.
7839806e231SRuslan ErmilovThis option will not disable
7849806e231SRuslan Ermilovthe questions, however.
7859806e231SRuslan ErmilovTo disable questions, use the
78696a93c63SKenneth D. Merry.Fl y
78796a93c63SKenneth D. Merryargument, below.
788e9e4d3e4SKenneth D. Merry.It Fl r
789e9e4d3e4SKenneth D. MerryRun in
790e9e4d3e4SKenneth D. Merry.Dq report only
791e9e4d3e4SKenneth D. Merrymode.
792e9e4d3e4SKenneth D. MerryThis will report status on a format that is already running on the drive.
79396a93c63SKenneth D. Merry.It Fl w
7949806e231SRuslan ErmilovIssue a non-immediate format command.
7959806e231SRuslan ErmilovBy default,
7967c7fb079SRuslan Ermilov.Nm
7979806e231SRuslan Ermilovissues the FORMAT UNIT command with the immediate bit set.
7989806e231SRuslan ErmilovThis tells the
79996a93c63SKenneth D. Merrydevice to immediately return the format command, before the format has
8009806e231SRuslan Ermilovactually completed.
8019806e231SRuslan ErmilovThen,
8027c7fb079SRuslan Ermilov.Nm
80396a93c63SKenneth D. Merrygathers
80496a93c63SKenneth D. Merry.Tn SCSI
80596a93c63SKenneth D. Merrysense information from the device every second to determine how far along
8069806e231SRuslan Ermilovin the format process it is.
8079806e231SRuslan ErmilovIf the
80896a93c63SKenneth D. Merry.Fl w
80996a93c63SKenneth D. Merryargument is specified,
8107c7fb079SRuslan Ermilov.Nm
81196a93c63SKenneth D. Merrywill issue a non-immediate format command, and will be unable to print any
81296a93c63SKenneth D. Merryinformation to let the user know what percentage of the disk has been
81396a93c63SKenneth D. Merryformatted.
81496a93c63SKenneth D. Merry.It Fl y
8150227791bSRuslan ErmilovDo not ask any questions.
8169806e231SRuslan ErmilovBy default,
8177c7fb079SRuslan Ermilov.Nm
81896a93c63SKenneth D. Merrywill ask the user if he/she really wants to format the disk in question,
8199806e231SRuslan Ermilovand also if the default format command timeout is acceptable.
8209806e231SRuslan ErmilovThe user
82196a93c63SKenneth D. Merrywill not be asked about the timeout if a timeout is specified on the
82296a93c63SKenneth D. Merrycommand line.
82396a93c63SKenneth D. Merry.El
82433fab22eSKenneth D. Merry.It Ic help
8255a251d70SKenneth D. MerryPrint out verbose usage information.
826525689f1SJustin T. Gibbs.El
827525689f1SJustin T. Gibbs.Sh ENVIRONMENT
828525689f1SJustin T. GibbsThe
829525689f1SJustin T. Gibbs.Ev SCSI_MODES
830525689f1SJustin T. Gibbsvariable allows the user to specify an alternate mode page format file.
831525689f1SJustin T. Gibbs.Pp
832525689f1SJustin T. GibbsThe
833525689f1SJustin T. Gibbs.Ev EDITOR
834525689f1SJustin T. Gibbsvariable determines which text editor
8357c7fb079SRuslan Ermilov.Nm
836525689f1SJustin T. Gibbsstarts when editing mode pages.
837525689f1SJustin T. Gibbs.Sh FILES
838525689f1SJustin T. Gibbs.Bl -tag -width /usr/share/misc/scsi_modes -compact
839525689f1SJustin T. Gibbs.It Pa /usr/share/misc/scsi_modes
840525689f1SJustin T. Gibbsis the SCSI mode format database.
841525689f1SJustin T. Gibbs.It Pa /dev/xpt0
842525689f1SJustin T. Gibbsis the transport layer device.
843525689f1SJustin T. Gibbs.It Pa /dev/pass*
844525689f1SJustin T. Gibbsare the CAM application passthrough devices.
845525689f1SJustin T. Gibbs.El
846525689f1SJustin T. Gibbs.Sh EXAMPLES
847525689f1SJustin T. Gibbs.Dl camcontrol eject -n cd -u 1 -v
848525689f1SJustin T. Gibbs.Pp
849525689f1SJustin T. GibbsEject the CD from cd1, and print SCSI sense information if the command
850525689f1SJustin T. Gibbsfails.
851525689f1SJustin T. Gibbs.Pp
852b3550398SKenneth D. Merry.Dl camcontrol tur da0
853525689f1SJustin T. Gibbs.Pp
854525689f1SJustin T. GibbsSend the SCSI test unit ready command to da0.
855e1205e80SPhilippe CharnierThe
8567c7fb079SRuslan Ermilov.Nm
857e1205e80SPhilippe Charnierutility will report whether the disk is ready, but will not display sense
858525689f1SJustin T. Gibbsinformation if the command fails since the
859525689f1SJustin T. Gibbs.Fl v
860525689f1SJustin T. Gibbsswitch was not specified.
861525689f1SJustin T. Gibbs.Pp
862c7938743SMike Pritchard.Bd -literal -offset indent
863c60e19a8SKenneth D. Merrycamcontrol tur da1 -E -C 4 -t 50 -v
864525689f1SJustin T. Gibbs.Ed
865525689f1SJustin T. Gibbs.Pp
8669806e231SRuslan ErmilovSend a test unit ready command to da1.
8679806e231SRuslan ErmilovEnable kernel error recovery.
8689806e231SRuslan ErmilovSpecify a retry count of 4, and a timeout of 50 seconds.
8699806e231SRuslan ErmilovEnable sense
870525689f1SJustin T. Gibbsprinting (with the
871525689f1SJustin T. Gibbs.Fl v
8729806e231SRuslan Ermilovflag) if the command fails.
8739806e231SRuslan ErmilovSince error recovery is turned on, the
874525689f1SJustin T. Gibbsdisk will be spun up if it is not currently spinning.
875e1205e80SPhilippe CharnierThe
8767c7fb079SRuslan Ermilov.Nm
877e1205e80SPhilippe Charnierutility will report whether the disk is ready.
878c7938743SMike Pritchard.Bd -literal -offset indent
879525689f1SJustin T. Gibbscamcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \e
880525689f1SJustin T. Gibbs	-i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1"
881525689f1SJustin T. Gibbs.Ed
882525689f1SJustin T. Gibbs.Pp
8839806e231SRuslan ErmilovIssue a READ BUFFER command (0x3C) to cd1.
8849806e231SRuslan ErmilovDisplay the buffer size of cd1,
8859806e231SRuslan Ermilovand display the first 10 bytes from the cache on cd1.
8869806e231SRuslan ErmilovDisplay SCSI sense
887525689f1SJustin T. Gibbsinformation if the command fails.
888525689f1SJustin T. Gibbs.Pp
889c7938743SMike Pritchard.Bd -literal -offset indent
8908604fe2eSSADA Kenjicamcontrol cmd -n cd -u 1 -v -c "3B 00 00 00 00 00 00 00 0e 00" \e
891525689f1SJustin T. Gibbs	-o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8
892525689f1SJustin T. Gibbs.Ed
893525689f1SJustin T. Gibbs.Pp
8949806e231SRuslan ErmilovIssue a WRITE BUFFER (0x3B) command to cd1.
8959806e231SRuslan ErmilovWrite out 10 bytes of data,
8969806e231SRuslan Ermilovnot including the (reserved) 4 byte header.
8979806e231SRuslan ErmilovPrint out sense information if
8989806e231SRuslan Ermilovthe command fails.
8999806e231SRuslan ErmilovBe very careful with this command, improper use may
900525689f1SJustin T. Gibbscause data corruption.
901525689f1SJustin T. Gibbs.Pp
902c7938743SMike Pritchard.Bd -literal -offset indent
903c60e19a8SKenneth D. Merrycamcontrol modepage da3 -m 1 -e -P 3
90494d09127SKenneth D. Merry.Ed
905525689f1SJustin T. Gibbs.Pp
906525689f1SJustin T. GibbsEdit mode page 1 (the Read-Write Error Recover page) for da3, and save the
9079806e231SRuslan Ermilovsettings on the drive.
9089806e231SRuslan ErmilovMode page 1 contains a disk drive's auto read and
909525689f1SJustin T. Gibbswrite reallocation settings, among other things.
910525689f1SJustin T. Gibbs.Pp
9115710d224SKenneth D. Merry.Dl camcontrol rescan all
9125710d224SKenneth D. Merry.Pp
9135710d224SKenneth D. MerryRescan all SCSI busses in the system for devices that have been added,
9145710d224SKenneth D. Merryremoved or changed.
9155710d224SKenneth D. Merry.Pp
916525689f1SJustin T. Gibbs.Dl camcontrol rescan 0
917525689f1SJustin T. Gibbs.Pp
918525689f1SJustin T. GibbsRescan SCSI bus 0 for devices that have been added, removed or changed.
919525689f1SJustin T. Gibbs.Pp
920525689f1SJustin T. Gibbs.Dl camcontrol rescan 0:1:0
921525689f1SJustin T. Gibbs.Pp
922525689f1SJustin T. GibbsRescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or
923525689f1SJustin T. Gibbschanged.
9249deea857SKenneth D. Merry.Pp
925c60e19a8SKenneth D. Merry.Dl camcontrol tags da5 -N 24
9269deea857SKenneth D. Merry.Pp
9279deea857SKenneth D. MerrySet the number of concurrent transactions for da5 to 24.
9289deea857SKenneth D. Merry.Pp
929c7938743SMike Pritchard.Bd -literal -offset indent
9309deea857SKenneth D. Merrycamcontrol negotiate -n da -u 4 -T disable
9319deea857SKenneth D. Merry.Ed
9329deea857SKenneth D. Merry.Pp
9339deea857SKenneth D. MerryDisable tagged queueing for da4.
9349deea857SKenneth D. Merry.Pp
935c7938743SMike Pritchard.Bd -literal -offset indent
9369deea857SKenneth D. Merrycamcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a
9379deea857SKenneth D. Merry.Ed
9389deea857SKenneth D. Merry.Pp
9399806e231SRuslan ErmilovNegotiate a sync rate of 20MHz and an offset of 15 with da3.
9409806e231SRuslan ErmilovThen send a
9419deea857SKenneth D. MerryTest Unit Ready command to make the settings take effect.
942525689f1SJustin T. Gibbs.Sh SEE ALSO
943525689f1SJustin T. Gibbs.Xr cam 3 ,
9449deea857SKenneth D. Merry.Xr cam_cdbparse 3 ,
945c0bdb22bSMatthew Hunt.Xr cam 4 ,
946525689f1SJustin T. Gibbs.Xr pass 4 ,
947c0bdb22bSMatthew Hunt.Xr xpt 4
948525689f1SJustin T. Gibbs.Sh HISTORY
949525689f1SJustin T. GibbsThe
9507c7fb079SRuslan Ermilov.Nm
951e1205e80SPhilippe Charnierutility first appeared in
952525689f1SJustin T. Gibbs.Fx 3.0 .
953525689f1SJustin T. Gibbs.Pp
954525689f1SJustin T. GibbsThe mode page editing code and arbitrary SCSI command code are based upon
955525689f1SJustin T. Gibbscode in the old
956525689f1SJustin T. Gibbs.Xr scsi 8
957525689f1SJustin T. Gibbsutility and
958525689f1SJustin T. Gibbs.Xr scsi 3
9599806e231SRuslan Ermilovlibrary, written by Julian Elischer and Peter Dufault.
9609806e231SRuslan ErmilovThe
961525689f1SJustin T. Gibbs.Xr scsi 8
962753d686dSRuslan Ermilovprogram first appeared in
963753d686dSRuslan Ermilov.Bx 386 0.1.2.4 ,
964753d686dSRuslan Ermilovand first appeared in
96533fab22eSKenneth D. Merry.Fx
966525689f1SJustin T. Gibbsin
967525689f1SJustin T. Gibbs.Fx 2.0.5 .
968525689f1SJustin T. Gibbs.Sh AUTHORS
969aa7c9adaSMike Pritchard.An Kenneth Merry Aq ken@FreeBSD.org
970525689f1SJustin T. Gibbs.Sh BUGS
9710227791bSRuslan ErmilovThe code that parses the generic command line arguments does not know that
9729806e231SRuslan Ermilovsome of the subcommands take multiple arguments.
9739806e231SRuslan ErmilovSo if, for instance, you
974525689f1SJustin T. Gibbstried something like this:
975c7938743SMike Pritchard.Bd -literal -offset indent
976b9e3972aSKenneth D. Merrycamcontrol cmd -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v
977525689f1SJustin T. Gibbs.Ed
978525689f1SJustin T. Gibbs.Pp
979525689f1SJustin T. GibbsThe sense information from the test unit ready command would not get
980525689f1SJustin T. Gibbsprinted out, since the first
981525689f1SJustin T. Gibbs.Xr getopt 3
982525689f1SJustin T. Gibbscall in
9837c7fb079SRuslan Ermilov.Nm
984525689f1SJustin T. Gibbsbails out when it sees the second argument to
985525689f1SJustin T. Gibbs.Fl c
986c4d9468eSRuslan Ermilov(0x00),
9879806e231SRuslan Ermilovabove.
9889806e231SRuslan ErmilovFixing this behavior would take some gross code, or changes to the
989525689f1SJustin T. Gibbs.Xr getopt 3
9909806e231SRuslan Ermilovinterface.
9919806e231SRuslan ErmilovThe best way to circumvent this problem is to always make sure
992525689f1SJustin T. Gibbsto specify generic
9937c7fb079SRuslan Ermilov.Nm
994525689f1SJustin T. Gibbsarguments before any command-specific arguments.
995