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