xref: /freebsd/sbin/camcontrol/camcontrol.8 (revision f553b7b391ba8c5b84096cd98b3e8a04c87b9679)
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.\"
308266d476SRuslan Ermilov.Dd August 21, 2006
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
6242cb6a80SKenneth D. Merry.Ic reportluns
6342cb6a80SKenneth D. Merry.Op device id
6442cb6a80SKenneth D. Merry.Op generic args
6542cb6a80SKenneth D. Merry.Op Fl c
6642cb6a80SKenneth D. Merry.Op Fl l
6742cb6a80SKenneth D. Merry.Op Fl r Ar reporttype
6842cb6a80SKenneth D. Merry.Nm
69f553b7b3SKenneth D. Merry.Ic readcap
70f553b7b3SKenneth D. Merry.Op device id
71f553b7b3SKenneth D. Merry.Op generic args
72f553b7b3SKenneth D. Merry.Op Fl b
73f553b7b3SKenneth D. Merry.Op Fl h
74f553b7b3SKenneth D. Merry.Op Fl H
75f553b7b3SKenneth D. Merry.Op Fl N
76f553b7b3SKenneth D. Merry.Op Fl q
77f553b7b3SKenneth D. Merry.Op Fl s
78f553b7b3SKenneth D. Merry.Nm
7933fab22eSKenneth D. Merry.Ic start
80c60e19a8SKenneth D. Merry.Op device id
81525689f1SJustin T. Gibbs.Op generic args
827c7fb079SRuslan Ermilov.Nm
8333fab22eSKenneth D. Merry.Ic stop
84c60e19a8SKenneth D. Merry.Op device id
85525689f1SJustin T. Gibbs.Op generic args
867c7fb079SRuslan Ermilov.Nm
87f9cecca2SMatthew N. Dodd.Ic load
88f9cecca2SMatthew N. Dodd.Op device id
89f9cecca2SMatthew N. Dodd.Op generic args
90f9cecca2SMatthew N. Dodd.Nm
9133fab22eSKenneth D. Merry.Ic eject
92c60e19a8SKenneth D. Merry.Op device id
93525689f1SJustin T. Gibbs.Op generic args
947c7fb079SRuslan Ermilov.Nm
9533fab22eSKenneth D. Merry.Ic rescan
965710d224SKenneth D. Merry.Aq all | bus Ns Op :target:lun
977c7fb079SRuslan Ermilov.Nm
9833fab22eSKenneth D. Merry.Ic reset
995710d224SKenneth D. Merry.Aq all | bus Ns Op :target:lun
1007c7fb079SRuslan Ermilov.Nm
10133fab22eSKenneth D. Merry.Ic defects
102c60e19a8SKenneth D. Merry.Op device id
103525689f1SJustin T. Gibbs.Op generic args
104525689f1SJustin T. Gibbs.Aq Fl f Ar format
105525689f1SJustin T. Gibbs.Op Fl P
106525689f1SJustin T. Gibbs.Op Fl G
1077c7fb079SRuslan Ermilov.Nm
10833fab22eSKenneth D. Merry.Ic modepage
109c60e19a8SKenneth D. Merry.Op device id
110525689f1SJustin T. Gibbs.Op generic args
1119916c5d2SRuslan Ermilov.Aq Fl m Ar page | Fl l
1121ac2383cSBill Fumerola.Op Fl P Ar pgctl
1137e32b20dSKelly Yancey.Op Fl b | Fl e
114525689f1SJustin T. Gibbs.Op Fl d
1157c7fb079SRuslan Ermilov.Nm
11633fab22eSKenneth D. Merry.Ic cmd
117c60e19a8SKenneth D. Merry.Op device id
118525689f1SJustin T. Gibbs.Op generic args
119525689f1SJustin T. Gibbs.Aq Fl c Ar cmd Op args
120525689f1SJustin T. Gibbs.Op Fl i Ar len Ar fmt
121525689f1SJustin T. Gibbs.Bk -words
122525689f1SJustin T. Gibbs.Op Fl o Ar len Ar fmt Op args
123525689f1SJustin T. Gibbs.Ek
1247c7fb079SRuslan Ermilov.Nm
12533fab22eSKenneth D. Merry.Ic debug
126525689f1SJustin T. Gibbs.Op Fl I
127a7e5261eSNate Lawson.Op Fl P
128525689f1SJustin T. Gibbs.Op Fl T
129525689f1SJustin T. Gibbs.Op Fl S
130a7e5261eSNate Lawson.Op Fl X
13194d09127SKenneth D. Merry.Op Fl c
132525689f1SJustin T. Gibbs.Aq all|off|bus Ns Op :target Ns Op :lun
1337c7fb079SRuslan Ermilov.Nm
13433fab22eSKenneth D. Merry.Ic tags
135c60e19a8SKenneth D. Merry.Op device id
1369deea857SKenneth D. Merry.Op generic args
1379deea857SKenneth D. Merry.Op Fl N Ar tags
1389deea857SKenneth D. Merry.Op Fl q
1399deea857SKenneth D. Merry.Op Fl v
1407c7fb079SRuslan Ermilov.Nm
14133fab22eSKenneth D. Merry.Ic negotiate
142c60e19a8SKenneth D. Merry.Op device id
1439deea857SKenneth D. Merry.Op generic args
1449deea857SKenneth D. Merry.Op Fl c
1459deea857SKenneth D. Merry.Op Fl D Ar enable|disable
1469deea857SKenneth D. Merry.Op Fl O Ar offset
1479deea857SKenneth D. Merry.Op Fl q
1489deea857SKenneth D. Merry.Op Fl R Ar syncrate
1499deea857SKenneth D. Merry.Op Fl T Ar enable|disable
1509deea857SKenneth D. Merry.Op Fl U
1519deea857SKenneth D. Merry.Op Fl W Ar bus_width
1529deea857SKenneth D. Merry.Op Fl v
1537c7fb079SRuslan Ermilov.Nm
15433fab22eSKenneth D. Merry.Ic format
15596a93c63SKenneth D. Merry.Op device id
15696a93c63SKenneth D. Merry.Op generic args
15796a93c63SKenneth D. Merry.Op Fl q
158e9e4d3e4SKenneth D. Merry.Op Fl r
15996a93c63SKenneth D. Merry.Op Fl w
16096a93c63SKenneth D. Merry.Op Fl y
1617c7fb079SRuslan Ermilov.Nm
16233fab22eSKenneth D. Merry.Ic help
163525689f1SJustin T. Gibbs.Sh DESCRIPTION
164e1205e80SPhilippe CharnierThe
1657c7fb079SRuslan Ermilov.Nm
166e1205e80SPhilippe Charnierutility is designed to provide a way for users to access and control the
16733fab22eSKenneth D. Merry.Fx
168525689f1SJustin T. GibbsCAM subsystem.
169525689f1SJustin T. Gibbs.Pp
170e1205e80SPhilippe CharnierThe
1717c7fb079SRuslan Ermilov.Nm
172e1205e80SPhilippe Charnierutility
1739806e231SRuslan Ermilovcan cause a loss of data and/or system crashes if used improperly.
1749806e231SRuslan ErmilovEven
1759deea857SKenneth D. Merryexpert users are encouraged to exercise caution when using this command.
176525689f1SJustin T. GibbsNovice users should stay away from this utility.
177525689f1SJustin T. Gibbs.Pp
178e1205e80SPhilippe CharnierThe
1797c7fb079SRuslan Ermilov.Nm
180e1205e80SPhilippe Charnierutility has a number of primary functions, many of which support an optional
1819806e231SRuslan Ermilovdevice identifier.
1829806e231SRuslan ErmilovA device identifier can take one of three forms:
1831252c1bbSRuslan Ermilov.Bl -tag -width 14n
184c60e19a8SKenneth D. Merry.It deviceUNIT
185c60e19a8SKenneth D. MerrySpecify a device name and unit number combination, like "da5" or "cd3".
1869806e231SRuslan ErmilovNote that character device node names (e.g.\& /dev/da0) are
187c60e19a8SKenneth D. Merry.Em not
188c60e19a8SKenneth D. Merryallowed here.
189c60e19a8SKenneth D. Merry.It bus:target
1909806e231SRuslan ErmilovSpecify a bus number and target id.
1919806e231SRuslan ErmilovThe bus number can be determined from
192c60e19a8SKenneth D. Merrythe output of
193c60e19a8SKenneth D. Merry.Dq camcontrol devlist .
194c60e19a8SKenneth D. MerryThe lun defaults to 0.
195c60e19a8SKenneth D. Merry.It bus:target:lun
1969806e231SRuslan ErmilovSpecify the bus, target and lun for a device.
1979806e231SRuslan Ermilov(e.g.\& 1:2:0)
198c60e19a8SKenneth D. Merry.El
199c60e19a8SKenneth D. Merry.Pp
200c60e19a8SKenneth D. MerryThe device identifier, if it is specified,
201c60e19a8SKenneth D. Merry.Em must
202c60e19a8SKenneth D. Merrycome immediately after the function name, and before any generic or
2039806e231SRuslan Ermilovfunction-specific arguments.
2049806e231SRuslan ErmilovNote that the
205c60e19a8SKenneth D. Merry.Fl n
206c60e19a8SKenneth D. Merryand
207c60e19a8SKenneth D. Merry.Fl u
208c60e19a8SKenneth D. Merryarguments described below will override any device name or unit number
2099806e231SRuslan Ermilovspecified beforehand.
2109806e231SRuslan ErmilovThe
211c60e19a8SKenneth D. Merry.Fl n
212c60e19a8SKenneth D. Merryand
213c60e19a8SKenneth D. Merry.Fl u
214c60e19a8SKenneth D. Merryarguments will
215c60e19a8SKenneth D. Merry.Em not
21696a93c63SKenneth D. Merryoverride a specified bus:target or bus:target:lun, however.
217c60e19a8SKenneth D. Merry.Pp
218c60e19a8SKenneth D. MerryMost of the
2197c7fb079SRuslan Ermilov.Nm
220c60e19a8SKenneth D. Merryprimary functions support these generic arguments:
2211252c1bbSRuslan Ermilov.Bl -tag -width 14n
222525689f1SJustin T. Gibbs.It Fl C Ar count
2239806e231SRuslan ErmilovSCSI command retry count.
2249806e231SRuslan ErmilovIn order for this to work, error recovery
2251252c1bbSRuslan Ermilov.Pq Fl E
226525689f1SJustin T. Gibbsmust be turned on.
227525689f1SJustin T. Gibbs.It Fl E
228525689f1SJustin T. GibbsInstruct the kernel to perform generic SCSI error recovery for the given
2299806e231SRuslan Ermilovcommand.
2309806e231SRuslan ErmilovThis is needed in order for the retry count
2311252c1bbSRuslan Ermilov.Pq Fl C
2329806e231SRuslan Ermilovto be honored.
2339806e231SRuslan ErmilovOther than retrying commands, the generic error recovery in
234525689f1SJustin T. Gibbsthe code will generally attempt to spin up drives that are not spinning.
235525689f1SJustin T. GibbsIt may take some other actions, depending upon the sense code returned from
236525689f1SJustin T. Gibbsthe command.
237525689f1SJustin T. Gibbs.It Fl n Ar dev_name
2389806e231SRuslan ErmilovSpecify the device type to operate on, e.g.\& "da", "cd".
239525689f1SJustin T. Gibbs.It Fl t Ar timeout
2409806e231SRuslan ErmilovSCSI command timeout in seconds.
2419806e231SRuslan ErmilovThis overrides the default timeout for
242525689f1SJustin T. Gibbsany given command.
243525689f1SJustin T. Gibbs.It Fl u Ar unit_number
2449806e231SRuslan ErmilovSpecify the device unit number, e.g.\& "1", "5".
245525689f1SJustin T. Gibbs.It Fl v
246525689f1SJustin T. GibbsBe verbose, print out sense information for failed SCSI commands.
247525689f1SJustin T. Gibbs.El
248525689f1SJustin T. Gibbs.Pp
249d13d1cd2SKenneth D. MerryPrimary command functions:
250525689f1SJustin T. Gibbs.Bl -tag -width periphlist
25133fab22eSKenneth D. Merry.It Ic devlist
252525689f1SJustin T. GibbsList all physical devices (logical units) attached to the CAM subsystem.
253525689f1SJustin T. GibbsThis also includes a list of peripheral drivers attached to each device.
254525689f1SJustin T. GibbsWith the
255525689f1SJustin T. Gibbs.Fl v
256525689f1SJustin T. Gibbsargument, SCSI bus number, adapter name and unit numbers are printed as
257525689f1SJustin T. Gibbswell.
25833fab22eSKenneth D. Merry.It Ic periphlist
259525689f1SJustin T. GibbsList all peripheral drivers attached to a given physical device (logical
260525689f1SJustin T. Gibbsunit).
26133fab22eSKenneth D. Merry.It Ic tur
262525689f1SJustin T. GibbsSend the SCSI test unit ready (0x00) command to the given device.
263e1205e80SPhilippe CharnierThe
2647c7fb079SRuslan Ermilov.Nm
265e1205e80SPhilippe Charnierutility will report whether the device is ready or not.
26633fab22eSKenneth D. Merry.It Ic inquiry
2679806e231SRuslan ErmilovSend a SCSI inquiry command (0x12) to a device.
2689806e231SRuslan ErmilovBy default,
2697c7fb079SRuslan Ermilov.Nm
270525689f1SJustin T. Gibbswill print out the standard inquiry data, device serial number, and
2719806e231SRuslan Ermilovtransfer rate information.
2729806e231SRuslan ErmilovThe user can specify that only certain types of
273525689f1SJustin T. Gibbsinquiry data be printed:
2741252c1bbSRuslan Ermilov.Bl -tag -width 4n
275525689f1SJustin T. Gibbs.It Fl D
276525689f1SJustin T. GibbsGet the standard inquiry data.
277525689f1SJustin T. Gibbs.It Fl S
2789806e231SRuslan ErmilovPrint out the serial number.
2799806e231SRuslan ErmilovIf this flag is the only one specified,
2807c7fb079SRuslan Ermilov.Nm
281525689f1SJustin T. Gibbswill not print out "Serial Number" before the value returned by the drive.
282525689f1SJustin T. GibbsThis is to aid in script writing.
283525689f1SJustin T. Gibbs.It Fl R
284525689f1SJustin T. GibbsPrint out transfer rate information.
285525689f1SJustin T. Gibbs.El
28642cb6a80SKenneth D. Merry.It Ic reportluns
28742cb6a80SKenneth D. MerrySend the SCSI REPORT LUNS (0xA0) command to the given device.
28842cb6a80SKenneth D. MerryBy default,
28942cb6a80SKenneth D. Merry.Nm
29042cb6a80SKenneth D. Merrywill print out the list of logical units (LUNs) supported by the target device.
29142cb6a80SKenneth D. MerryThere are a couple of options to modify the output:
2928266d476SRuslan Ermilov.Bl -tag -width 14n
29342cb6a80SKenneth D. Merry.It Fl c
29442cb6a80SKenneth D. MerryJust print out a count of LUNs, not the actual LUN numbers.
29542cb6a80SKenneth D. Merry.It Fl l
29642cb6a80SKenneth D. MerryJust print out the LUNs, and don't print out the count.
29742cb6a80SKenneth D. Merry.It Fl r Ar reporttype
29842cb6a80SKenneth D. MerrySpecify the type of report to request from the target:
29942cb6a80SKenneth D. Merry.Bl -tag -width 012345678
30042cb6a80SKenneth D. Merry.It default
30142cb6a80SKenneth D. MerryReturn the default report.
30242cb6a80SKenneth D. MerryThis is the
30342cb6a80SKenneth D. Merry.Nm
30442cb6a80SKenneth D. Merrydefault.
30542cb6a80SKenneth D. MerryMost targets will support this report if they support the REPORT LUNS
30642cb6a80SKenneth D. Merrycommand.
30742cb6a80SKenneth D. Merry.It wellknown
30842cb6a80SKenneth D. MerryReturn only well known LUNs.
30942cb6a80SKenneth D. Merry.It all
31042cb6a80SKenneth D. MerryReturn all available LUNs.
31142cb6a80SKenneth D. Merry.El
31242cb6a80SKenneth D. Merry.El
31342cb6a80SKenneth D. Merry.Pp
31442cb6a80SKenneth D. Merry.Nm
31542cb6a80SKenneth D. Merrywill try to print out LUN numbers in a reasonable format.
31642cb6a80SKenneth D. MerryIt can understand the peripheral, flat, LUN and extended LUN formats.
317f553b7b3SKenneth D. Merry.It Ic readcap
318f553b7b3SKenneth D. MerrySend the SCSI READ CAPACITY command to the given device and display
319f553b7b3SKenneth D. Merrythe results.
320f553b7b3SKenneth D. MerryIf the device is larger than 2TB, the SCSI READ CAPACITY (16) service
321f553b7b3SKenneth D. Merryaction will be sent to obtain the full size of the device.
322f553b7b3SKenneth D. MerryBy default,
323f553b7b3SKenneth D. Merry.Nm
324f553b7b3SKenneth D. Merrywill print out the last logical block of the device, and the blocksize of
325f553b7b3SKenneth D. Merrythe device in bytes.
326f553b7b3SKenneth D. MerryTo modify the output format, use the following options:
327f553b7b3SKenneth D. Merry.Bl -tag -width 5n
328f553b7b3SKenneth D. Merry.It Fl b
329f553b7b3SKenneth D. MerryJust print out the blocksize, not the last block or device size.
330f553b7b3SKenneth D. MerryThis cannot be used with
331f553b7b3SKenneth D. Merry.Fl N
332f553b7b3SKenneth D. Merryor
333f553b7b3SKenneth D. Merry.Fl s .
334f553b7b3SKenneth D. Merry.It Fl h
335f553b7b3SKenneth D. MerryPrint out the device size in human readable (base 2, 1K == 1024) format.
336f553b7b3SKenneth D. MerryThis implies
337f553b7b3SKenneth D. Merry.Fl N
338f553b7b3SKenneth D. Merryand cannot be used with
339f553b7b3SKenneth D. Merry.Fl q
340f553b7b3SKenneth D. Merryor
341f553b7b3SKenneth D. Merry.Fl b .
342f553b7b3SKenneth D. Merry.It Fl H
343f553b7b3SKenneth D. MerryPrint out the device size in human readable (base 10, 1K == 1000) format.
344f553b7b3SKenneth D. Merry.It Fl N
345f553b7b3SKenneth D. MerryPrint out the number of blocks in the device instead of the last logical
346f553b7b3SKenneth D. Merryblock.
347f553b7b3SKenneth D. Merry.It Fl q
348f553b7b3SKenneth D. MerryQuiet, print out the numbers only (separated by a comma if
349f553b7b3SKenneth D. Merry.Fl b
350f553b7b3SKenneth D. Merryor
351f553b7b3SKenneth D. Merry.Fl s
352f553b7b3SKenneth D. Merryare not specified).
353f553b7b3SKenneth D. Merry.It Fl s
354f553b7b3SKenneth D. MerryPrint out the last logical block or the size of the device only, and omit
355f553b7b3SKenneth D. Merrythe blocksize.
356f553b7b3SKenneth D. Merry.El
35733fab22eSKenneth D. Merry.It Ic start
358525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the
359525689f1SJustin T. Gibbsstart bit set.
36033fab22eSKenneth D. Merry.It Ic stop
361525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the
362525689f1SJustin T. Gibbsstart bit cleared.
363f9cecca2SMatthew N. Dodd.It Ic load
364f9cecca2SMatthew N. DoddSend the SCSI Start/Stop Unit (0x1B) command to the given device with the
365f9cecca2SMatthew N. Doddstart bit set and the load/eject bit set.
36633fab22eSKenneth D. Merry.It Ic eject
367525689f1SJustin T. GibbsSend the SCSI Start/Stop Unit (0x1B) command to the given device with the
368f9cecca2SMatthew N. Doddstart bit cleared and the load/eject bit set.
36933fab22eSKenneth D. Merry.It Ic rescan
3705710d224SKenneth D. MerryTell the kernel to scan all busses in the system (with the
3715710d224SKenneth D. Merry.Ar all
3725710d224SKenneth D. Merryargument), the given bus (XPT_SCAN_BUS), or bus:target:lun
3739806e231SRuslan Ermilov(XPT_SCAN_LUN) for new devices or devices that have gone away.
3749806e231SRuslan ErmilovThe user
3759806e231SRuslan Ermilovmay specify a scan of all busses, a single bus, or a lun.
3769806e231SRuslan ErmilovScanning all luns
3770227791bSRuslan Ermilovon a target is not supported.
37833fab22eSKenneth D. Merry.It Ic reset
3795710d224SKenneth D. MerryTell the kernel to reset all busses in the system (with the
3805710d224SKenneth D. Merry.Ar all
3815710d224SKenneth D. Merryargument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus
382a2a44836SMatt Jacobreset for that bus, or to reset the given bus:target:lun
383a2a44836SMatt Jacob(XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after
384ef8f7ac9SSheldon Hearnconnecting to that device.
385ef8f7ac9SSheldon HearnNote that this can have a destructive impact
386a2a44836SMatt Jacobon the system.
38733fab22eSKenneth D. Merry.It Ic defects
388525689f1SJustin T. GibbsSend the SCSI READ DEFECT DATA (10) command (0x37) to the given device, and
389525689f1SJustin T. Gibbsprint out any combination of: the total number of defects, the primary
390525689f1SJustin T. Gibbsdefect list (PLIST), and the grown defect list (GLIST).
3911252c1bbSRuslan Ermilov.Bl -tag -width 11n
392525689f1SJustin T. Gibbs.It Fl f Ar format
393525689f1SJustin T. GibbsThe three format options are:
394525689f1SJustin T. Gibbs.Em block ,
395525689f1SJustin T. Gibbsto print out the list as logical blocks,
396525689f1SJustin T. Gibbs.Em bfi ,
397525689f1SJustin T. Gibbsto print out the list in bytes from index format, and
398525689f1SJustin T. Gibbs.Em phys ,
3999806e231SRuslan Ermilovto print out the list in physical sector format.
4009806e231SRuslan ErmilovThe format argument is
4019806e231SRuslan Ermilovrequired.
4029806e231SRuslan ErmilovMost drives support the physical sector format.
4039806e231SRuslan ErmilovSome drives
4049806e231SRuslan Ermilovsupport the logical block format.
4050227791bSRuslan ErmilovMany drives, if they do not support the
406525689f1SJustin T. Gibbsrequested format, return the data in an alternate format, along with sense
4070227791bSRuslan Ermilovinformation indicating that the requested data format is not supported.
408e1205e80SPhilippe CharnierThe
4097c7fb079SRuslan Ermilov.Nm
410e1205e80SPhilippe Charnierutility
411525689f1SJustin T. Gibbsattempts to detect this, and print out whatever format the drive returns.
4120227791bSRuslan ErmilovIf the drive uses a non-standard sense code to report that it does not
413525689f1SJustin T. Gibbssupport the requested format,
4147c7fb079SRuslan Ermilov.Nm
415525689f1SJustin T. Gibbswill probably see the error as a failure to complete the request.
416525689f1SJustin T. Gibbs.It Fl G
4179806e231SRuslan ErmilovPrint out the grown defect list.
4189806e231SRuslan ErmilovThis is a list of bad blocks that have
419525689f1SJustin T. Gibbsbeen remapped since the disk left the factory.
420525689f1SJustin T. Gibbs.It Fl P
421525689f1SJustin T. GibbsPrint out the primary defect list.
422525689f1SJustin T. Gibbs.El
423525689f1SJustin T. Gibbs.Pp
424525689f1SJustin T. GibbsIf neither
425525689f1SJustin T. Gibbs.Fl P
426525689f1SJustin T. Gibbsnor
427525689f1SJustin T. Gibbs.Fl G
428525689f1SJustin T. Gibbsis specified,
4297c7fb079SRuslan Ermilov.Nm
430525689f1SJustin T. Gibbswill print out the number of defects given in the READ DEFECT DATA header
431525689f1SJustin T. Gibbsreturned from the drive.
43233fab22eSKenneth D. Merry.It Ic modepage
4339806e231SRuslan ErmilovAllows the user to display and optionally edit a SCSI mode page.
4349806e231SRuslan ErmilovThe mode
435525689f1SJustin T. Gibbspage formats are located in
436525689f1SJustin T. Gibbs.Pa /usr/share/misc/scsi_modes .
437525689f1SJustin T. GibbsThis can be overridden by specifying a different file in the
438525689f1SJustin T. Gibbs.Ev SCSI_MODES
43933fab22eSKenneth D. Merryenvironment variable.
44033fab22eSKenneth D. MerryThe
44133fab22eSKenneth D. Merry.Ic modepage
44233fab22eSKenneth D. Merrycommand takes several arguments:
4431252c1bbSRuslan Ermilov.Bl -tag -width 12n
4449deea857SKenneth D. Merry.It Fl d
445525689f1SJustin T. GibbsDisable block descriptors for mode sense.
4467e32b20dSKelly Yancey.It Fl b
4477e32b20dSKelly YanceyDisplays mode page data in binary format.
448525689f1SJustin T. Gibbs.It Fl e
4499806e231SRuslan ErmilovThis flag allows the user to edit values in the mode page.
4509806e231SRuslan ErmilovThe user may
4517e32b20dSKelly Yanceyeither edit mode page values with the text editor pointed to by his
4527e32b20dSKelly Yancey.Ev EDITOR
4537e32b20dSKelly Yanceyenvironment variable, or supply mode page values via standard input, using
4547e32b20dSKelly Yanceythe same format that
4557c7fb079SRuslan Ermilov.Nm
4569806e231SRuslan Ermilovuses to display mode page values.
4579806e231SRuslan ErmilovThe editor will be invoked if
4587c7fb079SRuslan Ermilov.Nm
4597e32b20dSKelly Yanceydetects that standard input is terminal.
4607e32b20dSKelly Yancey.It Fl l
4617e32b20dSKelly YanceyLists all available mode pages.
462525689f1SJustin T. Gibbs.It Fl m Ar mode_page
463525689f1SJustin T. GibbsThis specifies the number of the mode page the user would like to view
4649806e231SRuslan Ermilovand/or edit.
4659806e231SRuslan ErmilovThis argument is mandatory unless
4669402dd99SKelly Yancey.Fl l
4679402dd99SKelly Yanceyis specified.
4681ac2383cSBill Fumerola.It Fl P Ar pgctl
4699806e231SRuslan ErmilovThis allows the user to specify the page control field.
4709806e231SRuslan ErmilovPossible values are:
471525689f1SJustin T. Gibbs.Bl -tag -width xxx -compact
47246a1f3b4SKenneth D. Merry.It 0
473525689f1SJustin T. GibbsCurrent values
47446a1f3b4SKenneth D. Merry.It 1
475525689f1SJustin T. GibbsChangeable values
47646a1f3b4SKenneth D. Merry.It 2
477525689f1SJustin T. GibbsDefault values
47846a1f3b4SKenneth D. Merry.It 3
479525689f1SJustin T. GibbsSaved values
480525689f1SJustin T. Gibbs.El
481525689f1SJustin T. Gibbs.El
48233fab22eSKenneth D. Merry.It Ic cmd
48333fab22eSKenneth D. MerryAllows the user to send an arbitrary SCSI CDB to any device.
48433fab22eSKenneth D. MerryThe
48533fab22eSKenneth D. Merry.Ic cmd
486525689f1SJustin T. Gibbsfunction requires the
487525689f1SJustin T. Gibbs.Fl c
4889806e231SRuslan Ermilovargument to specify the CDB.
4899806e231SRuslan ErmilovOther arguments are optional, depending on
4909806e231SRuslan Ermilovthe command type.
4919806e231SRuslan ErmilovThe command and data specification syntax is documented
492525689f1SJustin T. Gibbsin
49396a93c63SKenneth D. Merry.Xr cam_cdbparse 3 .
494525689f1SJustin T. GibbsNOTE: If the CDB specified causes data to be transfered to or from the
495525689f1SJustin T. GibbsSCSI device in question, you MUST specify either
496525689f1SJustin T. Gibbs.Fl i
497525689f1SJustin T. Gibbsor
498525689f1SJustin T. Gibbs.Fl o .
4991252c1bbSRuslan Ermilov.Bl -tag -width 17n
500525689f1SJustin T. Gibbs.It Fl c Ar cmd Op args
5019806e231SRuslan ErmilovThis specifies the SCSI CDB.
5029806e231SRuslan ErmilovCDBs may be 6, 10, 12 or 16 bytes.
503525689f1SJustin T. Gibbs.It Fl i Ar len Ar fmt
504525689f1SJustin T. GibbsThis specifies the amount of data to read, and how it should be displayed.
505525689f1SJustin T. GibbsIf the format is
506525689f1SJustin T. Gibbs.Sq - ,
507525689f1SJustin T. Gibbs.Ar len
508525689f1SJustin T. Gibbsbytes of data will be read from the device and written to standard output.
509525689f1SJustin T. Gibbs.It Fl o Ar len Ar fmt Op args
510525689f1SJustin T. GibbsThis specifies the amount of data to be written to a device, and the data
5119806e231SRuslan Ermilovthat is to be written.
5129806e231SRuslan ErmilovIf the format is
513525689f1SJustin T. Gibbs.Sq - ,
514525689f1SJustin T. Gibbs.Ar len
515525689f1SJustin T. Gibbsbytes of data will be read from standard input and written to the device.
516525689f1SJustin T. Gibbs.El
51733fab22eSKenneth D. Merry.It Ic debug
5189806e231SRuslan ErmilovTurn on CAM debugging printfs in the kernel.
5199806e231SRuslan ErmilovThis requires options CAMDEBUG
5209806e231SRuslan Ermilovin your kernel config file.
5219806e231SRuslan ErmilovWARNING: enabling debugging printfs currently
5229806e231SRuslan Ermilovcauses an EXTREME number of kernel printfs.
5239806e231SRuslan ErmilovYou may have difficulty
524525689f1SJustin T. Gibbsturning off the debugging printfs once they start, since the kernel will be
525525689f1SJustin T. Gibbsbusy printing messages and unable to service other requests quickly.
52633fab22eSKenneth D. MerryThe
52733fab22eSKenneth D. Merry.Ic debug
52833fab22eSKenneth D. Merryfunction takes a number of arguments:
5291252c1bbSRuslan Ermilov.Bl -tag -width 18n
530525689f1SJustin T. Gibbs.It Fl I
531525689f1SJustin T. GibbsEnable CAM_DEBUG_INFO printfs.
532a7e5261eSNate Lawson.It Fl P
533a7e5261eSNate LawsonEnable CAM_DEBUG_PERIPH printfs.
534525689f1SJustin T. Gibbs.It Fl T
535525689f1SJustin T. GibbsEnable CAM_DEBUG_TRACE printfs.
536525689f1SJustin T. Gibbs.It Fl S
537525689f1SJustin T. GibbsEnable CAM_DEBUG_SUBTRACE printfs.
538a7e5261eSNate Lawson.It Fl X
539a7e5261eSNate LawsonEnable CAM_DEBUG_XPT printfs.
540d05caa00SKenneth D. Merry.It Fl c
5419806e231SRuslan ErmilovEnable CAM_DEBUG_CDB printfs.
5429806e231SRuslan ErmilovThis will cause the kernel to print out the
543d05caa00SKenneth D. MerrySCSI CDBs sent to the specified device(s).
544525689f1SJustin T. Gibbs.It all
545525689f1SJustin T. GibbsEnable debugging for all devices.
546525689f1SJustin T. Gibbs.It off
547525689f1SJustin T. GibbsTurn off debugging for all devices
548525689f1SJustin T. Gibbs.It bus Ns Op :target Ns Op :lun
5499806e231SRuslan ErmilovTurn on debugging for the given bus, target or lun.
5509806e231SRuslan ErmilovIf the lun or target
5519806e231SRuslan Ermilovand lun are not specified, they are wildcarded.
5529806e231SRuslan Ermilov(i.e., just specifying a
553525689f1SJustin T. Gibbsbus turns on debugging printfs for all devices on that bus.)
554525689f1SJustin T. Gibbs.El
55533fab22eSKenneth D. Merry.It Ic tags
5569deea857SKenneth D. MerryShow or set the number of "tagged openings" or simultaneous transactions
5579806e231SRuslan Ermilovwe attempt to queue to a particular device.
5589806e231SRuslan ErmilovBy default, the
55933fab22eSKenneth D. Merry.Ic tags
5609806e231SRuslan Ermilovcommand, with no command-specific arguments (i.e., only generic arguments)
5619deea857SKenneth D. Merryprints out the "soft" maximum number of transactions that can be queued to
5629806e231SRuslan Ermilovthe device in question.
5639806e231SRuslan ErmilovFor more detailed information, use the
5649deea857SKenneth D. Merry.Fl v
5659deea857SKenneth D. Merryargument described below.
5661252c1bbSRuslan Ermilov.Bl -tag -width 7n
5679deea857SKenneth D. Merry.It Fl N Ar tags
5689806e231SRuslan ErmilovSet the number of tags for the given device.
5699806e231SRuslan ErmilovThis must be between the
5709806e231SRuslan Ermilovminimum and maximum number set in the kernel quirk table.
5719806e231SRuslan ErmilovThe default for
5729deea857SKenneth D. Merrymost devices that support tagged queueing is a minimum of 2 and a maximum
5739806e231SRuslan Ermilovof 255.
5749806e231SRuslan ErmilovThe minimum and maximum values for a given device may be
5759deea857SKenneth D. Merrydetermined by using the
5769deea857SKenneth D. Merry.Fl v
5779806e231SRuslan Ermilovswitch.
5789806e231SRuslan ErmilovThe meaning of the
5799deea857SKenneth D. Merry.Fl v
5809deea857SKenneth D. Merryswitch for this
5817c7fb079SRuslan Ermilov.Nm
5829deea857SKenneth D. Merrysubcommand is described below.
5839deea857SKenneth D. Merry.It Fl q
5840227791bSRuslan ErmilovBe quiet, and do not report the number of tags.
5859806e231SRuslan ErmilovThis is generally used when
5869deea857SKenneth D. Merrysetting the number of tags.
5879deea857SKenneth D. Merry.It Fl v
5889deea857SKenneth D. MerryThe verbose flag has special functionality for the
5899deea857SKenneth D. Merry.Em tags
5909806e231SRuslan Ermilovargument.
5919806e231SRuslan ErmilovIt causes
5927c7fb079SRuslan Ermilov.Nm
5939deea857SKenneth D. Merryto print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB:
5941252c1bbSRuslan Ermilov.Bl -tag -width 13n
5959deea857SKenneth D. Merry.It dev_openings
5969deea857SKenneth D. MerryThis is the amount of capacity for transactions queued to a given device.
5979deea857SKenneth D. Merry.It dev_active
5989deea857SKenneth D. MerryThis is the number of transactions currently queued to a device.
5999deea857SKenneth D. Merry.It devq_openings
6009806e231SRuslan ErmilovThis is the kernel queue space for transactions.
6019806e231SRuslan ErmilovThis count usually mirrors
6029deea857SKenneth D. Merrydev_openings except during error recovery operations when
6039deea857SKenneth D. Merrythe device queue is frozen (device is not allowed to receive
6049deea857SKenneth D. Merrycommands), the number of dev_openings is reduced, or transaction
6059deea857SKenneth D. Merryreplay is occurring.
6069deea857SKenneth D. Merry.It devq_queued
6079deea857SKenneth D. MerryThis is the number of transactions waiting in the kernel queue for capacity
6089806e231SRuslan Ermilovon the device.
6099806e231SRuslan ErmilovThis number is usually zero unless error recovery is in
6109deea857SKenneth D. Merryprogress.
6119deea857SKenneth D. Merry.It held
6129deea857SKenneth D. MerryThe held count is the number of CCBs held by peripheral drivers that have
6139deea857SKenneth D. Merryeither just been completed or are about to be released to the transport
6149806e231SRuslan Ermilovlayer for service by a device.
6159806e231SRuslan ErmilovHeld CCBs reserve capacity on a given
6169deea857SKenneth D. Merrydevice.
6179deea857SKenneth D. Merry.It mintags
6189deea857SKenneth D. MerryThis is the current "hard" minimum number of transactions that can be
6199806e231SRuslan Ermilovqueued to a device at once.
6209806e231SRuslan ErmilovThe
6219deea857SKenneth D. Merry.Ar dev_openings
6229806e231SRuslan Ermilovvalue above cannot go below this number.
6239806e231SRuslan ErmilovThe default value for
6249deea857SKenneth D. Merry.Ar mintags
6259deea857SKenneth D. Merryis 2, although it may be set higher or lower for various devices.
6269deea857SKenneth D. Merry.It maxtags
6279deea857SKenneth D. MerryThis is the "hard" maximum number of transactions that can be queued to a
6289806e231SRuslan Ermilovdevice at one time.
6299806e231SRuslan ErmilovThe
6309deea857SKenneth D. Merry.Ar dev_openings
6319806e231SRuslan Ermilovvalue cannot go above this number.
6329806e231SRuslan ErmilovThe default value for
6339deea857SKenneth D. Merry.Ar maxtags
6349deea857SKenneth D. Merryis 255, although it may be set higher or lower for various devices.
6359deea857SKenneth D. Merry.El
6369deea857SKenneth D. Merry.El
63733fab22eSKenneth D. Merry.It Ic negotiate
6389806e231SRuslan ErmilovShow or negotiate various communication parameters.
6399806e231SRuslan ErmilovSome controllers may
6409806e231SRuslan Ermilovnot support setting or changing some of these values.
6419806e231SRuslan ErmilovFor instance, the
6429deea857SKenneth D. MerryAdaptec 174x controllers do not support changing a device's sync rate or
6439deea857SKenneth D. Merryoffset.
644e1205e80SPhilippe CharnierThe
6457c7fb079SRuslan Ermilov.Nm
646e1205e80SPhilippe Charnierutility
6479deea857SKenneth D. Merrywill not attempt to set the parameter if the controller indicates that it
6489806e231SRuslan Ermilovdoes not support setting the parameter.
6499806e231SRuslan ErmilovTo find out what the controller
6509deea857SKenneth D. Merrysupports, use the
6519deea857SKenneth D. Merry.Fl v
6529806e231SRuslan Ermilovflag.
6539806e231SRuslan ErmilovThe meaning of the
6549deea857SKenneth D. Merry.Fl v
6559deea857SKenneth D. Merryflag for the
65633fab22eSKenneth D. Merry.Ic negotiate
6579806e231SRuslan Ermilovcommand is described below.
6580227791bSRuslan ErmilovAlso, some controller drivers do not support
6599deea857SKenneth D. Merrysetting negotiation parameters, even if the underlying controller supports
6609806e231SRuslan Ermilovnegotiation changes.
6619806e231SRuslan ErmilovSome controllers, such as the Advansys wide
6629deea857SKenneth D. Merrycontrollers, support enabling and disabling synchronous negotiation for
6639deea857SKenneth D. Merrya device, but do not support setting the synchronous negotiation rate.
6641252c1bbSRuslan Ermilov.Bl -tag -width 17n
6659deea857SKenneth D. Merry.It Fl a
6669deea857SKenneth D. MerryAttempt to make the negotiation settings take effect immediately by sending
6679deea857SKenneth D. Merrya Test Unit Ready command to the device.
6689deea857SKenneth D. Merry.It Fl c
6699806e231SRuslan ErmilovShow or set current negotiation settings.
6709806e231SRuslan ErmilovThis is the default.
6719deea857SKenneth D. Merry.It Fl D Ar enable|disable
6729deea857SKenneth D. MerryEnable or disable disconnection.
6739deea857SKenneth D. Merry.It Fl O Ar offset
6749deea857SKenneth D. MerrySet the command delay offset.
6759deea857SKenneth D. Merry.It Fl q
6760227791bSRuslan ErmilovBe quiet, do not print anything.
6779806e231SRuslan ErmilovThis is generally useful when you want to
6780227791bSRuslan Ermilovset a parameter, but do not want any status information.
6799deea857SKenneth D. Merry.It Fl R Ar syncrate
6809806e231SRuslan ErmilovChange the synchronization rate for a device.
6819806e231SRuslan ErmilovThe sync rate is a floating
6829806e231SRuslan Ermilovpoint value specified in MHz.
6839806e231SRuslan ErmilovSo, for instance,
6849deea857SKenneth D. Merry.Sq 20.000
6859deea857SKenneth D. Merryis a legal value, as is
6869deea857SKenneth D. Merry.Sq 20 .
6879deea857SKenneth D. Merry.It Fl T Ar enable|disable
6889deea857SKenneth D. MerryEnable or disable tagged queueing for a device.
6899deea857SKenneth D. Merry.It Fl U
6909806e231SRuslan ErmilovShow or set user negotiation settings.
6919806e231SRuslan ErmilovThe default is to show or set
6929deea857SKenneth D. Merrycurrent negotiation settings.
6939deea857SKenneth D. Merry.It Fl v
6949deea857SKenneth D. MerryThe verbose switch has special meaning for the
69533fab22eSKenneth D. Merry.Ic negotiate
6969806e231SRuslan Ermilovsubcommand.
6979806e231SRuslan ErmilovIt causes
6987c7fb079SRuslan Ermilov.Nm
6999deea857SKenneth D. Merryto print out the contents of a Path Inquiry (XPT_PATH_INQ) CCB sent to the
7009deea857SKenneth D. Merrycontroller driver.
7019deea857SKenneth D. Merry.It Fl W Ar bus_width
7029806e231SRuslan ErmilovSpecify the bus width to negotiate with a device.
7039806e231SRuslan ErmilovThe bus width is
7049806e231SRuslan Ermilovspecified in bits.
7059806e231SRuslan ErmilovThe only useful values to specify are 8, 16, and 32
7069806e231SRuslan Ermilovbits.
7079806e231SRuslan ErmilovThe controller must support the bus width in question in order for
7089deea857SKenneth D. Merrythe setting to take effect.
7099deea857SKenneth D. Merry.El
7109deea857SKenneth D. Merry.Pp
7119deea857SKenneth D. MerryIn general, sync rate and offset settings will not take effect for a
7129806e231SRuslan Ermilovdevice until a command has been sent to the device.
7139806e231SRuslan ErmilovThe
7149deea857SKenneth D. Merry.Fl a
7159deea857SKenneth D. Merryswitch above will automatically send a Test Unit Ready to the device so
7169deea857SKenneth D. Merrynegotiation parameters will take effect.
71733fab22eSKenneth D. Merry.It Ic format
71896a93c63SKenneth D. MerryIssue the
71996a93c63SKenneth D. Merry.Tn SCSI
72096a93c63SKenneth D. MerryFORMAT UNIT command to the named device.
72196a93c63SKenneth D. Merry.Pp
72296a93c63SKenneth D. Merry.Em WARNING! WARNING! WARNING!
72396a93c63SKenneth D. Merry.Pp
7249806e231SRuslan ErmilovLow level formatting a disk will destroy ALL data on the disk.
7259806e231SRuslan ErmilovUse
7269806e231SRuslan Ermilovextreme caution when issuing this command.
7279806e231SRuslan ErmilovMany users low-level format
7289806e231SRuslan Ermilovdisks that do not really need to be low-level formatted.
7299806e231SRuslan ErmilovThere are
73096a93c63SKenneth D. Merryrelatively few scenarios that call for low-level formatting a disk.
73196a93c63SKenneth D. MerryOne reason for
73296a93c63SKenneth D. Merrylow-level formatting a disk is to initialize the disk after changing
7339806e231SRuslan Ermilovits physical sector size.
7349806e231SRuslan ErmilovAnother reason for low-level formatting a disk
73596a93c63SKenneth D. Merryis to revive the disk if you are getting "medium format corrupted" errors
73696a93c63SKenneth D. Merryfrom the disk in response to read and write requests.
73796a93c63SKenneth D. Merry.Pp
7389806e231SRuslan ErmilovSome disks take longer than others to format.
7399806e231SRuslan ErmilovUsers should specify a
7409806e231SRuslan Ermilovtimeout long enough to allow the format to complete.
7419806e231SRuslan ErmilovThe default format
7429806e231SRuslan Ermilovtimeout is 3 hours, which should be long enough for most disks.
7439806e231SRuslan ErmilovSome hard
74496a93c63SKenneth D. Merrydisks will complete a format operation in a very short period of time
7459806e231SRuslan Ermilov(on the order of 5 minutes or less).
7469806e231SRuslan ErmilovThis is often because the drive
7470227791bSRuslan Ermilovdoes not really support the FORMAT UNIT command -- it just accepts the
74896a93c63SKenneth D. Merrycommand, waits a few minutes and then returns it.
74996a93c63SKenneth D. Merry.Pp
75096a93c63SKenneth D. MerryThe
75196a93c63SKenneth D. Merry.Sq format
7529806e231SRuslan Ermilovsubcommand takes several arguments that modify its default behavior.
7539806e231SRuslan ErmilovThe
75496a93c63SKenneth D. Merry.Fl q
75596a93c63SKenneth D. Merryand
75696a93c63SKenneth D. Merry.Fl y
75796a93c63SKenneth D. Merryarguments can be useful for scripts.
75896a93c63SKenneth D. Merry.Pp
7591252c1bbSRuslan Ermilov.Bl -tag -width 6n
76096a93c63SKenneth D. Merry.It Fl q
7610227791bSRuslan ErmilovBe quiet, do not print any status messages.
7629806e231SRuslan ErmilovThis option will not disable
7639806e231SRuslan Ermilovthe questions, however.
7649806e231SRuslan ErmilovTo disable questions, use the
76596a93c63SKenneth D. Merry.Fl y
76696a93c63SKenneth D. Merryargument, below.
767e9e4d3e4SKenneth D. Merry.It Fl r
768e9e4d3e4SKenneth D. MerryRun in
769e9e4d3e4SKenneth D. Merry.Dq report only
770e9e4d3e4SKenneth D. Merrymode.
771e9e4d3e4SKenneth D. MerryThis will report status on a format that is already running on the drive.
77296a93c63SKenneth D. Merry.It Fl w
7739806e231SRuslan ErmilovIssue a non-immediate format command.
7749806e231SRuslan ErmilovBy default,
7757c7fb079SRuslan Ermilov.Nm
7769806e231SRuslan Ermilovissues the FORMAT UNIT command with the immediate bit set.
7779806e231SRuslan ErmilovThis tells the
77896a93c63SKenneth D. Merrydevice to immediately return the format command, before the format has
7799806e231SRuslan Ermilovactually completed.
7809806e231SRuslan ErmilovThen,
7817c7fb079SRuslan Ermilov.Nm
78296a93c63SKenneth D. Merrygathers
78396a93c63SKenneth D. Merry.Tn SCSI
78496a93c63SKenneth D. Merrysense information from the device every second to determine how far along
7859806e231SRuslan Ermilovin the format process it is.
7869806e231SRuslan ErmilovIf the
78796a93c63SKenneth D. Merry.Fl w
78896a93c63SKenneth D. Merryargument is specified,
7897c7fb079SRuslan Ermilov.Nm
79096a93c63SKenneth D. Merrywill issue a non-immediate format command, and will be unable to print any
79196a93c63SKenneth D. Merryinformation to let the user know what percentage of the disk has been
79296a93c63SKenneth D. Merryformatted.
79396a93c63SKenneth D. Merry.It Fl y
7940227791bSRuslan ErmilovDo not ask any questions.
7959806e231SRuslan ErmilovBy default,
7967c7fb079SRuslan Ermilov.Nm
79796a93c63SKenneth D. Merrywill ask the user if he/she really wants to format the disk in question,
7989806e231SRuslan Ermilovand also if the default format command timeout is acceptable.
7999806e231SRuslan ErmilovThe user
80096a93c63SKenneth D. Merrywill not be asked about the timeout if a timeout is specified on the
80196a93c63SKenneth D. Merrycommand line.
80296a93c63SKenneth D. Merry.El
80333fab22eSKenneth D. Merry.It Ic help
8045a251d70SKenneth D. MerryPrint out verbose usage information.
805525689f1SJustin T. Gibbs.El
806525689f1SJustin T. Gibbs.Sh ENVIRONMENT
807525689f1SJustin T. GibbsThe
808525689f1SJustin T. Gibbs.Ev SCSI_MODES
809525689f1SJustin T. Gibbsvariable allows the user to specify an alternate mode page format file.
810525689f1SJustin T. Gibbs.Pp
811525689f1SJustin T. GibbsThe
812525689f1SJustin T. Gibbs.Ev EDITOR
813525689f1SJustin T. Gibbsvariable determines which text editor
8147c7fb079SRuslan Ermilov.Nm
815525689f1SJustin T. Gibbsstarts when editing mode pages.
816525689f1SJustin T. Gibbs.Sh FILES
817525689f1SJustin T. Gibbs.Bl -tag -width /usr/share/misc/scsi_modes -compact
818525689f1SJustin T. Gibbs.It Pa /usr/share/misc/scsi_modes
819525689f1SJustin T. Gibbsis the SCSI mode format database.
820525689f1SJustin T. Gibbs.It Pa /dev/xpt0
821525689f1SJustin T. Gibbsis the transport layer device.
822525689f1SJustin T. Gibbs.It Pa /dev/pass*
823525689f1SJustin T. Gibbsare the CAM application passthrough devices.
824525689f1SJustin T. Gibbs.El
825525689f1SJustin T. Gibbs.Sh EXAMPLES
826525689f1SJustin T. Gibbs.Dl camcontrol eject -n cd -u 1 -v
827525689f1SJustin T. Gibbs.Pp
828525689f1SJustin T. GibbsEject the CD from cd1, and print SCSI sense information if the command
829525689f1SJustin T. Gibbsfails.
830525689f1SJustin T. Gibbs.Pp
831b3550398SKenneth D. Merry.Dl camcontrol tur da0
832525689f1SJustin T. Gibbs.Pp
833525689f1SJustin T. GibbsSend the SCSI test unit ready command to da0.
834e1205e80SPhilippe CharnierThe
8357c7fb079SRuslan Ermilov.Nm
836e1205e80SPhilippe Charnierutility will report whether the disk is ready, but will not display sense
837525689f1SJustin T. Gibbsinformation if the command fails since the
838525689f1SJustin T. Gibbs.Fl v
839525689f1SJustin T. Gibbsswitch was not specified.
840525689f1SJustin T. Gibbs.Pp
841c7938743SMike Pritchard.Bd -literal -offset indent
842c60e19a8SKenneth D. Merrycamcontrol tur da1 -E -C 4 -t 50 -v
843525689f1SJustin T. Gibbs.Ed
844525689f1SJustin T. Gibbs.Pp
8459806e231SRuslan ErmilovSend a test unit ready command to da1.
8469806e231SRuslan ErmilovEnable kernel error recovery.
8479806e231SRuslan ErmilovSpecify a retry count of 4, and a timeout of 50 seconds.
8489806e231SRuslan ErmilovEnable sense
849525689f1SJustin T. Gibbsprinting (with the
850525689f1SJustin T. Gibbs.Fl v
8519806e231SRuslan Ermilovflag) if the command fails.
8529806e231SRuslan ErmilovSince error recovery is turned on, the
853525689f1SJustin T. Gibbsdisk will be spun up if it is not currently spinning.
854e1205e80SPhilippe CharnierThe
8557c7fb079SRuslan Ermilov.Nm
856e1205e80SPhilippe Charnierutility will report whether the disk is ready.
857c7938743SMike Pritchard.Bd -literal -offset indent
858525689f1SJustin T. Gibbscamcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \e
859525689f1SJustin T. Gibbs	-i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1"
860525689f1SJustin T. Gibbs.Ed
861525689f1SJustin T. Gibbs.Pp
8629806e231SRuslan ErmilovIssue a READ BUFFER command (0x3C) to cd1.
8639806e231SRuslan ErmilovDisplay the buffer size of cd1,
8649806e231SRuslan Ermilovand display the first 10 bytes from the cache on cd1.
8659806e231SRuslan ErmilovDisplay SCSI sense
866525689f1SJustin T. Gibbsinformation if the command fails.
867525689f1SJustin T. Gibbs.Pp
868c7938743SMike Pritchard.Bd -literal -offset indent
8698604fe2eSSADA Kenjicamcontrol cmd -n cd -u 1 -v -c "3B 00 00 00 00 00 00 00 0e 00" \e
870525689f1SJustin T. Gibbs	-o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8
871525689f1SJustin T. Gibbs.Ed
872525689f1SJustin T. Gibbs.Pp
8739806e231SRuslan ErmilovIssue a WRITE BUFFER (0x3B) command to cd1.
8749806e231SRuslan ErmilovWrite out 10 bytes of data,
8759806e231SRuslan Ermilovnot including the (reserved) 4 byte header.
8769806e231SRuslan ErmilovPrint out sense information if
8779806e231SRuslan Ermilovthe command fails.
8789806e231SRuslan ErmilovBe very careful with this command, improper use may
879525689f1SJustin T. Gibbscause data corruption.
880525689f1SJustin T. Gibbs.Pp
881c7938743SMike Pritchard.Bd -literal -offset indent
882c60e19a8SKenneth D. Merrycamcontrol modepage da3 -m 1 -e -P 3
88394d09127SKenneth D. Merry.Ed
884525689f1SJustin T. Gibbs.Pp
885525689f1SJustin T. GibbsEdit mode page 1 (the Read-Write Error Recover page) for da3, and save the
8869806e231SRuslan Ermilovsettings on the drive.
8879806e231SRuslan ErmilovMode page 1 contains a disk drive's auto read and
888525689f1SJustin T. Gibbswrite reallocation settings, among other things.
889525689f1SJustin T. Gibbs.Pp
8905710d224SKenneth D. Merry.Dl camcontrol rescan all
8915710d224SKenneth D. Merry.Pp
8925710d224SKenneth D. MerryRescan all SCSI busses in the system for devices that have been added,
8935710d224SKenneth D. Merryremoved or changed.
8945710d224SKenneth D. Merry.Pp
895525689f1SJustin T. Gibbs.Dl camcontrol rescan 0
896525689f1SJustin T. Gibbs.Pp
897525689f1SJustin T. GibbsRescan SCSI bus 0 for devices that have been added, removed or changed.
898525689f1SJustin T. Gibbs.Pp
899525689f1SJustin T. Gibbs.Dl camcontrol rescan 0:1:0
900525689f1SJustin T. Gibbs.Pp
901525689f1SJustin T. GibbsRescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or
902525689f1SJustin T. Gibbschanged.
9039deea857SKenneth D. Merry.Pp
904c60e19a8SKenneth D. Merry.Dl camcontrol tags da5 -N 24
9059deea857SKenneth D. Merry.Pp
9069deea857SKenneth D. MerrySet the number of concurrent transactions for da5 to 24.
9079deea857SKenneth D. Merry.Pp
908c7938743SMike Pritchard.Bd -literal -offset indent
9099deea857SKenneth D. Merrycamcontrol negotiate -n da -u 4 -T disable
9109deea857SKenneth D. Merry.Ed
9119deea857SKenneth D. Merry.Pp
9129deea857SKenneth D. MerryDisable tagged queueing for da4.
9139deea857SKenneth D. Merry.Pp
914c7938743SMike Pritchard.Bd -literal -offset indent
9159deea857SKenneth D. Merrycamcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a
9169deea857SKenneth D. Merry.Ed
9179deea857SKenneth D. Merry.Pp
9189806e231SRuslan ErmilovNegotiate a sync rate of 20MHz and an offset of 15 with da3.
9199806e231SRuslan ErmilovThen send a
9209deea857SKenneth D. MerryTest Unit Ready command to make the settings take effect.
921525689f1SJustin T. Gibbs.Sh SEE ALSO
922525689f1SJustin T. Gibbs.Xr cam 3 ,
9239deea857SKenneth D. Merry.Xr cam_cdbparse 3 ,
924c0bdb22bSMatthew Hunt.Xr cam 4 ,
925525689f1SJustin T. Gibbs.Xr pass 4 ,
926c0bdb22bSMatthew Hunt.Xr xpt 4
927525689f1SJustin T. Gibbs.Sh HISTORY
928525689f1SJustin T. GibbsThe
9297c7fb079SRuslan Ermilov.Nm
930e1205e80SPhilippe Charnierutility first appeared in
931525689f1SJustin T. Gibbs.Fx 3.0 .
932525689f1SJustin T. Gibbs.Pp
933525689f1SJustin T. GibbsThe mode page editing code and arbitrary SCSI command code are based upon
934525689f1SJustin T. Gibbscode in the old
935525689f1SJustin T. Gibbs.Xr scsi 8
936525689f1SJustin T. Gibbsutility and
937525689f1SJustin T. Gibbs.Xr scsi 3
9389806e231SRuslan Ermilovlibrary, written by Julian Elischer and Peter Dufault.
9399806e231SRuslan ErmilovThe
940525689f1SJustin T. Gibbs.Xr scsi 8
941753d686dSRuslan Ermilovprogram first appeared in
942753d686dSRuslan Ermilov.Bx 386 0.1.2.4 ,
943753d686dSRuslan Ermilovand first appeared in
94433fab22eSKenneth D. Merry.Fx
945525689f1SJustin T. Gibbsin
946525689f1SJustin T. Gibbs.Fx 2.0.5 .
947525689f1SJustin T. Gibbs.Sh AUTHORS
948aa7c9adaSMike Pritchard.An Kenneth Merry Aq ken@FreeBSD.org
949525689f1SJustin T. Gibbs.Sh BUGS
9500227791bSRuslan ErmilovThe code that parses the generic command line arguments does not know that
9519806e231SRuslan Ermilovsome of the subcommands take multiple arguments.
9529806e231SRuslan ErmilovSo if, for instance, you
953525689f1SJustin T. Gibbstried something like this:
954c7938743SMike Pritchard.Bd -literal -offset indent
955b9e3972aSKenneth D. Merrycamcontrol cmd -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v
956525689f1SJustin T. Gibbs.Ed
957525689f1SJustin T. Gibbs.Pp
958525689f1SJustin T. GibbsThe sense information from the test unit ready command would not get
959525689f1SJustin T. Gibbsprinted out, since the first
960525689f1SJustin T. Gibbs.Xr getopt 3
961525689f1SJustin T. Gibbscall in
9627c7fb079SRuslan Ermilov.Nm
963525689f1SJustin T. Gibbsbails out when it sees the second argument to
964525689f1SJustin T. Gibbs.Fl c
965c4d9468eSRuslan Ermilov(0x00),
9669806e231SRuslan Ermilovabove.
9679806e231SRuslan ErmilovFixing this behavior would take some gross code, or changes to the
968525689f1SJustin T. Gibbs.Xr getopt 3
9699806e231SRuslan Ermilovinterface.
9709806e231SRuslan ErmilovThe best way to circumvent this problem is to always make sure
971525689f1SJustin T. Gibbsto specify generic
9727c7fb079SRuslan Ermilov.Nm
973525689f1SJustin T. Gibbsarguments before any command-specific arguments.
974