]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/camcontrol/camcontrol.8
bsddialog: import snapshot 2021-12-05
[FreeBSD/FreeBSD.git] / sbin / camcontrol / camcontrol.8
1 .\"
2 .\" Copyright (c) 1998, 1999, 2000, 2002, 2005, 2006, 2007 Kenneth D. Merry.
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. The name of the author may not be used to endorse or promote products
14 .\"    derived from this software without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\" $FreeBSD$
29 .\"
30 .Dd October 20, 2021
31 .Dt CAMCONTROL 8
32 .Os
33 .Sh NAME
34 .Nm camcontrol
35 .Nd CAM control program
36 .Sh SYNOPSIS
37 .Nm
38 .Aq Ar command
39 .Op device id
40 .Op generic args
41 .Op command args
42 .Nm
43 .Ic devlist
44 .Op Fl b
45 .Op Fl v
46 .Nm
47 .Ic periphlist
48 .Op device id
49 .Op Fl n Ar dev_name
50 .Op Fl u Ar unit_number
51 .Nm
52 .Ic tur
53 .Op device id
54 .Op generic args
55 .Nm
56 .Ic inquiry
57 .Op device id
58 .Op generic args
59 .Op Fl D
60 .Op Fl S
61 .Op Fl R
62 .Nm
63 .Ic identify
64 .Op device id
65 .Op generic args
66 .Op Fl v
67 .Nm
68 .Ic reportluns
69 .Op device id
70 .Op generic args
71 .Op Fl c
72 .Op Fl l
73 .Op Fl r Ar reporttype
74 .Nm
75 .Ic readcap
76 .Op device id
77 .Op generic args
78 .Op Fl b
79 .Op Fl h
80 .Op Fl H
81 .Op Fl l
82 .Op Fl N
83 .Op Fl q
84 .Op Fl s
85 .Nm
86 .Ic start
87 .Op device id
88 .Op generic args
89 .Nm
90 .Ic stop
91 .Op device id
92 .Op generic args
93 .Nm
94 .Ic load
95 .Op device id
96 .Op generic args
97 .Nm
98 .Ic eject
99 .Op device id
100 .Op generic args
101 .Nm
102 .Ic reprobe
103 .Op device id
104 .Nm
105 .Ic rescan
106 .Aq all | device id | bus Ns Op :target:lun
107 .Nm
108 .Ic reset
109 .Aq all | device id | bus Ns Op :target:lun
110 .Nm
111 .Ic defects
112 .Op device id
113 .Op generic args
114 .Aq Fl f Ar format
115 .Op Fl P
116 .Op Fl G
117 .Op Fl q
118 .Op Fl s
119 .Op Fl S Ar offset
120 .Op Fl X
121 .Nm
122 .Ic modepage
123 .Op device id
124 .Op generic args
125 .Op Fl 6
126 .Aq Fl m Ar page[,subpage] | Fl l
127 .Op Fl P Ar pgctl
128 .Op Fl D
129 .Op Fl L
130 .Op Fl b | Fl e
131 .Op Fl d
132 .Nm
133 .Ic cmd
134 .Op device id
135 .Op generic args
136 .Aq Fl a Ar cmd Op args
137 .Aq Fl c Ar cmd Op args
138 .Op Fl d
139 .Op Fl f
140 .Op Fl i Ar len Ar fmt
141 .Bk -words
142 .Op Fl o Ar len Ar fmt Op args
143 .Op Fl r Ar fmt
144 .Ek
145 .Nm
146 .Ic smpcmd
147 .Op device id
148 .Op generic args
149 .Aq Fl r Ar len Ar fmt Op args
150 .Aq Fl R Ar len Ar fmt Op args
151 .Nm
152 .Ic smprg
153 .Op device id
154 .Op generic args
155 .Op Fl l
156 .Nm
157 .Ic smppc
158 .Op device id
159 .Op generic args
160 .Aq Fl p Ar phy
161 .Op Fl l
162 .Op Fl o Ar operation
163 .Op Fl d Ar name
164 .Op Fl m Ar rate
165 .Op Fl M Ar rate
166 .Op Fl T Ar pp_timeout
167 .Op Fl a Ar enable|disable
168 .Op Fl A Ar enable|disable
169 .Op Fl s Ar enable|disable
170 .Op Fl S Ar enable|disable
171 .Nm
172 .Ic smpphylist
173 .Op device id
174 .Op generic args
175 .Op Fl l
176 .Op Fl q
177 .Nm
178 .Ic smpmaninfo
179 .Op device id
180 .Op generic args
181 .Op Fl l
182 .Nm
183 .Ic debug
184 .Op Fl I
185 .Op Fl P
186 .Op Fl T
187 .Op Fl S
188 .Op Fl X
189 .Op Fl c
190 .Op Fl p
191 .Aq all | off | device id | bus Ns Op :target Ns Op :lun
192 .Nm
193 .Ic tags
194 .Op device id
195 .Op generic args
196 .Op Fl N Ar tags
197 .Op Fl q
198 .Op Fl v
199 .Nm
200 .Ic negotiate
201 .Op device id
202 .Op generic args
203 .Op Fl c
204 .Op Fl D Ar enable|disable
205 .Op Fl M Ar mode
206 .Op Fl O Ar offset
207 .Op Fl q
208 .Op Fl R Ar syncrate
209 .Op Fl T Ar enable|disable
210 .Op Fl U
211 .Op Fl W Ar bus_width
212 .Op Fl v
213 .Nm
214 .Ic format
215 .Op device id
216 .Op generic args
217 .Op Fl q
218 .Op Fl r
219 .Op Fl w
220 .Op Fl y
221 .Nm
222 .Ic sanitize
223 .Op device id
224 .Op generic args
225 .Aq Fl a Ar overwrite | block | crypto | exitfailure
226 .Op Fl c Ar passes
227 .Op Fl I
228 .Op Fl P Ar pattern
229 .Op Fl q
230 .Op Fl U
231 .Op Fl r
232 .Op Fl w
233 .Op Fl y
234 .Nm
235 .Ic idle
236 .Op device id
237 .Op generic args
238 .Op Fl t Ar time
239 .Nm
240 .Ic standby
241 .Op device id
242 .Op generic args
243 .Op Fl t Ar time
244 .Nm
245 .Ic sleep
246 .Op device id
247 .Op generic args
248 .Nm
249 .Ic powermode
250 .Op device id
251 .Op generic args
252 .Nm
253 .Ic apm
254 .Op device id
255 .Op generic args
256 .Op Fl l Ar level
257 .Nm
258 .Ic aam
259 .Op device id
260 .Op generic args
261 .Op Fl l Ar level
262 .Nm
263 .Ic fwdownload
264 .Op device id
265 .Op generic args
266 .Aq Fl f Ar fw_image
267 .Op Fl q
268 .Op Fl s
269 .Op Fl y
270 .Nm
271 .Ic security
272 .Op device id
273 .Op generic args
274 .Op Fl d Ar pwd
275 .Op Fl e Ar pwd
276 .Op Fl f
277 .Op Fl h Ar pwd
278 .Op Fl k Ar pwd
279 .Op Fl l Ar high|maximum
280 .Op Fl q
281 .Op Fl s Ar pwd
282 .Op Fl T Ar timeout
283 .Op Fl U Ar user|master
284 .Op Fl y
285 .Nm
286 .Ic hpa
287 .Op device id
288 .Op generic args
289 .Op Fl f
290 .Op Fl l
291 .Op Fl P
292 .Op Fl p Ar pwd
293 .Op Fl q
294 .Op Fl s Ar max_sectors
295 .Op Fl U Ar pwd
296 .Op Fl y
297 .Nm
298 .Ic ama
299 .Op device id
300 .Op generic args
301 .Op Fl f
302 .Op Fl q
303 .Op Fl s Ar max_sectors
304 .Nm
305 .Ic persist
306 .Op device id
307 .Op generic args
308 .Aq Fl i Ar action | Fl o Ar action
309 .Op Fl a
310 .Op Fl I Ar trans_id
311 .Op Fl k Ar key
312 .Op Fl K Ar sa_key
313 .Op Fl p
314 .Op Fl R Ar rel_tgt_port
315 .Op Fl s Ar scope
316 .Op Fl S
317 .Op Fl T Ar res_type
318 .Op Fl U
319 .Nm
320 .Ic attrib
321 .Op device id
322 .Op generic args
323 .Aq Fl r Ar action | Fl w Ar attrib
324 .Op Fl a Ar attr_num
325 .Op Fl c
326 .Op Fl e Ar elem_addr
327 .Op Fl F Ar form1,form2
328 .Op Fl p Ar part
329 .Op Fl s Ar start_addr
330 .Op Fl T Ar elem_type
331 .Op Fl V Ar lv_num
332 .Nm
333 .Ic opcodes
334 .Op device id
335 .Op generic args
336 .Op Fl o Ar opcode
337 .Op Fl s Ar service_action
338 .Op Fl N
339 .Op Fl T
340 .Nm
341 .Ic zone
342 .Aq Fl c Ar cmd
343 .Op Fl a
344 .Op Fl l Ar lba
345 .Op Fl o Ar rep_opts
346 .Op Fl P Ar print_opts
347 .Nm
348 .Ic epc
349 .Aq Fl c Ar cmd
350 .Op Fl d
351 .Op Fl D
352 .Op Fl e
353 .Op Fl H
354 .Op Fl p Ar power_cond
355 .Op Fl P
356 .Op Fl r Ar restore_src
357 .Op Fl s
358 .Op Fl S Ar power_src
359 .Op Fl T Ar timer
360 .Nm
361 .Ic timestamp
362 .Op device id
363 .Op generic args
364 .Ao Fl r Oo Ns Fl f Ar format | Fl m | Fl U Oc | Fl s Ao Fl f Ar format Fl T Ar time | Fl U Ac Ac
365 .Nm
366 .Ic devtype
367 .Op device id
368 .Nm
369 .Ic depop
370 .Op device id
371 .Op generic args
372 .Ao Fl l | Fl d | Fl r Ac
373 .Op Fl e Ar elem
374 .Op Fl c Ar capacity
375 .Nm
376 .Ic help
377 .Sh DESCRIPTION
378 The
379 .Nm
380 utility is designed to provide a way for users to access and control the
381 .Fx
382 CAM subsystem.
383 .Pp
384 The
385 .Nm
386 utility
387 can cause a loss of data and/or system crashes if used improperly.
388 Even
389 expert users are encouraged to exercise caution when using this command.
390 Novice users should stay away from this utility.
391 .Pp
392 The
393 .Nm
394 utility has a number of primary functions, many of which support an optional
395 device identifier.
396 A device identifier can take one of three forms:
397 .Bl -tag -width 14n
398 .It deviceUNIT
399 Specify a device name and unit number combination, like "da5" or "cd3".
400 .It bus:target
401 Specify a bus number and target id.
402 The bus number can be determined from
403 the output of
404 .Dq camcontrol devlist .
405 The lun defaults to 0.
406 .It bus:target:lun
407 Specify the bus, target and lun for a device.
408 (e.g.\& 1:2:0)
409 .El
410 .Pp
411 The device identifier, if it is specified,
412 .Em must
413 come immediately after the function name, and before any generic or
414 function-specific arguments.
415 Note that the
416 .Fl n
417 and
418 .Fl u
419 arguments described below will override any device name or unit number
420 specified beforehand.
421 The
422 .Fl n
423 and
424 .Fl u
425 arguments will
426 .Em not
427 override a specified bus:target or bus:target:lun, however.
428 .Pp
429 Most of the
430 .Nm
431 primary functions support these generic arguments:
432 .Bl -tag -width 14n
433 .It Fl C Ar count
434 SCSI command retry count.
435 In order for this to work, error recovery
436 .Pq Fl E
437 must be turned on.
438 .It Fl E
439 Instruct the kernel to perform generic SCSI error recovery for the given
440 command.
441 This is needed in order for the retry count
442 .Pq Fl C
443 to be honored.
444 Other than retrying commands, the generic error recovery in
445 the code will generally attempt to spin up drives that are not spinning.
446 It may take some other actions, depending upon the sense code returned from
447 the command.
448 .It Fl n Ar dev_name
449 Specify the device type to operate on, e.g.\& "da", "cd".
450 .It Fl Q Ar task_attr
451 .Tn SCSI
452 task attribute for the command, if it is a
453 .Tn SCSI
454 command.
455 This may be ordered, simple, head, or aca.
456 In most cases this is not needed.
457 The default is simple, which works with all
458 .Tn SCSI
459 devices.
460 The task attribute may also be specified numerically.
461 .It Fl t Ar timeout
462 SCSI command timeout in seconds.
463 This overrides the default timeout for
464 any given command.
465 .It Fl u Ar unit_number
466 Specify the device unit number, e.g.\& "1", "5".
467 .It Fl v
468 Be verbose, print out sense information for failed SCSI commands.
469 .El
470 .Pp
471 Primary command functions:
472 .Bl -tag -width periphlist
473 .It Ic devlist
474 List all physical devices (logical units) attached to the CAM subsystem.
475 This also includes a list of peripheral drivers attached to each device.
476 With the
477 .Fl v
478 argument, SCSI bus number, adapter name and unit numbers are printed as
479 well.
480 On the other hand, with the
481 .Fl b
482 argument, only the bus adapter, and unit information will be printed, and
483 device information will be omitted.
484 .It Ic periphlist
485 List all peripheral drivers attached to a given physical device (logical
486 unit).
487 .It Ic tur
488 Send the SCSI test unit ready (0x00) command to the given device.
489 The
490 .Nm
491 utility will report whether the device is ready or not.
492 .It Ic inquiry
493 Send a SCSI inquiry command (0x12) to a device.
494 By default,
495 .Nm
496 will print out the standard inquiry data, device serial number, and
497 transfer rate information.
498 The user can specify that only certain types of
499 inquiry data be printed:
500 .Bl -tag -width 4n
501 .It Fl D
502 Get the standard inquiry data.
503 .It Fl S
504 Print out the serial number.
505 If this flag is the only one specified,
506 .Nm
507 will not print out "Serial Number" before the value returned by the drive.
508 This is to aid in script writing.
509 .It Fl R
510 Print out transfer rate information.
511 .El
512 .It Ic identify
513 Send a ATA identify command (0xec) to a device.
514 .It Ic reportluns
515 Send the SCSI REPORT LUNS (0xA0) command to the given device.
516 By default,
517 .Nm
518 will print out the list of logical units (LUNs) supported by the target device.
519 There are a couple of options to modify the output:
520 .Bl -tag -width 14n
521 .It Fl c
522 Just print out a count of LUNs, not the actual LUN numbers.
523 .It Fl l
524 Just print out the LUNs, and do not print out the count.
525 .It Fl r Ar reporttype
526 Specify the type of report to request from the target:
527 .Bl -tag -width 012345678
528 .It default
529 Return the default report.
530 This is the
531 .Nm
532 default.
533 Most targets will support this report if they support the REPORT LUNS
534 command.
535 .It wellknown
536 Return only well known LUNs.
537 .It all
538 Return all available LUNs.
539 .El
540 .El
541 .Pp
542 .Nm
543 will try to print out LUN numbers in a reasonable format.
544 It can understand the peripheral, flat, LUN and extended LUN formats.
545 .It Ic readcap
546 Send the SCSI READ CAPACITY command to the given device and display
547 the results.
548 If the device is larger than 2TB, the SCSI READ CAPACITY (16) service
549 action will be sent to obtain the full size of the device.
550 By default,
551 .Nm
552 will print out the last logical block of the device, and the blocksize of
553 the device in bytes.
554 To modify the output format, use the following options:
555 .Bl -tag -width 5n
556 .It Fl b
557 Just print out the blocksize, not the last block or device size.
558 This cannot be used with
559 .Fl N
560 or
561 .Fl s .
562 .It Fl h
563 Print out the device size in human readable (base 2, 1K == 1024) format.
564 This implies
565 .Fl N
566 and cannot be used with
567 .Fl q
568 or
569 .Fl b .
570 .It Fl H
571 Print out the device size in human readable (base 10, 1K == 1000) format.
572 .It Fl l
573 Skip sending the SCSI READ CAPACITY (10) command.
574 Send only the SCSI READ CAPACITY (16) service action and report
575 its results.
576 When the two do not match, a quirk is needed to resolve the ambiguity.
577 .It Fl N
578 Print out the number of blocks in the device instead of the last logical
579 block.
580 .It Fl q
581 Quiet, print out the numbers only (separated by a comma if
582 .Fl b
583 or
584 .Fl s
585 are not specified).
586 .It Fl s
587 Print out the last logical block or the size of the device only, and omit
588 the blocksize.
589 .El
590 .Pp
591 Note that this command only displays the information, it does not update
592 the kernel data structures.
593 Use the
594 .Nm
595 reprobe subcommand to do that.
596 .It Ic start
597 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
598 start bit set.
599 .It Ic stop
600 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
601 start bit cleared.
602 .It Ic load
603 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
604 start bit set and the load/eject bit set.
605 .It Ic eject
606 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
607 start bit cleared and the load/eject bit set.
608 .It Ic rescan
609 Tell the kernel to scan all buses in the system (with the
610 .Ar all
611 argument), the given bus (XPT_SCAN_BUS), bus:target:lun or device
612 (XPT_SCAN_LUN) for new devices or devices that have gone away.
613 The user
614 may specify a scan of all buses, a single bus, or a lun.
615 Scanning all luns
616 on a target is not supported.
617 .Pp
618 If a device is specified by peripheral name and unit number, for instance
619 da4, it may only be rescanned if that device currently exists in the CAM EDT
620 (Existing Device Table).
621 If the device is no longer there (see
622 .Nm
623 devlist ),
624 you must use the bus:target:lun form to rescan it.
625 .It Ic reprobe
626 Tell the kernel to refresh the information about the device and
627 notify the upper layer,
628 .Xr GEOM 4 .
629 This includes sending the SCSI READ CAPACITY command and updating
630 the disk size visible to the rest of the system.
631 .It Ic reset
632 Tell the kernel to reset all buses in the system (with the
633 .Ar all
634 argument), the given bus (XPT_RESET_BUS) by issuing a SCSI bus
635 reset for that bus, or to reset the given bus:target:lun or device
636 (XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after
637 connecting to that device.
638 Note that this can have a destructive impact
639 on the system.
640 .It Ic defects
641 Send the
642 .Tn SCSI
643 READ DEFECT DATA (10) command (0x37) or the
644 .Tn SCSI
645 READ DEFECT DATA (12) command (0xB7) to the given device, and
646 print out any combination of: the total number of defects, the primary
647 defect list (PLIST), and the grown defect list (GLIST).
648 .Bl -tag -width 11n
649 .It Fl f Ar format
650 Specify the requested format of the defect list.
651 The format argument is
652 required.
653 Most drives support the physical sector format.
654 Some drives
655 support the logical block format.
656 Many drives, if they do not support the
657 requested format, return the data in an alternate format, along with sense
658 information indicating that the requested data format is not supported.
659 The
660 .Nm
661 utility
662 attempts to detect this, and print out whatever format the drive returns.
663 If the drive uses a non-standard sense code to report that it does not
664 support the requested format,
665 .Nm
666 will probably see the error as a failure to complete the request.
667 .Pp
668 The format options are:
669 .Bl -tag -width 9n
670 .It block
671 Print out the list as logical blocks.
672 This is limited to 32-bit block sizes, and isn't supported by many modern
673 drives.
674 .It longblock
675 Print out the list as logical blocks.
676 This option uses a 64-bit block size.
677 .It bfi
678 Print out the list in bytes from index format.
679 .It extbfi
680 Print out the list in extended bytes from index format.
681 The extended format allows for ranges of blocks to be printed.
682 .It phys
683 Print out the list in physical sector format.
684 Most drives support this format.
685 .It extphys
686 Print out the list in extended physical sector format.
687 The extended format allows for ranges of blocks to be printed.
688 .El
689 .It Fl G
690 Print out the grown defect list.
691 This is a list of bad blocks that have
692 been remapped since the disk left the factory.
693 .It Fl P
694 Print out the primary defect list.
695 This is the list of defects that were present in the factory.
696 .It Fl q
697 When printing status information with
698 .Fl s ,
699 only print the number of defects.
700 .It Fl s
701 Just print the number of defects, not the list of defects.
702 .It Fl S Ar offset
703 Specify the starting offset into the defect list.
704 This implies using the
705 .Tn SCSI
706 READ DEFECT DATA (12) command, as the 10 byte version of the command
707 doesn't support the address descriptor index field.
708 Not all drives support the 12 byte command, and some drives that support
709 the 12 byte command don't support the address descriptor index field.
710 .It Fl X
711 Print out defects in hexadecimal (base 16) form instead of base 10 form.
712 .El
713 .Pp
714 If neither
715 .Fl P
716 nor
717 .Fl G
718 is specified,
719 .Nm
720 will print out the number of defects given in the READ DEFECT DATA header
721 returned from the drive.
722 Some drives will report 0 defects if neither the primary or grown defect
723 lists are requested.
724 .It Ic modepage
725 Allows the user to display and optionally edit a SCSI mode page.
726 The mode
727 page formats are located in
728 .Pa /usr/share/misc/scsi_modes .
729 This can be overridden by specifying a different file in the
730 .Ev SCSI_MODES
731 environment variable.
732 The
733 .Ic modepage
734 command takes several arguments:
735 .Bl -tag -width 12n
736 .It Fl 6
737 Use 6 byte MODE commands instead of default 10 byte.
738 Old devices may not support 10 byte MODE commands, while new devices may
739 not be able to report all mode pages with 6 byte commands.
740 If not specified,
741 .Nm
742 starts with 10 byte commands and falls back to 6 byte on error.
743 .It Fl d
744 Disable block descriptors for mode sense.
745 .It Fl D
746 Display/edit block descriptors instead of mode page.
747 .It Fl L
748 Use long LBA block descriptors.
749 Allows number of LBAs bigger then 2^^32.
750 .It Fl b
751 Displays mode page data in binary format.
752 .It Fl e
753 This flag allows the user to edit values in the mode page.
754 The user may
755 either edit mode page values with the text editor pointed to by his
756 .Ev EDITOR
757 environment variable, or supply mode page values via standard input, using
758 the same format that
759 .Nm
760 uses to display mode page values.
761 The editor will be invoked if
762 .Nm
763 detects that standard input is terminal.
764 .It Fl l
765 Lists all available mode pages.
766 If specified more then once, also lists subpages.
767 .It Fl m Ar page[,subpage]
768 This specifies the number of the mode page and optionally subpage the user
769 would like to view and/or edit.
770 This argument is mandatory unless
771 .Fl l
772 is specified.
773 .It Fl P Ar pgctl
774 This allows the user to specify the page control field.
775 Possible values are:
776 .Bl -tag -width xxx -compact
777 .It 0
778 Current values
779 .It 1
780 Changeable values
781 .It 2
782 Default values
783 .It 3
784 Saved values
785 .El
786 .El
787 .It Ic cmd
788 Allows the user to send an arbitrary ATA or SCSI CDB to any device.
789 The
790 .Ic cmd
791 function requires the
792 .Fl c
793 argument to specify SCSI CDB or the
794 .Fl a
795 argument to specify ATA Command Block registers values.
796 Other arguments are optional, depending on
797 the command type.
798 The command and data specification syntax is documented
799 in
800 .Xr cam_cdbparse 3 .
801 NOTE: If the CDB specified causes data to be transferred to or from the
802 SCSI device in question, you MUST specify either
803 .Fl i
804 or
805 .Fl o .
806 .Bl -tag -width 17n
807 .It Fl a Ar cmd Op args
808 This specifies the content of 12 ATA Command Block registers (command,
809 features, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp.
810 lba_high_exp, features_exp, sector_count, sector_count_exp).
811 .It Fl c Ar cmd Op args
812 This specifies the SCSI CDB.
813 SCSI CDBs may be 6, 10, 12 or 16 bytes.
814 .It Fl d
815 Specifies DMA protocol to be used for ATA command.
816 .It Fl f
817 Specifies FPDMA (NCQ) protocol to be used for ATA command.
818 .It Fl i Ar len Ar fmt
819 This specifies the amount of data to read, and how it should be displayed.
820 If the format is
821 .Sq - ,
822 .Ar len
823 bytes of data will be read from the device and written to standard output.
824 .It Fl o Ar len Ar fmt Op args
825 This specifies the amount of data to be written to a device, and the data
826 that is to be written.
827 If the format is
828 .Sq - ,
829 .Ar len
830 bytes of data will be read from standard input and written to the device.
831 .It Fl r Ar fmt
832 This specifies that 11 result ATA Command Block registers should be displayed
833 (status, error, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp,
834 lba_high_exp, sector_count, sector_count_exp), and how.
835 If the format is
836 .Sq - ,
837 11 result registers will be written to standard output in hex.
838 .El
839 .It Ic smpcmd
840 Allows the user to send an arbitrary Serial
841 Management Protocol (SMP) command to a device.
842 The
843 .Ic smpcmd
844 function requires the
845 .Fl r
846 argument to specify the SMP request to be sent, and the
847 .Fl R
848 argument to specify the format of the SMP response.
849 The syntax for the SMP request and response arguments is documented in
850 .Xr cam_cdbparse 3 .
851 .Pp
852 Note that SAS adapters that support SMP passthrough (at least the currently
853 known adapters) do not accept CRC bytes from the user in the request and do
854 not pass CRC bytes back to the user in the response.
855 Therefore users should not include the CRC bytes in the length of the
856 request and not expect CRC bytes to be returned in the response.
857 .Bl -tag -width 17n
858 .It Fl r Ar len Ar fmt Op args
859 This specifies the size of the SMP request, without the CRC bytes, and the
860 SMP request format.
861 If the format is
862 .Sq - ,
863 .Ar len
864 bytes of data will be read from standard input and written as the SMP
865 request.
866 .It Fl R Ar len Ar fmt Op args
867 This specifies the size of the buffer allocated for the SMP response, and
868 the SMP response format.
869 If the format is
870 .Sq - ,
871 .Ar len
872 bytes of data will be allocated for the response and the response will be
873 written to standard output.
874 .El
875 .It Ic smprg
876 Allows the user to send the Serial Management Protocol (SMP) Report General
877 command to a device.
878 .Nm
879 will display the data returned by the Report General command.
880 If the SMP target supports the long response format, the additional data
881 will be requested and displayed automatically.
882 .Bl -tag -width 8n
883 .It Fl l
884 Request the long response format only.
885 Not all SMP targets support the long response format.
886 This option causes
887 .Nm
888 to skip sending the initial report general request without the long bit set
889 and only issue a report general request with the long bit set.
890 .El
891 .It Ic smppc
892 Allows the user to issue the Serial Management Protocol (SMP) PHY Control
893 command to a device.
894 This function should be used with some caution, as it can render devices
895 inaccessible, and could potentially cause data corruption as well.
896 The
897 .Fl p
898 argument is required to specify the PHY to operate on.
899 .Bl -tag -width 17n
900 .It Fl p Ar phy
901 Specify the PHY to operate on.
902 This argument is required.
903 .It Fl l
904 Request the long request/response format.
905 Not all SMP targets support the long response format.
906 For the PHY Control command, this currently only affects whether the
907 request length is set to a value other than 0.
908 .It Fl o Ar operation
909 Specify a PHY control operation.
910 Only one
911 .Fl o
912 operation may be specified.
913 The operation may be specified numerically (in decimal, hexadecimal, or octal)
914 or one of the following operation names may be specified:
915 .Bl -tag -width 16n
916 .It nop
917 No operation.
918 It is not necessary to specify this argument.
919 .It linkreset
920 Send the LINK RESET command to the phy.
921 .It hardreset
922 Send the HARD RESET command to the phy.
923 .It disable
924 Send the DISABLE command to the phy.
925 Note that the LINK RESET or HARD RESET commands should re-enable the phy.
926 .It clearerrlog
927 Send the CLEAR ERROR LOG command.
928 This clears the error log counters for the specified phy.
929 .It clearaffiliation
930 Send the CLEAR AFFILIATION command.
931 This clears the affiliation from the STP initiator port with the same SAS
932 address as the SMP initiator that requests the clear operation.
933 .It sataportsel
934 Send the TRANSMIT SATA PORT SELECTION SIGNAL command to the phy.
935 This will cause a SATA port selector to use the given phy as its active phy
936 and make the other phy inactive.
937 .It clearitnl
938 Send the CLEAR STP I_T NEXUS LOSS command to the PHY.
939 .It setdevname
940 Send the SET ATTACHED DEVICE NAME command to the PHY.
941 This requires the
942 .Fl d
943 argument to specify the device name.
944 .El
945 .It Fl d Ar name
946 Specify the attached device name.
947 This option is needed with the
948 .Fl o Ar setdevname
949 phy operation.
950 The name is a 64-bit number, and can be specified in decimal, hexadecimal
951 or octal format.
952 .It Fl m Ar rate
953 Set the minimum physical link rate for the phy.
954 This is a numeric argument.
955 Currently known link rates are:
956 .Bl -tag -width 5n
957 .It 0x0
958 Do not change current value.
959 .It 0x8
960 1.5 Gbps
961 .It 0x9
962 3 Gbps
963 .It 0xa
964 6 Gbps
965 .El
966 .Pp
967 Other values may be specified for newer physical link rates.
968 .It Fl M Ar rate
969 Set the maximum physical link rate for the phy.
970 This is a numeric argument.
971 See the
972 .Fl m
973 argument description for known link rate arguments.
974 .It Fl T Ar pp_timeout
975 Set the partial pathway timeout value, in microseconds.
976 See the
977 .Tn ANSI
978 .Tn SAS
979 Protocol Layer (SPL)
980 specification for more information on this field.
981 .It Fl a Ar enable|disable
982 Enable or disable SATA slumber phy power conditions.
983 .It Fl A Ar enable|disable
984 Enable or disable SATA partial power conditions.
985 .It Fl s Ar enable|disable
986 Enable or disable SAS slumber phy power conditions.
987 .It Fl S Ar enable|disable
988 Enable or disable SAS partial phy power conditions.
989 .El
990 .It Ic smpphylist
991 List phys attached to a SAS expander, the address of the end device
992 attached to the phy, and the inquiry data for that device and peripheral
993 devices attached to that device.
994 The inquiry data and peripheral devices are displayed if available.
995 .Bl -tag -width 5n
996 .It Fl l
997 Turn on the long response format for the underlying SMP commands used for
998 this command.
999 .It Fl q
1000 Only print out phys that are attached to a device in the CAM EDT (Existing
1001 Device Table).
1002 .El
1003 .It Ic smpmaninfo
1004 Send the SMP Report Manufacturer Information command to the device and
1005 display the response.
1006 .Bl -tag -width 5n
1007 .It Fl l
1008 Turn on the long response format for the underlying SMP commands used for
1009 this command.
1010 .El
1011 .It Ic debug
1012 Turn on CAM debugging printfs in the kernel.
1013 This requires options CAMDEBUG
1014 in your kernel config file.
1015 WARNING: enabling debugging printfs currently
1016 causes an EXTREME number of kernel printfs.
1017 You may have difficulty
1018 turning off the debugging printfs once they start, since the kernel will be
1019 busy printing messages and unable to service other requests quickly.
1020 The
1021 .Ic debug
1022 function takes a number of arguments:
1023 .Bl -tag -width 18n
1024 .It Fl I
1025 Enable CAM_DEBUG_INFO printfs.
1026 .It Fl P
1027 Enable CAM_DEBUG_PERIPH printfs.
1028 .It Fl T
1029 Enable CAM_DEBUG_TRACE printfs.
1030 .It Fl S
1031 Enable CAM_DEBUG_SUBTRACE printfs.
1032 .It Fl X
1033 Enable CAM_DEBUG_XPT printfs.
1034 .It Fl c
1035 Enable CAM_DEBUG_CDB printfs.
1036 This will cause the kernel to print out the
1037 SCSI CDBs sent to the specified device(s).
1038 .It Fl p
1039 Enable CAM_DEBUG_PROBE printfs.
1040 .It all
1041 Enable debugging for all devices.
1042 .It off
1043 Turn off debugging for all devices
1044 .It bus Ns Op :target Ns Op :lun
1045 Turn on debugging for the given bus, target or lun.
1046 If the lun or target
1047 and lun are not specified, they are wildcarded.
1048 (i.e., just specifying a
1049 bus turns on debugging printfs for all devices on that bus.)
1050 .El
1051 .It Ic tags
1052 Show or set the number of "tagged openings" or simultaneous transactions
1053 we attempt to queue to a particular device.
1054 By default, the
1055 .Ic tags
1056 command, with no command-specific arguments (i.e., only generic arguments)
1057 prints out the "soft" maximum number of transactions that can be queued to
1058 the device in question.
1059 For more detailed information, use the
1060 .Fl v
1061 argument described below.
1062 .Bl -tag -width 7n
1063 .It Fl N Ar tags
1064 Set the number of tags for the given device.
1065 This must be between the
1066 minimum and maximum number set in the kernel quirk table.
1067 The default for
1068 most devices that support tagged queueing is a minimum of 2 and a maximum
1069 of 255.
1070 The minimum and maximum values for a given device may be
1071 determined by using the
1072 .Fl v
1073 switch.
1074 The meaning of the
1075 .Fl v
1076 switch for this
1077 .Nm
1078 subcommand is described below.
1079 .It Fl q
1080 Be quiet, and do not report the number of tags.
1081 This is generally used when
1082 setting the number of tags.
1083 .It Fl v
1084 The verbose flag has special functionality for the
1085 .Em tags
1086 argument.
1087 It causes
1088 .Nm
1089 to print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB:
1090 .Bl -tag -width 13n
1091 .It dev_openings
1092 This is the amount of capacity for transactions queued to a given device.
1093 .It dev_active
1094 This is the number of transactions currently queued to a device.
1095 .It allocated
1096 This is the number of CCBs allocated for the device.
1097 .It held
1098 The held count is the number of CCBs held by peripheral drivers that have
1099 either just been completed or are about to be released to the transport
1100 layer for service by a device.
1101 Held CCBs reserve capacity on a given
1102 device.
1103 .It mintags
1104 This is the current "hard" minimum number of transactions that can be
1105 queued to a device at once.
1106 The
1107 .Ar dev_openings
1108 value above cannot go below this number.
1109 The default value for
1110 .Ar mintags
1111 is 2, although it may be set higher or lower for various devices.
1112 .It maxtags
1113 This is the "hard" maximum number of transactions that can be queued to a
1114 device at one time.
1115 The
1116 .Ar dev_openings
1117 value cannot go above this number.
1118 The default value for
1119 .Ar maxtags
1120 is 255, although it may be set higher or lower for various devices.
1121 .El
1122 .El
1123 .It Ic negotiate
1124 Show or negotiate various communication parameters.
1125 Some controllers may
1126 not support setting or changing some of these values.
1127 For instance, the
1128 Adaptec 174x controllers do not support changing a device's sync rate or
1129 offset.
1130 The
1131 .Nm
1132 utility
1133 will not attempt to set the parameter if the controller indicates that it
1134 does not support setting the parameter.
1135 To find out what the controller
1136 supports, use the
1137 .Fl v
1138 flag.
1139 The meaning of the
1140 .Fl v
1141 flag for the
1142 .Ic negotiate
1143 command is described below.
1144 Also, some controller drivers do not support
1145 setting negotiation parameters, even if the underlying controller supports
1146 negotiation changes.
1147 Some controllers, such as the Advansys wide
1148 controllers, support enabling and disabling synchronous negotiation for
1149 a device, but do not support setting the synchronous negotiation rate.
1150 .Bl -tag -width 17n
1151 .It Fl a
1152 Attempt to make the negotiation settings take effect immediately by sending
1153 a Test Unit Ready command to the device.
1154 .It Fl c
1155 Show or set current negotiation settings.
1156 This is the default.
1157 .It Fl D Ar enable|disable
1158 Enable or disable disconnection.
1159 .It Fl M Ar mode
1160 Set ATA mode.
1161 .It Fl O Ar offset
1162 Set the command delay offset.
1163 .It Fl q
1164 Be quiet, do not print anything.
1165 This is generally useful when you want to
1166 set a parameter, but do not want any status information.
1167 .It Fl R Ar syncrate
1168 Change the synchronization rate for a device.
1169 The sync rate is a floating
1170 point value specified in MHz.
1171 So, for instance,
1172 .Sq 20.000
1173 is a legal value, as is
1174 .Sq 20 .
1175 .It Fl T Ar enable|disable
1176 Enable or disable tagged queueing for a device.
1177 .It Fl U
1178 Show or set user negotiation settings.
1179 The default is to show or set
1180 current negotiation settings.
1181 .It Fl v
1182 The verbose switch has special meaning for the
1183 .Ic negotiate
1184 subcommand.
1185 It causes
1186 .Nm
1187 to print out the contents of a Path Inquiry (XPT_PATH_INQ) CCB sent to the
1188 controller driver.
1189 .It Fl W Ar bus_width
1190 Specify the bus width to negotiate with a device.
1191 The bus width is
1192 specified in bits.
1193 The only useful values to specify are 8, 16, and 32
1194 bits.
1195 The controller must support the bus width in question in order for
1196 the setting to take effect.
1197 .El
1198 .Pp
1199 In general, sync rate and offset settings will not take effect for a
1200 device until a command has been sent to the device.
1201 The
1202 .Fl a
1203 switch above will automatically send a Test Unit Ready to the device so
1204 negotiation parameters will take effect.
1205 .It Ic format
1206 Issue the
1207 .Tn SCSI
1208 FORMAT UNIT command to the named device.
1209 .Pp
1210 .Em WARNING! WARNING! WARNING!
1211 .Pp
1212 Low level formatting a disk will destroy ALL data on the disk.
1213 Use
1214 extreme caution when issuing this command.
1215 Many users low-level format
1216 disks that do not really need to be low-level formatted.
1217 There are
1218 relatively few scenarios that call for low-level formatting a disk.
1219 One reason for
1220 low-level formatting a disk is to initialize the disk after changing
1221 its physical sector size.
1222 Another reason for low-level formatting a disk
1223 is to revive the disk if you are getting "medium format corrupted" errors
1224 from the disk in response to read and write requests.
1225 .Pp
1226 Some disks take longer than others to format.
1227 Users should specify a
1228 timeout long enough to allow the format to complete.
1229 The default format
1230 timeout is 3 hours, which should be long enough for most disks.
1231 Some hard
1232 disks will complete a format operation in a very short period of time
1233 (on the order of 5 minutes or less).
1234 This is often because the drive
1235 does not really support the FORMAT UNIT command -- it just accepts the
1236 command, waits a few minutes and then returns it.
1237 .Pp
1238 The
1239 .Sq format
1240 subcommand takes several arguments that modify its default behavior.
1241 The
1242 .Fl q
1243 and
1244 .Fl y
1245 arguments can be useful for scripts.
1246 .Bl -tag -width 6n
1247 .It Fl q
1248 Be quiet, do not print any status messages.
1249 This option will not disable
1250 the questions, however.
1251 To disable questions, use the
1252 .Fl y
1253 argument, below.
1254 .It Fl r
1255 Run in
1256 .Dq report only
1257 mode.
1258 This will report status on a format that is already running on the drive.
1259 .It Fl w
1260 Issue a non-immediate format command.
1261 By default,
1262 .Nm
1263 issues the FORMAT UNIT command with the immediate bit set.
1264 This tells the
1265 device to immediately return the format command, before the format has
1266 actually completed.
1267 Then,
1268 .Nm
1269 gathers
1270 .Tn SCSI
1271 sense information from the device every second to determine how far along
1272 in the format process it is.
1273 If the
1274 .Fl w
1275 argument is specified,
1276 .Nm
1277 will issue a non-immediate format command, and will be unable to print any
1278 information to let the user know what percentage of the disk has been
1279 formatted.
1280 .It Fl y
1281 Do not ask any questions.
1282 By default,
1283 .Nm
1284 will ask the user if he/she really wants to format the disk in question,
1285 and also if the default format command timeout is acceptable.
1286 The user
1287 will not be asked about the timeout if a timeout is specified on the
1288 command line.
1289 .El
1290 .It Ic sanitize
1291 Issue the SANITIZE command to the named device.
1292 .Pp
1293 .Em WARNING! WARNING! WARNING!
1294 .Pp
1295 ALL data on the disk will be destroyed or made inaccessible.
1296 Recovery of the data is not possible.
1297 Use extreme caution when issuing this command.
1298 .Pp
1299 The
1300 .Sq sanitize
1301 subcommand takes several arguments that modify its default behavior.
1302 The
1303 .Fl q
1304 and
1305 .Fl y
1306 arguments can be useful for scripts.
1307 .Bl -tag -width 6n
1308 .It Fl a Ar operation
1309 Specify the sanitize operation to perform.
1310 .Bl -tag -width 16n
1311 .It overwrite
1312 Perform an overwrite operation by writing a user supplied
1313 data pattern to the device one or more times.
1314 The pattern is given by the
1315 .Fl P
1316 argument.
1317 The number of times is given by the
1318 .Fl c
1319 argument.
1320 .It block
1321 Perform a block erase operation.
1322 All the device's blocks are set to a vendor defined
1323 value, typically zero.
1324 .It crypto
1325 Perform a cryptographic erase operation.
1326 The encryption keys are changed to prevent the decryption
1327 of the data.
1328 .It exitfailure
1329 Exits a previously failed sanitize operation.
1330 A failed sanitize operation can only be exited if it was
1331 run in the unrestricted completion mode, as provided by the
1332 .Fl U
1333 argument.
1334 .El
1335 .It Fl c Ar passes
1336 The number of passes when performing an
1337 .Sq overwrite
1338 operation.
1339 Valid values are between 1 and 31.
1340 The default is 1.
1341 .It Fl I
1342 When performing an
1343 .Sq overwrite
1344 operation, the pattern is inverted between consecutive passes.
1345 .It Fl P Ar pattern
1346 Path to the file containing the pattern to use when
1347 performing an
1348 .Sq overwrite
1349 operation.
1350 The pattern is repeated as needed to fill each block.
1351 .It Fl q
1352 Be quiet, do not print any status messages.
1353 This option will not disable
1354 the questions, however.
1355 To disable questions, use the
1356 .Fl y
1357 argument, below.
1358 .It Fl U
1359 Perform the sanitize in the unrestricted completion mode.
1360 If the operation fails, it can later be exited with the
1361 .Sq exitfailure
1362 operation.
1363 .It Fl r
1364 Run in
1365 .Dq report only
1366 mode.
1367 This will report status on a sanitize that is already running on the drive.
1368 .It Fl w
1369 Issue a non-immediate sanitize command.
1370 By default,
1371 .Nm
1372 issues the SANITIZE command with the immediate bit set.
1373 This tells the
1374 device to immediately return the sanitize command, before
1375 the sanitize has actually completed.
1376 Then,
1377 .Nm
1378 gathers
1379 .Tn SCSI
1380 sense information from the device every second to determine how far along
1381 in the sanitize process it is.
1382 If the
1383 .Fl w
1384 argument is specified,
1385 .Nm
1386 will issue a non-immediate sanitize command, and will be unable to print any
1387 information to let the user know what percentage of the disk has been
1388 sanitized.
1389 .It Fl y
1390 Do not ask any questions.
1391 By default,
1392 .Nm
1393 will ask the user if he/she really wants to sanitize the disk in question,
1394 and also if the default sanitize command timeout is acceptable.
1395 The user
1396 will not be asked about the timeout if a timeout is specified on the
1397 command line.
1398 .El
1399 .It Ic idle
1400 Put ATA device into IDLE state.
1401 Optional parameter
1402 .Pq Fl t
1403 specifies automatic standby timer value in seconds.
1404 Value 0 disables timer.
1405 .It Ic standby
1406 Put ATA device into STANDBY state.
1407 Optional parameter
1408 .Pq Fl t
1409 specifies automatic standby timer value in seconds.
1410 Value 0 disables timer.
1411 .It Ic sleep
1412 Put ATA device into SLEEP state.
1413 Note that the only way get device out of
1414 this state may be reset.
1415 .It Ic powermode
1416 Report ATA device power mode.
1417 .It Ic apm
1418 It optional parameter
1419 .Pq Fl l
1420 specified, enables and sets advanced power management level, where
1421 1 -- minimum power, 127 -- maximum performance with standby,
1422 128 -- minimum power without standby, 254 -- maximum performance.
1423 If not specified -- APM is disabled.
1424 .It Ic aam
1425 It optional parameter
1426 .Pq Fl l
1427 specified, enables and sets automatic acoustic management level, where
1428 1 -- minimum noise, 254 -- maximum performance.
1429 If not specified -- AAM is disabled.
1430 .It Ic security
1431 Update or report security settings, using an ATA identify command (0xec).
1432 By default,
1433 .Nm
1434 will print out the security support and associated settings of the device.
1435 The
1436 .Ic security
1437 command takes several arguments:
1438 .Bl -tag -width 0n
1439 .It Fl d Ar pwd
1440 .Pp
1441 Disable device security using the given password for the selected user according
1442 to the devices configured security level.
1443 .It Fl e Ar pwd
1444 .Pp
1445 Erase the device using the given password for the selected user.
1446 .Pp
1447 .Em WARNING! WARNING! WARNING!
1448 .Pp
1449 Issuing a secure erase will
1450 .Em ERASE ALL
1451 user data on the device and may take several hours to complete.
1452 .Pp
1453 When this command is used against an SSD drive all its cells will be marked as
1454 empty, restoring it to factory default write performance.
1455 For SSD's this action
1456 usually takes just a few seconds.
1457 .It Fl f
1458 .Pp
1459 Freeze the security configuration of the specified device.
1460 .Pp
1461 After command completion any other commands that update the device lock mode
1462 shall be command aborted.
1463 Frozen mode is disabled by power-off or hardware reset.
1464 .It Fl h Ar pwd
1465 .Pp
1466 Enhanced erase the device using the given password for the selected user.
1467 .Pp
1468 .Em WARNING! WARNING! WARNING!
1469 .Pp
1470 Issuing an enhanced secure erase will
1471 .Em ERASE ALL
1472 user data on the device and may take several hours to complete.
1473 .Pp
1474 An enhanced erase writes predetermined data patterns to all user data areas,
1475 all previously written user data shall be overwritten, including sectors that
1476 are no longer in use due to reallocation.
1477 .It Fl k Ar pwd
1478 .Pp
1479 Unlock the device using the given password for the selected user according to
1480 the devices configured security level.
1481 .It Fl l Ar high|maximum
1482 .Pp
1483 Specifies which security level to set when issuing a
1484 .Fl s Ar pwd
1485 command.
1486 The security level determines device behavior when the master
1487 password is used to unlock the device.
1488 When the security level is set to high
1489 the device requires the unlock command and the master password to unlock.
1490 When the security level is set to maximum the device requires a secure erase
1491 with the master password to unlock.
1492 .Pp
1493 This option must be used in conjunction with one of the security action commands.
1494 .Pp
1495 Defaults to
1496 .Em high
1497 .It Fl q
1498 .Pp
1499 Be quiet, do not print any status messages.
1500 This option will not disable the questions, however.
1501 To disable questions, use the
1502 .Fl y
1503 argument, below.
1504 .It Fl s Ar pwd
1505 .Pp
1506 Password the device (enable security) using the given password for the selected
1507 user.
1508 This option can be combined with other options such as
1509 .Fl e Em pwd
1510 .Pp
1511 A master password may be set in a addition to the user password.
1512 The purpose of the master password is to allow an administrator to establish
1513 a password that is kept secret from the user, and which may be used to unlock
1514 the device if the user password is lost.
1515 .Pp
1516 .Em Note:
1517 Setting the master password does not enable device security.
1518 .Pp
1519 If the master password is set and the drive supports a Master Revision Code
1520 feature the Master Password Revision Code will be decremented.
1521 .It Fl T Ar timeout
1522 .Pp
1523 Overrides the default timeout, specified in seconds, used for both
1524 .Fl e
1525 and
1526 .Fl h
1527 this is useful if your system has problems processing long timeouts correctly.
1528 .Pp
1529 Usually the timeout is calculated from the information stored on the drive if
1530 present, otherwise it defaults to 2 hours.
1531 .It Fl U Ar user|master
1532 .Pp
1533 Specifies which user to set / use for the running action command, valid values
1534 are user or master and defaults to master if not set.
1535 .Pp
1536 This option must be used in conjunction with one of the security action commands.
1537 .Pp
1538 Defaults to
1539 .Em master
1540 .It Fl y
1541 .Pp
1542 Confirm yes to dangerous options such as
1543 .Fl e
1544 without prompting for confirmation.
1545 .El
1546 .Pp
1547 If the password specified for any action commands does not match the configured
1548 password for the specified user the command will fail.
1549 .Pp
1550 The password in all cases is limited to 32 characters, longer passwords will
1551 fail.
1552 .It Ic hpa
1553 Update or report Host Protected Area details.
1554 By default
1555 .Nm
1556 will print out the HPA support and associated settings of the device.
1557 The
1558 .Ic hpa
1559 command takes several optional arguments:
1560 .Bl -tag -width 0n
1561 .It Fl f
1562 .Pp
1563 Freeze the HPA configuration of the specified device.
1564 .Pp
1565 After command completion any other commands that update the HPA configuration
1566 shall be command aborted.
1567 Frozen mode is disabled by power-off or hardware reset.
1568 .It Fl l
1569 .Pp
1570 Lock the HPA configuration of the device until a successful call to unlock or
1571 the next power-on reset occurs.
1572 .It Fl P
1573 .Pp
1574 Make the HPA max sectors persist across power-on reset or a hardware reset.
1575 This must be used in combination with
1576 .Fl s Ar max_sectors
1577 .
1578 .It Fl p Ar pwd
1579 .Pp
1580 Set the HPA configuration password required for unlock calls.
1581 .It Fl q
1582 .Pp
1583 Be quiet, do not print any status messages.
1584 This option will not disable the questions.
1585 To disable questions, use the
1586 .Fl y
1587 argument, below.
1588 .It Fl s Ar max_sectors
1589 .Pp
1590 Configures the maximum user accessible sectors of the device.
1591 This will change the number of sectors the device reports.
1592 .Pp
1593 .Em WARNING! WARNING! WARNING!
1594 .Pp
1595 Changing the max sectors of a device using this option will make the data on
1596 the device beyond the specified value inaccessible.
1597 .Pp
1598 Only one successful
1599 .Fl s Ar max_sectors
1600 call can be made without a power-on reset or a hardware reset of the device.
1601 .It Fl U Ar pwd
1602 .Pp
1603 Unlock the HPA configuration of the specified device using the given password.
1604 If the password specified does not match the password configured via
1605 .Fl p Ar pwd
1606 the command will fail.
1607 .Pp
1608 After 5 failed unlock calls, due to password miss-match, the device will refuse
1609 additional unlock calls until after a power-on reset.
1610 .It Fl y
1611 .Pp
1612 Confirm yes to dangerous options such as
1613 .Fl e
1614 without prompting for confirmation
1615 .El
1616 .Pp
1617 The password for all HPA commands is limited to 32 characters, longer passwords
1618 will fail.
1619 .It Ic ama
1620 Update or report Accessible Max Address Configuration.
1621 By default
1622 .Nm
1623 will print out the Accessible Max Address Configuration support and associated
1624 settings of the device.
1625 The
1626 .Ic ama
1627 command takes several optional arguments:
1628 .Bl -tag -width 0n
1629 .It Fl f
1630 .Pp
1631 Freeze the Accessible Max Address Configuration of the specified device.
1632 .Pp
1633 After command completion any other commands that update the configuration
1634 shall be command aborted.
1635 Frozen mode is disabled by power-off.
1636 .It Fl q
1637 .Pp
1638 Be quiet, do not print any status messages.
1639 .It Fl s Ar max_sectors
1640 .Pp
1641 Configures the maximum user accessible sectors of the device.
1642 This will change the number of sectors the device reports.
1643 .Pp
1644 .Em WARNING! WARNING! WARNING!
1645 .Pp
1646 Changing the max sectors of a device using this option will make the data on
1647 the device beyond the specified value indeterminate.
1648 .Pp
1649 Only one successful
1650 .Fl s Ar max_sectors
1651 call can be made without a power-on reset of the device.
1652 .El
1653 .It Ic fwdownload
1654 Program firmware of the named
1655 .Tn SCSI
1656 or ATA device using the image file provided.
1657 .Pp
1658 If the device is a
1659 .Tn SCSI
1660 device and it provides a recommended timeout for the WRITE BUFFER command
1661 (see the
1662 .Nm
1663 opcodes subcommand), that timeout will be used for the firmware download.
1664 The drive-recommended timeout value may be overridden on the command line
1665 with the
1666 .Fl t
1667 option.
1668 .Pp
1669 Current list of supported vendors for SCSI/SAS drives:
1670 .Bl -tag -width 10n
1671 .It HGST
1672 Tested with 4TB SAS drives, model number HUS724040ALS640.
1673 .It HITACHI
1674 .It HP
1675 .It IBM
1676 Tested with LTO-5 (ULTRIUM-HH5) and LTO-6 (ULTRIUM-HH6) tape drives.
1677 There is a separate table entry for hard drives, because the update method
1678 for hard drives is different than the method for tape drives.
1679 .It PLEXTOR
1680 .It QUALSTAR
1681 .It QUANTUM
1682 .It SAMSUNG
1683 Tested with SM1625 SSDs.
1684 .It SEAGATE
1685 Tested with Constellation ES (ST32000444SS), ES.2 (ST33000651SS) and
1686 ES.3 (ST1000NM0023) drives.
1687 .It SmrtStor
1688 Tested with 400GB Optimus SSDs (TXA2D20400GA6001).
1689 .El
1690 .Pp
1691 .Em WARNING! WARNING! WARNING!
1692 .Pp
1693 Little testing has been done to make sure that different device models from
1694 each vendor work correctly with the fwdownload command.
1695 A vendor name appearing in the supported list means only that firmware of at
1696 least one device type from that vendor has successfully been programmed with
1697 the fwdownload command.
1698 Extra caution should be taken when using this command since there is no
1699 guarantee it will not break a device from the listed vendors.
1700 Ensure that you have a recent backup of the data on the device before
1701 performing a firmware update.
1702 .Pp
1703 Note that unknown
1704 .Tn SCSI
1705 protocol devices will not be programmed, since there is little chance of
1706 the firmware download succeeding.
1707 .Pp
1708 .Nm
1709 will currently attempt a firmware download to any
1710 .Tn ATA
1711 or
1712 .Tn SATA
1713 device, since the standard
1714 .Tn ATA
1715 DOWNLOAD MICROCODE command may work.
1716 Firmware downloads to
1717 .Tn ATA
1718 and
1719 .Tn SATA
1720 devices are supported for devices connected
1721 to standard
1722 .Tn ATA
1723 and
1724 .Tn SATA
1725 controllers, and devices connected to SAS controllers
1726 with
1727 .Tn SCSI
1728 to
1729 .Tn ATA
1730 translation capability.
1731 In the latter case,
1732 .Nm
1733 uses the
1734 .Tn SCSI
1735 .Tn ATA
1736 PASS-THROUGH command to send the
1737 .Tn ATA
1738 DOWNLOAD MICROCODE command to the drive.
1739 Some
1740 .Tn SCSI
1741 to
1742 .Tn ATA
1743 translation implementations don't work fully when translating
1744 .Tn SCSI
1745 WRITE BUFFER commands to
1746 .Tn ATA
1747 DOWNLOAD MICROCODE commands, but do support
1748 .Tn ATA
1749 passthrough well enough to do a firmware download.
1750 .Bl -tag -width 11n
1751 .It Fl f Ar fw_image
1752 Path to the firmware image file to be downloaded to the specified device.
1753 .It Fl q
1754 Do not print informational messages, only print errors.
1755 This option should be used with the
1756 .Fl y
1757 option to suppress all output.
1758 .It Fl s
1759 Run in simulation mode.
1760 Device checks are run and the confirmation dialog is shown, but no firmware
1761 download will occur.
1762 .It Fl v
1763 Show
1764 .Tn SCSI
1765 or
1766 .Tn ATA
1767 errors in the event of a failure.
1768 .Pp
1769 In simulation mode, print out the
1770 .Tn SCSI
1771 CDB
1772 or
1773 .Tn ATA
1774 register values that would be used for the firmware download command.
1775 .It Fl y
1776 Do not ask for confirmation.
1777 .El
1778 .It Ic persist
1779 Persistent reservation support.
1780 Persistent reservations are a way to reserve a particular
1781 .Tn SCSI
1782 LUN for use by one or more
1783 .Tn SCSI
1784 initiators.
1785 If the
1786 .Fl i
1787 option is specified,
1788 .Nm
1789 will issue the
1790 .Tn SCSI
1791 PERSISTENT RESERVE IN
1792 command using the requested service action.
1793 If the
1794 .Fl o
1795 option is specified,
1796 .Nm
1797 will issue the
1798 .Tn SCSI
1799 PERSISTENT RESERVE OUT
1800 command using the requested service action.
1801 One of those two options is required.
1802 .Pp
1803 Persistent reservations are complex, and fully explaining them is outside
1804 the scope of this manual.
1805 Please visit
1806 http://www.t10.org
1807 and download the latest SPC spec for a full explanation of persistent
1808 reservations.
1809 .Bl -tag -width 8n
1810 .It Fl i Ar mode
1811 Specify the service action for the PERSISTENT RESERVE IN command.
1812 Supported service actions:
1813 .Bl -tag -width 19n
1814 .It read_keys
1815 Report the current persistent reservation generation (PRgeneration) and any
1816 registered keys.
1817 .It read_reservation
1818 Report the persistent reservation, if any.
1819 .It report_capabilities
1820 Report the persistent reservation capabilities of the LUN.
1821 .It read_full_status
1822 Report the full status of persistent reservations on the LUN.
1823 .El
1824 .It Fl o Ar mode
1825 Specify the service action for the PERSISTENT RESERVE OUT command.
1826 For service actions like register that are components of other service
1827 action names, the entire name must be specified.
1828 Otherwise, enough of the service action name must be specified to
1829 distinguish it from other possible service actions.
1830 Supported service actions:
1831 .Bl -tag -width 15n
1832 .It register
1833 Register a reservation key with the LUN or unregister a reservation key.
1834 To register a key, specify the requested key as the Service Action
1835 Reservation Key.
1836 To unregister a key, specify the previously registered key as the
1837 Reservation Key.
1838 To change a key, specify the old key as the Reservation Key and the new
1839 key as the Service Action Reservation Key.
1840 .It register_ignore
1841 This is similar to the register subcommand, except that the Reservation Key
1842 is ignored.
1843 The Service Action Reservation Key will overwrite any previous key
1844 registered for the initiator.
1845 .It reserve
1846 Create a reservation.
1847 A key must be registered with the LUN before the LUN can be reserved, and
1848 it must be specified as the Reservation Key.
1849 The type of reservation must also be specified.
1850 The scope defaults to LUN scope (LU_SCOPE), but may be changed.
1851 .It release
1852 Release a reservation.
1853 The Reservation Key must be specified.
1854 .It clear
1855 Release a reservation and remove all keys from the device.
1856 The Reservation Key must be specified.
1857 .It preempt
1858 Remove a reservation belonging to another initiator.
1859 The Reservation Key must be specified.
1860 The Service Action Reservation Key may be specified, depending on the
1861 operation being performed.
1862 .It preempt_abort
1863 Remove a reservation belonging to another initiator and abort all
1864 outstanding commands from that initiator.
1865 The Reservation Key must be specified.
1866 The Service Action Reservation Key may be specified, depending on the
1867 operation being performed.
1868 .It register_move
1869 Register another initiator with the LUN, and establish a reservation on the
1870 LUN for that initiator.
1871 The Reservation Key and Service Action Reservation Key must be specified.
1872 .It replace_lost
1873 Replace Lost Reservation information.
1874 .El
1875 .It Fl a
1876 Set the All Target Ports (ALL_TG_PT) bit.
1877 This requests that the key registration be applied to all target ports and
1878 not just the particular target port that receives the command.
1879 This only applies to the register and register_ignore actions.
1880 .It Fl I Ar tid
1881 Specify a Transport ID.
1882 This only applies to the Register and Register and Move service actions for
1883 Persistent Reserve Out.
1884 Multiple Transport IDs may be specified with multiple
1885 .Fl I
1886 arguments.
1887 With the Register service action, specifying one or more Transport IDs
1888 implicitly enables the
1889 .Fl S
1890 option which turns on the SPEC_I_PT bit.
1891 Transport IDs generally have the format protocol,id.
1892 .Bl -tag -width 5n
1893 .It SAS
1894 A SAS Transport ID consists of
1895 .Dq sas,
1896 followed by a 64-bit SAS address.
1897 For example:
1898 .Pp
1899 .Dl sas,0x1234567812345678
1900 .It FC
1901 A Fibre Channel Transport ID consists of
1902 .Dq fcp,
1903 followed by a 64-bit Fibre Channel World Wide Name.
1904 For example:
1905 .Pp
1906 .Dl fcp,0x1234567812345678
1907 .It SPI
1908 A Parallel SCSI address consists of
1909 .Dq spi,
1910 followed by a SCSI target ID and a relative target port identifier.
1911 For example:
1912 .Pp
1913 .Dl spi,4,1
1914 .It 1394
1915 An IEEE 1394 (Firewire) Transport ID consists of
1916 .Dq sbp,
1917 followed by a 64-bit EUI-64 IEEE 1394 node unique identifier.
1918 For example:
1919 .Pp
1920 .Dl sbp,0x1234567812345678
1921 .It RDMA
1922 A SCSI over RDMA Transport ID consists of
1923 .Dq srp,
1924 followed by a 128-bit RDMA initiator port identifier.
1925 The port identifier must be exactly 32 or 34 (if the leading 0x is
1926 included) hexadecimal digits.
1927 Only hexadecimal (base 16) numbers are supported.
1928 For example:
1929 .Pp
1930 .Dl srp,0x12345678123456781234567812345678
1931 .It iSCSI
1932 An iSCSI Transport ID consists an iSCSI name and optionally a separator and
1933 iSCSI session ID.
1934 For example, if only the iSCSI name is specified:
1935 .Pp
1936 .Dl iqn.2012-06.com.example:target0
1937 .Pp
1938 If the iSCSI separator and initiator session ID are specified:
1939 .Pp
1940 .Dl iqn.2012-06.com.example:target0,i,0x123
1941 .It PCIe
1942 A SCSI over PCIe Transport ID consists of
1943 .Dq sop,
1944 followed by a PCIe Routing ID.
1945 The Routing ID consists of a bus, device and function or in the alternate
1946 form, a bus and function.
1947 The bus must be in the range of 0 to 255 inclusive and the device must be
1948 in the range of 0 to 31 inclusive.
1949 The function must be in the range of 0 to 7 inclusive if the standard form
1950 is used, and in the range of 0 to 255 inclusive if the alternate form is
1951 used.
1952 For example, if a bus, device and function are specified for the standard
1953 Routing ID form:
1954 .Pp
1955 .Dl sop,4,5,1
1956 .Pp
1957 If the alternate Routing ID form is used:
1958 .Pp
1959 .Dl sop,4,1
1960 .El
1961 .It Fl k Ar key
1962 Specify the Reservation Key.
1963 This may be in decimal, octal or hexadecimal format.
1964 The value is zero by default if not otherwise specified.
1965 The value must be between 0 and 2^64 - 1, inclusive.
1966 .It Fl K Ar key
1967 Specify the Service Action Reservation Key.
1968 This may be in decimal, octal or hexadecimal format.
1969 The value is zero by default if not otherwise specified.
1970 The value must be between 0 and 2^64 - 1, inclusive.
1971 .It Fl p
1972 Enable the Activate Persist Through Power Loss bit.
1973 This is only used for the register and register_ignore actions.
1974 This requests that the reservation persist across power loss events.
1975 .It Fl s Ar scope
1976 Specify the scope of the reservation.
1977 The scope may be specified by name or by number.
1978 The scope is ignored for register, register_ignore and clear.
1979 If the desired scope isn't available by name, you may specify the number.
1980 .Bl -tag -width 7n
1981 .It lun
1982 LUN scope (0x00).
1983 This encompasses the entire LUN.
1984 .It extent
1985 Extent scope (0x01).
1986 .It element
1987 Element scope (0x02).
1988 .El
1989 .It Fl R Ar rtp
1990 Specify the Relative Target Port.
1991 This only applies to the Register and Move service action of the Persistent
1992 Reserve Out command.
1993 .It Fl S
1994 Enable the SPEC_I_PT bit.
1995 This only applies to the Register service action of Persistent Reserve Out.
1996 You must also specify at least one Transport ID with
1997 .Fl I
1998 if this option is set.
1999 If you specify a Transport ID, this option is automatically set.
2000 It is an error to specify this option for any service action other than
2001 Register.
2002 .It Fl T Ar type
2003 Specify the reservation type.
2004 The reservation type may be specified by name or by number.
2005 If the desired reservation type isn't available by name, you may specify
2006 the number.
2007 Supported reservation type names:
2008 .Bl -tag -width 11n
2009 .It read_shared
2010 Read Shared mode.
2011 .It wr_ex
2012 Write Exclusive mode.
2013 May also be specified as
2014 .Dq write_exclusive .
2015 .It rd_ex
2016 Read Exclusive mode.
2017 May also be specified as
2018 .Dq read_exclusive .
2019 .It ex_ac
2020 Exclusive access mode.
2021 May also be specified as
2022 .Dq exclusive_access .
2023 .It wr_ex_ro
2024 Write Exclusive Registrants Only mode.
2025 May also be specified as
2026 .Dq write_exclusive_reg_only .
2027 .It ex_ac_ro
2028 Exclusive Access Registrants Only mode.
2029 May also be specified as
2030 .Dq exclusive_access_reg_only .
2031 .It wr_ex_ar
2032 Write Exclusive All Registrants mode.
2033 May also be specified as
2034 .Dq write_exclusive_all_regs .
2035 .It ex_ac_ar
2036 Exclusive Access All Registrants mode.
2037 May also be specified as
2038 .Dq exclusive_access_all_regs .
2039 .El
2040 .It Fl U
2041 Specify that the target should unregister the initiator that sent
2042 the Register and Move request.
2043 By default, the target will not unregister the initiator that sends the
2044 Register and Move request.
2045 This option only applies to the Register and Move service action of the
2046 Persistent Reserve Out command.
2047 .El
2048 .It Ic attrib
2049 Issue the
2050 .Tn SCSI
2051 READ or WRITE ATTRIBUTE commands.
2052 These commands are used to read and write attributes in Medium Auxiliary
2053 Memory (MAM).
2054 The most common place Medium Auxiliary Memory is found is small flash chips
2055 included tape cartriges.
2056 For instance,
2057 .Tn LTO
2058 tapes have MAM.
2059 Either the
2060 .Fl r
2061 option or the
2062 .Fl w
2063 option must be specified.
2064 .Bl -tag -width 14n
2065 .It Fl r Ar action
2066 Specify the READ ATTRIBUTE service action.
2067 .Bl -tag -width 11n
2068 .It attr_values
2069 Issue the ATTRIBUTE VALUES service action.
2070 Read and decode the available attributes and their values.
2071 .It attr_list
2072 Issue the ATTRIBUTE LIST service action.
2073 List the attributes that are available to read and write.
2074 .It lv_list
2075 Issue the LOGICAL VOLUME LIST service action.
2076 List the available logical volumes in the MAM.
2077 .It part_list
2078 Issue the PARTITION LIST service action.
2079 List the available partitions in the MAM.
2080 .It supp_attr
2081 Issue the SUPPORTED ATTRIBUTES service action.
2082 List attributes that are supported for reading or writing.
2083 These attributes may or may not be currently present in the MAM.
2084 .El
2085 .It Fl w Ar attr
2086 Specify an attribute to write to the MAM.
2087 This option is not yet implemented.
2088 .It Fl a Ar num
2089 Specify the attribute number to display.
2090 This option only works with the attr_values, attr_list and supp_attr
2091 arguments to
2092 .Fl r .
2093 .It Fl c
2094 Display cached attributes.
2095 If the device supports this flag, it allows displaying attributes for the
2096 last piece of media loaded in the drive.
2097 .It Fl e Ar num
2098 Specify the element address.
2099 This is used for specifying which element number in a medium changer to
2100 access when reading attributes.
2101 The element number could be for a picker, portal, slot or drive.
2102 .It Fl F Ar form1,form2
2103 Specify the output format for the attribute values (attr_val) display as a
2104 comma separated list of options.
2105 The default output is currently set to field_all,nonascii_trim,text_raw.
2106 Once this code is ported to FreeBSD 10, any text fields will be converted
2107 from their codeset to the user's native codeset with
2108 .Xr iconv 3 .
2109 .Pp
2110 The text options are mutually exclusive; if you specify more than one, you
2111 will get unpredictable results.
2112 The nonascii options are also mutually exclusive.
2113 Most of the field options may be logically ORed together.
2114 .Bl -tag -width 12n
2115 .It text_esc
2116 Print text fields with non-ASCII characters escaped.
2117 .It text_raw
2118 Print text fields natively, with no codeset conversion.
2119 .It nonascii_esc
2120 If any non-ASCII characters occur in fields that are supposed to be ASCII,
2121 escape the non-ASCII characters.
2122 .It nonascii_trim
2123 If any non-ASCII characters occur in fields that are supposed to be ASCII,
2124 omit the non-ASCII characters.
2125 .It nonascii_raw
2126 If any non-ASCII characters occur in fields that are supposed to be ASCII,
2127 print them as they are.
2128 .It field_all
2129 Print all of the prefix fields: description, attribute number, attribute
2130 size, and the attribute's readonly status.
2131 If field_all is specified, specifying any other field options will not have
2132 an effect.
2133 .It field_none
2134 Print none of the prefix fields, and only print out the attribute value.
2135 If field_none is specified, specifying any other field options will result
2136 in those fields being printed.
2137 .It field_desc
2138 Print out the attribute description.
2139 .It field_num
2140 Print out the attribute number.
2141 .It field_size
2142 Print out the attribute size.
2143 .It field_rw
2144 Print out the attribute's readonly status.
2145 .El
2146 .It Fl p Ar part
2147 Specify the partition.
2148 When the media has multiple partitions, specifying different partition
2149 numbers allows seeing the values for each individual partition.
2150 .It Fl s Ar start_num
2151 Specify the starting attribute number.
2152 This requests that the target device return attribute information starting
2153 at the given number.
2154 .It Fl T Ar elem_type
2155 Specify the element type.
2156 For medium changer devices, this allows specifying the type the element
2157 referenced in the element address (
2158 .Fl e ) .
2159 Valid types are:
2160 .Dq all ,
2161 .Dq picker ,
2162 .Dq slot ,
2163 .Dq portal ,
2164 and
2165 .Dq drive .
2166 .It Fl V Ar vol_num
2167 Specify the number of the logical volume to operate on.
2168 If the media has multiple logical volumes, this will allow displaying
2169 or writing attributes on the given logical volume.
2170 .El
2171 .It Ic opcodes
2172 Issue the REPORT SUPPORTED OPCODES service action of the
2173 .Tn SCSI
2174 MAINTENANCE IN
2175 command.
2176 Without arguments, this command will return a list of all
2177 .Tn SCSI
2178 commands supported by the device, including service actions of commands
2179 that support service actions.
2180 It will also include the
2181 .Tn SCSI
2182 CDB (Command Data Block) length for each command, and the description of
2183 each command if it is known.
2184 .Bl -tag -width 18n
2185 .It Fl o Ar opcode
2186 Request information on a specific opcode instead of the list of supported
2187 commands.
2188 If supported, the target will return a CDB-like structure that indicates
2189 the opcode, service action (if any), and a mask of bits that are supported
2190 in that CDB.
2191 .It Fl s Ar service_action
2192 For commands that support a service action, specify the service action to
2193 query.
2194 .It Fl N
2195 If a service action is specified for a given opcode, and the device does
2196 not support the given service action, the device should not return a
2197 .Tn SCSI
2198 error, but rather indicate in the returned parameter data that the command
2199 is not supported.
2200 By default, if a service action is specified for an opcode, and service
2201 actions are not supported for the opcode in question, the device will
2202 return an error.
2203 .It Fl T
2204 Include timeout values.
2205 This option works with the default display, which includes all commands
2206 supported by the device, and with the
2207 .Fl o
2208 and
2209 .Fl s
2210 options, which request information on a specific command and service
2211 action.
2212 This requests that the device report Nominal and Recommended timeout values
2213 for the given command or commands.
2214 The timeout values are in seconds.
2215 The timeout descriptor also includes a command-specific
2216 .El
2217 .It Ic zone
2218 Manage
2219 .Tn SCSI
2220 and
2221 .Tn ATA
2222 Zoned Block devices.
2223 This allows managing devices that conform to the
2224 .Tn SCSI
2225 Zoned Block Commands (ZBC) and
2226 .Tn ATA
2227 Zoned ATA Command Set (ZAC)
2228 specifications.
2229 Devices using these command sets are usually hard drives using Shingled
2230 Magnetic Recording (SMR).
2231 There are three types of SMR drives:
2232 .Bl -tag -width 13n
2233 .It Drive Managed
2234 Drive Managed drives look and act just like a standard random access block
2235 device, but underneath, the drive reads and writes the bulk of its capacity
2236 using SMR zones.
2237 Sequential writes will yield better performance, but writing sequentially
2238 is not required.
2239 .It Host Aware
2240 Host Aware drives expose the underlying zone layout via
2241 .Tn SCSI
2242 or
2243 .Tn ATA
2244 commands and allow the host to manage the zone conditions.
2245 The host is not required to manage the zones on the drive, though.
2246 Sequential writes will yield better performance in Sequential Write
2247 Preferred zones, but the host can write randomly in those zones.
2248 .It Host Managed
2249 Host Managed drives expose the underlying zone layout via
2250 .Tn SCSI
2251 or
2252 .Tn ATA
2253 commands.
2254 The host is required to access the zones according to the rules described
2255 by the zone layout.
2256 Any commands that violate the rules will be returned with an error.
2257 .El
2258 .Pp
2259 SMR drives are divided into zones (typically in the range of 256MB each)
2260 that fall into three general categories:
2261 .Bl -tag -width 20n
2262 .It Conventional
2263 These are also known as Non Write Pointer zones.
2264 These zones can be randomly written without an unexpected performance penalty.
2265 .It Sequential Preferred
2266 These zones should be written sequentially starting at the write pointer
2267 for the zone.
2268 They may be written randomly.
2269 Writes that do not conform to the zone layout may be significantly slower
2270 than expected.
2271 .It Sequential Required
2272 These zones must be written sequentially.
2273 If they are not written sequentially, starting at the write pointer, the
2274 command will fail.
2275 .El
2276 .Bl -tag -width 12n
2277 .It Fl c Ar cmd
2278 Specify the zone subcommand:
2279 .Bl -tag -width 6n
2280 .It rz
2281 Issue the Report Zones command.
2282 All zones are returned by default.
2283 Specify report options with
2284 .Fl o
2285 and printing options with
2286 .Fl P .
2287 Specify the starting LBA with
2288 .Fl l .
2289 Note that
2290 .Dq reportzones
2291 is also accepted as a command argument.
2292 .It open
2293 Explicitly open the zone specified by the starting LBA.
2294 .It close
2295 Close the zone specified by starting LBA.
2296 .It finish
2297 Finish the zone specified by the starting LBA.
2298 .It rwp
2299 Reset the write pointer for the zone specified by the starting LBA.
2300 .El
2301 .It Fl a
2302 For the Open, Close, Finish, and Reset Write Pointer operations, apply the
2303 operation to all zones on the drive.
2304 .It Fl l Ar lba
2305 Specify the starting LBA.
2306 For the Report Zones command, this tells the drive to report starting with
2307 the zone that starts at the given LBA.
2308 For the other commands, this allows the user to identify the zone requested
2309 by its starting LBA.
2310 The LBA may be specified in decimal, hexadecimal or octal notation.
2311 .It Fl o Ar rep_opt
2312 For the Report Zones command, specify a subset of zones to report.
2313 .Bl -tag -width 8n
2314 .It all
2315 Report all zones.
2316 This is the default.
2317 .It emtpy
2318 Report only empty zones.
2319 .It imp_open
2320 Report zones that are implicitly open.
2321 This means that the host has sent a write to the zone without explicitly
2322 opening the zone.
2323 .It exp_open
2324 Report zones that are explicitly open.
2325 .It closed
2326 Report zones that have been closed by the host.
2327 .It full
2328 Report zones that are full.
2329 .It ro
2330 Report zones that are in the read only state.
2331 Note that
2332 .Dq readonly
2333 is also accepted as an argument.
2334 .It offline
2335 Report zones that are in the offline state.
2336 .It reset
2337 Report zones where the device recommends resetting write pointers.
2338 .It nonseq
2339 Report zones that have the Non Sequential Resources Active flag set.
2340 These are zones that are Sequential Write Preferred, but have been written
2341 non-sequentially.
2342 .It nonwp
2343 Report Non Write Pointer zones, also known as Conventional zones.
2344 .El
2345 .It Fl P Ar print_opt
2346 Specify a printing option for Report Zones:
2347 .Bl -tag -width 7n
2348 .It normal
2349 Normal Report Zones output.
2350 This is the default.
2351 The summary and column headings are printed, fields are separated by spaces
2352 and the fields themselves may contain spaces.
2353 .It summary
2354 Just print the summary:  the number of zones, the maximum LBA (LBA of the
2355 last logical block on the drive), and the value of the
2356 .Dq same
2357 field.
2358 The
2359 .Dq same
2360 field describes whether the zones on the drive are all identical, all
2361 different, or whether they are the same except for the last zone, etc.
2362 .It script
2363 Print the zones in a script friendly format.
2364 The summary and column headings are omitted, the fields are separated by
2365 commas, and the fields do not contain spaces.
2366 The fields contain underscores where spaces would normally be used.
2367 .El
2368 .El
2369 .It Ic epc
2370 Issue
2371 .Tn ATA
2372 Extended Power Conditions (EPC) feature set commands.
2373 This only works on
2374 .Tn ATA
2375 protocol drives, and will not work on
2376 .Tn SCSI
2377 protocol drives.
2378 It will work on
2379 .Tn SATA
2380 drives behind a
2381 .Tn SCSI
2382 to
2383 .Tn ATA
2384 translation layer (SAT).
2385 It may be helpful to read the ATA Command Set - 4 (ACS-4) description of
2386 the Extended Power Conditions feature set, available at t13.org, to
2387 understand the details of this particular
2388 .Nm
2389 subcommand.
2390 .Bl -tag -width 6n
2391 .It Fl c Ar cmd
2392 Specify the epc subcommand
2393 .Bl -tag -width 7n
2394 .It restore
2395 Restore drive power condition settings.
2396 .Bl -tag -width 6n
2397 .It Fl r Ar src
2398 Specify the source for the restored power settings, either
2399 .Dq default
2400 or
2401 .Dq saved .
2402 This argument is required.
2403 .It Fl s
2404 Save the settings.
2405 This only makes sense to specify when restoring from defaults.
2406 .El
2407 .It goto
2408 Go to the specified power condition.
2409 .Bl -tag -width 7n
2410 .It Fl p Ar cond
2411 Specify the power condition: Idle_a, Idle_b, Idle_c, Standby_y, Standby_z.
2412 This argument is required.
2413 .It Fl D
2414 Specify delayed entry to the power condition.
2415 The drive, if it supports this, can enter the power condition after the
2416 command completes.
2417 .It Fl H
2418 Hold the power condition.
2419 If the drive supports this option, it will hold the power condition and
2420 reject all commands that would normally cause it to exit that power
2421 condition.
2422 .El
2423 .It timer
2424 Set the timer value for a power condition and enable or disable the
2425 condition.
2426 See the
2427 .Dq list
2428 display described below to see what the current timer settings are for each
2429 Idle and Standby mode supported by the drive.
2430 .Bl -tag -width 8n
2431 .It Fl e
2432 Enable the power condition.
2433 One of
2434 .Fl e
2435 or
2436 .Fl d
2437 is required.
2438 .It Fl d
2439 Disable the power condition.
2440 One of
2441 .Fl d
2442 or
2443 .Fl e
2444 is required.
2445 .It Fl T Ar timer
2446 Specify the timer in seconds.
2447 The user may specify a timer as a floating point number with a maximum
2448 supported resolution of tenths of a second.
2449 Drives may or may not support sub-second timer values.
2450 .It Fl p Ar cond
2451 Specify the power condition: Idle_a, Idle_b, Idle_c, Standby_y, Standby_z.
2452 This argument is required.
2453 .It Fl s
2454 Save the timer and power condition enable/disable state.
2455 By default, if this option is not specified, only the current values for
2456 this power condition will be affected.
2457 .El
2458 .It state
2459 Enable or disable a particular power condition.
2460 .Bl -tag -width 7n
2461 .It Fl e
2462 Enable the power condition.
2463 One of
2464 .Fl e
2465 or
2466 .Fl d
2467 is required.
2468 .It Fl d
2469 Disable the power condition.
2470 One of
2471 .Fl d
2472 or
2473 .Fl e
2474 is required.
2475 .It Fl p Ar cond
2476 Specify the power condition: Idle_a, Idle_b, Idle_c, Standby_y, Standby_z.
2477 This argument is required.
2478 .It Fl s
2479 Save the power condition enable/disable state.
2480 By default, if this option is not specified, only the current values for
2481 this power condition will be affected.
2482 .El
2483 .It enable
2484 Enable the Extended Power Condition (EPC) feature set.
2485 .It disable
2486 Disable the Extended Power Condition (EPC) feature set.
2487 .It source
2488 Specify the EPC power source.
2489 .Bl -tag -width 6n
2490 .It Fl S Ar src
2491 Specify the power source, either
2492 .Dq battery
2493 or
2494 .Dq nonbattery .
2495 .El
2496 .It status
2497 Get the current status of several parameters related to the Extended Power
2498 Condition (EPC) feature set, including whether APM and EPC are supported
2499 and enabled, whether Low Power Standby is supported, whether setting the
2500 EPC power source is supported, whether Low Power Standby is supported and
2501 the current power condition.
2502 .Bl -tag -width 3n
2503 .It Fl P
2504 Only report the current power condition.
2505 Some drives will exit their current power condition if a command other than
2506 the
2507 .Tn ATA
2508 CHECK POWER MODE command is received.
2509 If this flag is specified,
2510 .Nm
2511 will only issue the
2512 .Tn ATA
2513 CHECK POWER MODE command to the drive.
2514 .El
2515 .It list
2516 Display the
2517 .Tn ATA
2518 Power Conditions log (Log Address 0x08).
2519 This shows the list of Idle and Standby power conditions the drive
2520 supports, and a number of parameters about each condition, including
2521 whether it is enabled and what the timer value is.
2522 .El
2523 .El
2524 .It Ic timestamp
2525 Issue REPORT TIMESTAMP or SET TIMESTAMP
2526 .Tn SCSI
2527 commands.
2528 Either the
2529 .Fl r
2530 option or the
2531 .Fl s
2532 option must be specified.
2533 .Bl -tag -width 6n
2534 .It Fl r
2535 Report the device's timestamp.
2536 If no more arguments are specified, the timestamp will be reported using
2537 the national representation of the date and time, followed by the time
2538 zone.
2539 .Bl -tag -width 9n
2540 .It Fl f Ar format
2541 Specify the strftime format string, as documented in strftime(3), to be used
2542 to format the reported timestamp.
2543 .It Fl m
2544 Report the timestamp as milliseconds since the epoch.
2545 .It Fl U
2546 Report the timestamp using the national representation of the date and
2547 time, but override the system time zone and use UTC instead.
2548 .El
2549 .El
2550 .Bl -tag -width 6n
2551 .It Fl s
2552 Set the device's timestamp.
2553 Either the
2554 .Fl f
2555 and
2556 .Fl T
2557 options or the
2558 .Fl U
2559 option must be specified.
2560 .Bl -tag -width 9n
2561 .It Fl f Ar format
2562 Specify the strptime format string, as documented in strptime(3).
2563 The time must also be specified with the
2564 .Fl T
2565 option.
2566 .It Fl T Ar time
2567 Provide the time in the format specified with the
2568 .Fl f
2569 option.
2570 .It Fl U
2571 Set the timestamp to the host system's time in UTC.
2572 .El
2573 .El
2574 .It Ic devtype
2575 Print out the device type for specified device.
2576 .Bl -tag -width 10n
2577 .It ata
2578 An ATA device attached directly to an ATA controller
2579 .It satl
2580 An SATA device attached behind a SAS controller via SCSI-ATA Translation Layer (SATL)
2581 .It scsi
2582 A SCSI device
2583 .It nvme
2584 An directly attached NVMe device
2585 .It mmcsd
2586 An MMC or SD device attached via a mmcsd bus
2587 .It none
2588 No device type reported
2589 .It unknown
2590 Device type is unknown
2591 .It illegal
2592 A programming error occurred
2593 .El
2594 .It Ic depop
2595 Commands necessary to support the depopulation (depop) of defective elements of a device
2596 (typically heads for hard drives) or setting capacity point (typically used on
2597 flash drives).
2598 Issues either GET PHYSICAL ELEMENT STATUS, REMOVE ELEMENT AND TRUNCATE, or RESTORE
2599 ELEMENT AND REBUILD command to manage storage elements of a drive.
2600 Removal or restoration of elements may take up to a day to complete.
2601 One of the
2602 .Fl d ,
2603 .Fl l ,
2604 or
2605 .Fl r
2606 options must be specified.
2607 These options are mutually exclusive.
2608 Only SCSI drives are supported.
2609 Changing the storage elements of a storage drive may result in the loss of all
2610 data on that storage drive.
2611 The drive may need to reinitialize after
2612 .Fl d
2613 or
2614 .Fl r
2615 commands.
2616 The data on the drive is inaccessible until one of these commands complete.
2617 Once one of these commands start, the drive is format corrupt until the
2618 operation successfully completes.
2619 While format corrupt, no read or write I/O is possible to the drive.
2620 If the drive power cycles, it will remain format corrupt and the operation
2621 must be restarted.
2622 TEST UNIT READY or
2623 .Dq camcontrol tur
2624 can monitor an in-progress depop operation.
2625 .Bl -tag -width 6n
2626 .It Fl c Ar capacity
2627 Specify the desired capacity point for the drive.
2628 Valid only for the
2629 .Fl d
2630 flag.
2631 .It Fl d
2632 Remove the physical element from service or set the capacity point specified by the
2633 .Fl e
2634 or
2635 .Fl c
2636 flags.
2637 The drive's capacity may be reduced by this operation.
2638 .It Fl e Ar element
2639 Specify the physical element to remove from service.
2640 Valid only for the
2641 .Fl d
2642 flag.
2643 .It Fl l
2644 Report the current status of the physical elements of a drive.
2645 .It Fl r
2646 Restore all the eligible physical elements to service.
2647 .El
2648 .It Ic help
2649 Print out verbose usage information.
2650 .El
2651 .Sh ENVIRONMENT
2652 The
2653 .Ev SCSI_MODES
2654 variable allows the user to specify an alternate mode page format file.
2655 .Pp
2656 The
2657 .Ev EDITOR
2658 variable determines which text editor
2659 .Nm
2660 starts when editing mode pages.
2661 .Sh FILES
2662 .Bl -tag -width /usr/share/misc/scsi_modes -compact
2663 .It Pa /usr/share/misc/scsi_modes
2664 is the SCSI mode format database.
2665 .It Pa /dev/xpt0
2666 is the transport layer device.
2667 .It Pa /dev/pass*
2668 are the CAM application passthrough devices.
2669 .El
2670 .Sh EXAMPLES
2671 .Dl camcontrol eject -n cd -u 1 -v
2672 .Pp
2673 Eject the CD from cd1, and print SCSI sense information if the command
2674 fails.
2675 .Pp
2676 .Dl camcontrol tur da0
2677 .Pp
2678 Send the SCSI test unit ready command to da0.
2679 The
2680 .Nm
2681 utility will report whether the disk is ready, but will not display sense
2682 information if the command fails since the
2683 .Fl v
2684 switch was not specified.
2685 .Bd -literal -offset indent
2686 camcontrol tur da1 -E -C 4 -t 50 -Q head -v
2687 .Ed
2688 .Pp
2689 Send a test unit ready command to da1.
2690 Enable kernel error recovery.
2691 Specify a retry count of 4, and a timeout of 50 seconds.
2692 Enable sense
2693 printing (with the
2694 .Fl v
2695 flag) if the command fails.
2696 Since error recovery is turned on, the
2697 disk will be spun up if it is not currently spinning.
2698 The
2699 .Tn SCSI
2700 task attribute for the command will be set to Head of Queue.
2701 The
2702 .Nm
2703 utility will report whether the disk is ready.
2704 .Bd -literal -offset indent
2705 camcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \e
2706         -i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1"
2707 .Ed
2708 .Pp
2709 Issue a READ BUFFER command (0x3C) to cd1.
2710 Display the buffer size of cd1,
2711 and display the first 10 bytes from the cache on cd1.
2712 Display SCSI sense
2713 information if the command fails.
2714 .Bd -literal -offset indent
2715 camcontrol cmd -n cd -u 1 -v -c "3B 00 00 00 00 00 00 00 0e 00" \e
2716         -o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8
2717 .Ed
2718 .Pp
2719 Issue a WRITE BUFFER (0x3B) command to cd1.
2720 Write out 10 bytes of data,
2721 not including the (reserved) 4 byte header.
2722 Print out sense information if
2723 the command fails.
2724 Be very careful with this command, improper use may
2725 cause data corruption.
2726 .Bd -literal -offset indent
2727 camcontrol modepage da3 -m 1 -e -P 3
2728 .Ed
2729 .Pp
2730 Edit mode page 1 (the Read-Write Error Recover page) for da3, and save the
2731 settings on the drive.
2732 Mode page 1 contains a disk drive's auto read and
2733 write reallocation settings, among other things.
2734 .Pp
2735 .Dl camcontrol rescan all
2736 .Pp
2737 Rescan all SCSI buses in the system for devices that have been added,
2738 removed or changed.
2739 .Pp
2740 .Dl camcontrol rescan 0
2741 .Pp
2742 Rescan SCSI bus 0 for devices that have been added, removed or changed.
2743 .Pp
2744 .Dl camcontrol rescan 0:1:0
2745 .Pp
2746 Rescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or
2747 changed.
2748 .Pp
2749 .Dl camcontrol tags da5 -N 24
2750 .Pp
2751 Set the number of concurrent transactions for da5 to 24.
2752 .Bd -literal -offset indent
2753 camcontrol negotiate -n da -u 4 -T disable
2754 .Ed
2755 .Pp
2756 Disable tagged queueing for da4.
2757 .Bd -literal -offset indent
2758 camcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a
2759 .Ed
2760 .Pp
2761 Negotiate a sync rate of 20MHz and an offset of 15 with da3.
2762 Then send a
2763 Test Unit Ready command to make the settings take effect.
2764 .Bd -literal -offset indent
2765 camcontrol smpcmd ses0 -v -r 4 "40 0 00 0" -R 1020 "s9 i1"
2766 .Ed
2767 .Pp
2768 Send the SMP REPORT GENERAL command to ses0, and display the number of PHYs
2769 it contains.
2770 Display SMP errors if the command fails.
2771 .Bd -literal -offset indent
2772 camcontrol security ada0
2773 .Ed
2774 .Pp
2775 Report security support and settings for ada0
2776 .Bd -literal -offset indent
2777 camcontrol security ada0 -U user -s MyPass
2778 .Ed
2779 .Pp
2780 Enable security on device ada0 with the password MyPass
2781 .Bd -literal -offset indent
2782 camcontrol security ada0 -U user -e MyPass
2783 .Ed
2784 .Pp
2785 Secure erase ada0 which has had security enabled with user password MyPass
2786 .Pp
2787 .Em WARNING! WARNING! WARNING!
2788 .Pp
2789 This will
2790 .Em ERASE ALL
2791 data from the device, so backup your data before using!
2792 .Pp
2793 This command can be used against an SSD drive to restoring it to
2794 factory default write performance.
2795 .Bd -literal -offset indent
2796 camcontrol hpa ada0
2797 .Ed
2798 .Pp
2799 Report HPA support and settings for ada0 (also reported via
2800 identify).
2801 .Bd -literal -offset indent
2802 camcontrol hpa ada0 -s 10240
2803 .Ed
2804 .Pp
2805 Enables HPA on ada0 setting the maximum reported sectors to 10240.
2806 .Pp
2807 .Em WARNING! WARNING! WARNING!
2808 .Pp
2809 This will
2810 .Em PREVENT ACCESS
2811 to all data on the device beyond this limit until HPA is disabled by setting
2812 HPA to native max sectors of the device, which can only be done after a
2813 power-on or hardware reset!
2814 .Pp
2815 .Em DO NOT
2816 use this on a device which has an active filesystem!
2817 .Bd -literal -offset indent
2818 camcontrol persist da0 -v -i read_keys
2819 .Ed
2820 .Pp
2821 This will read any persistent reservation keys registered with da0, and
2822 display any errors encountered when sending the PERSISTENT RESERVE IN
2823 .Tn SCSI
2824 command.
2825 .Bd -literal -offset indent
2826 camcontrol persist da0 -v -o register -a -K 0x12345678
2827 .Ed
2828 .Pp
2829 This will register the persistent reservation key 0x12345678 with da0,
2830 apply that registration to all ports on da0, and display any errors that
2831 occur when sending the PERSISTENT RESERVE OUT command.
2832 .Bd -literal -offset indent
2833 camcontrol persist da0 -v -o reserve -s lun -k 0x12345678 -T ex_ac
2834 .Ed
2835 .Pp
2836 This will reserve da0 for the exlusive use of the initiator issuing the
2837 command.
2838 The scope of the reservation is the entire LUN.
2839 Any errors sending the PERSISTENT RESERVE OUT command will be displayed.
2840 .Bd -literal -offset indent
2841 camcontrol persist da0 -v -i read_full
2842 .Ed
2843 .Pp
2844 This will display the full status of all reservations on da0 and print out
2845 status if there are any errors.
2846 .Bd -literal -offset indent
2847 camcontrol persist da0 -v -o release -k 0x12345678 -T ex_ac
2848 .Ed
2849 .Pp
2850 This will release a reservation on da0 of the type ex_ac
2851 (Exclusive Access).
2852 The Reservation Key for this registration is 0x12345678.
2853 Any errors that occur will be displayed.
2854 .Bd -literal -offset indent
2855 camcontrol persist da0 -v -o register -K 0x12345678 -S \e
2856         -I sas,0x1234567812345678 -I sas,0x8765432187654321
2857 .Ed
2858 .Pp
2859 This will register the key 0x12345678 with da0, specifying that it applies
2860 to the SAS initiators with SAS addresses 0x1234567812345678 and
2861 0x8765432187654321.
2862 .Bd -literal -offset indent
2863 camcontrol persist da0 -v -o register_move -k 0x87654321 \e
2864         -K 0x12345678 -U -p -R 2 -I fcp,0x1234567812345678
2865 .Ed
2866 .Pp
2867 This will move the registration from the current initiator, whose
2868 Registration Key is 0x87654321, to the Fibre Channel initiator with the
2869 Fiber Channel World Wide Node Name 0x1234567812345678.
2870 A new registration key, 0x12345678, will be registered for the initiator
2871 with the Fibre Channel World Wide Node Name 0x1234567812345678, and the
2872 current initiator will be unregistered from the target.
2873 The reservation will be moved to relative target port 2 on the target
2874 device.
2875 The registration will persist across power losses.
2876 .Bd -literal -offset indent
2877 camcontrol attrib sa0 -v -i attr_values -p 1
2878 .Ed
2879 .Pp
2880 This will read and decode the attribute values from partition 1 on the tape
2881 in tape drive sa0, and will display any
2882 .Tn SCSI
2883 errors that result.
2884 .Bd -literal -offset indent
2885 camcontrol zone da0 -v -c rz -P summary
2886 .Ed
2887 .Pp
2888 This will request the SMR zone list from disk da0, and print out a
2889 summary of the zone parameters, and display any
2890 .Tn SCSI
2891 or
2892 .Tn ATA
2893 errors that result.
2894 .Bd -literal -offset indent
2895 camcontrol zone da0 -v -c rz -o reset
2896 .Ed
2897 .Pp
2898 This will request the list of SMR zones that should have their write
2899 pointer reset from the disk da0, and display any
2900 .Tn SCSI
2901 or
2902 .Tn ATA
2903 errors that result.
2904 .Bd -literal -offset indent
2905 camcontrol zone da0 -v -c rwp -l 0x2c80000
2906 .Ed
2907 .Pp
2908 This will issue the Reset Write Pointer command to disk da0 for the zone
2909 that starts at LBA 0x2c80000 and display any
2910 .Tn SCSI
2911 or
2912 .Tn ATA
2913 errors that result.
2914 .Bd -literal -offset indent
2915 camcontrol epc ada0 -c timer -T 60.1 -p Idle_a -e -s
2916 .Ed
2917 .Pp
2918 Set the timer for the Idle_a power condition on drive
2919 .Pa ada0
2920 to 60.1 seconds, enable that particular power condition, and save the timer
2921 value and the enabled state of the power condition.
2922 .Bd -literal -offset indent
2923 camcontrol epc da4 -c goto -p Standby_z -H
2924 .Ed
2925 .Pp
2926 Tell drive
2927 .Pa da4
2928 to go to the Standby_z power state (which is
2929 the drive's lowest power state) and hold in that state until it is
2930 explicitly released by another
2931 .Cm goto
2932 command.
2933 .Bd -literal -offset indent
2934 camcontrol epc da2 -c status -P
2935 .Ed
2936 .Pp
2937 Report only the power state of
2938 drive
2939 .Pa da2 .
2940 Some drives will power up in response to the commands sent by the
2941 .Pa status
2942 subcommand, and the
2943 .Fl P
2944 option causes
2945 .Nm
2946 to only send the
2947 .Tn ATA
2948 CHECK POWER MODE command, which should not trigger a change in the drive's
2949 power state.
2950 .Bd -literal -offset indent
2951 camcontrol epc ada0 -c list
2952 .Ed
2953 .Pp
2954 Display the ATA Power Conditions log (Log Address 0x08) for
2955 drive
2956 .Pa ada0 .
2957 .Bd -literal -offset indent
2958 camcontrol timestamp sa0 -s -f "%a, %d %b %Y %T %z" \e
2959         -T "Wed, 26 Oct 2016 21:43:57 -0600"
2960 .Ed
2961 .Pp
2962 Set the timestamp of drive
2963 .Pa sa0
2964 using a
2965 .Xr strptime 3
2966 format string followed by a time string
2967 that was created using this format string.
2968 .Sh SEE ALSO
2969 .Xr cam 3 ,
2970 .Xr cam_cdbparse 3 ,
2971 .Xr cam 4 ,
2972 .Xr pass 4 ,
2973 .Xr xpt 4 ,
2974 .Xr trim 8 ,
2975 .Xr zonectl 8
2976 .Sh HISTORY
2977 The
2978 .Nm
2979 utility first appeared in
2980 .Fx 3.0 .
2981 .Pp
2982 The mode page editing code and arbitrary SCSI command code are based upon
2983 code in the old
2984 .Xr scsi 8
2985 utility and
2986 .Xr scsi 3
2987 library, written by Julian Elischer and Peter Dufault.
2988 The
2989 .Xr scsi 8
2990 program first appeared in
2991 .Bx 386 0.1.2.4 ,
2992 and first appeared in
2993 .Fx
2994 in
2995 .Fx 2.0.5 .
2996 .Sh AUTHORS
2997 .An Kenneth Merry Aq Mt ken@FreeBSD.org
2998 .Sh BUGS
2999 The code that parses the generic command line arguments does not know that
3000 some of the subcommands take multiple arguments.
3001 So if, for instance, you
3002 tried something like this:
3003 .Bd -literal -offset indent
3004 camcontrol cmd -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v
3005 .Ed
3006 .Pp
3007 The sense information from the test unit ready command would not get
3008 printed out, since the first
3009 .Xr getopt 3
3010 call in
3011 .Nm
3012 bails out when it sees the second argument to
3013 .Fl c
3014 (0x00),
3015 above.
3016 Fixing this behavior would take some gross code, or changes to the
3017 .Xr getopt 3
3018 interface.
3019 The best way to circumvent this problem is to always make sure
3020 to specify generic
3021 .Nm
3022 arguments before any command-specific arguments.