2 .\" Copyright (c) 1998, 1999, 2000, 2002, 2005, 2006, 2007 Kenneth D. Merry.
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
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.
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
35 .Nd CAM control program
50 .Op Fl u Ar unit_number
73 .Op Fl r Ar reporttype
102 .Aq all | bus Ns Op :target:lun
105 .Aq all | bus Ns Op :target:lun
121 .Aq Fl m Ar page | Fl l
129 .Aq Fl a Ar cmd Op args
130 .Aq Fl c Ar cmd Op args
133 .Op Fl i Ar len Ar fmt
135 .Op Fl o Ar len Ar fmt Op args
142 .Aq Fl r Ar len Ar fmt Op args
143 .Aq Fl R Ar len Ar fmt Op args
155 .Op Fl o Ar operation
159 .Op Fl T Ar pp_timeout
160 .Op Fl a Ar enable|disable
161 .Op Fl A Ar enable|disable
162 .Op Fl s Ar enable|disable
163 .Op Fl S Ar enable|disable
184 .Aq all|off|bus Ns Op :target Ns Op :lun
197 .Op Fl D Ar enable|disable
202 .Op Fl T Ar enable|disable
204 .Op Fl W Ar bus_width
218 .Aq Fl a Ar overwrite | block | crypto | exitfailure
257 .Op Fl l Ar high|maximum
261 .Op Fl U Ar user|master
272 .Op Fl s Ar max_sectors
279 .Aq Fl i Ar action | Fl o Ar action
285 .Op Fl R Ar rel_tgt_port
295 utility is designed to provide a way for users to access and control the
302 can cause a loss of data and/or system crashes if used improperly.
304 expert users are encouraged to exercise caution when using this command.
305 Novice users should stay away from this utility.
309 utility has a number of primary functions, many of which support an optional
311 A device identifier can take one of three forms:
314 Specify a device name and unit number combination, like "da5" or "cd3".
316 Specify a bus number and target id.
317 The bus number can be determined from
319 .Dq camcontrol devlist .
320 The lun defaults to 0.
322 Specify the bus, target and lun for a device.
326 The device identifier, if it is specified,
328 come immediately after the function name, and before any generic or
329 function-specific arguments.
334 arguments described below will override any device name or unit number
335 specified beforehand.
342 override a specified bus:target or bus:target:lun, however.
346 primary functions support these generic arguments:
349 SCSI command retry count.
350 In order for this to work, error recovery
354 Instruct the kernel to perform generic SCSI error recovery for the given
356 This is needed in order for the retry count
359 Other than retrying commands, the generic error recovery in
360 the code will generally attempt to spin up drives that are not spinning.
361 It may take some other actions, depending upon the sense code returned from
364 Specify the device type to operate on, e.g.\& "da", "cd".
366 SCSI command timeout in seconds.
367 This overrides the default timeout for
369 .It Fl u Ar unit_number
370 Specify the device unit number, e.g.\& "1", "5".
372 Be verbose, print out sense information for failed SCSI commands.
375 Primary command functions:
376 .Bl -tag -width periphlist
378 List all physical devices (logical units) attached to the CAM subsystem.
379 This also includes a list of peripheral drivers attached to each device.
382 argument, SCSI bus number, adapter name and unit numbers are printed as
384 On the other hand, with the
386 argument, only the bus adapter, and unit information will be printed, and
387 device information will be omitted.
389 List all peripheral drivers attached to a given physical device (logical
392 Send the SCSI test unit ready (0x00) command to the given device.
395 utility will report whether the device is ready or not.
397 Send a SCSI inquiry command (0x12) to a device.
400 will print out the standard inquiry data, device serial number, and
401 transfer rate information.
402 The user can specify that only certain types of
403 inquiry data be printed:
406 Get the standard inquiry data.
408 Print out the serial number.
409 If this flag is the only one specified,
411 will not print out "Serial Number" before the value returned by the drive.
412 This is to aid in script writing.
414 Print out transfer rate information.
417 Send a ATA identify command (0xec) to a device.
419 Send the SCSI REPORT LUNS (0xA0) command to the given device.
422 will print out the list of logical units (LUNs) supported by the target device.
423 There are a couple of options to modify the output:
426 Just print out a count of LUNs, not the actual LUN numbers.
428 Just print out the LUNs, and do not print out the count.
429 .It Fl r Ar reporttype
430 Specify the type of report to request from the target:
431 .Bl -tag -width 012345678
433 Return the default report.
437 Most targets will support this report if they support the REPORT LUNS
440 Return only well known LUNs.
442 Return all available LUNs.
447 will try to print out LUN numbers in a reasonable format.
448 It can understand the peripheral, flat, LUN and extended LUN formats.
450 Send the SCSI READ CAPACITY command to the given device and display
452 If the device is larger than 2TB, the SCSI READ CAPACITY (16) service
453 action will be sent to obtain the full size of the device.
456 will print out the last logical block of the device, and the blocksize of
458 To modify the output format, use the following options:
461 Just print out the blocksize, not the last block or device size.
462 This cannot be used with
467 Print out the device size in human readable (base 2, 1K == 1024) format.
470 and cannot be used with
475 Print out the device size in human readable (base 10, 1K == 1000) format.
477 Print out the number of blocks in the device instead of the last logical
480 Quiet, print out the numbers only (separated by a comma if
486 Print out the last logical block or the size of the device only, and omit
490 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
493 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
496 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
497 start bit set and the load/eject bit set.
499 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
500 start bit cleared and the load/eject bit set.
502 Tell the kernel to scan all busses in the system (with the
504 argument), the given bus (XPT_SCAN_BUS), or bus:target:lun
505 (XPT_SCAN_LUN) for new devices or devices that have gone away.
507 may specify a scan of all busses, a single bus, or a lun.
509 on a target is not supported.
511 Tell the kernel to reset all busses in the system (with the
513 argument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus
514 reset for that bus, or to reset the given bus:target:lun
515 (XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after
516 connecting to that device.
517 Note that this can have a destructive impact
522 READ DEFECT DATA (10) command (0x37) or the
524 READ DEFECT DATA (12) command (0xB7) to the given device, and
525 print out any combination of: the total number of defects, the primary
526 defect list (PLIST), and the grown defect list (GLIST).
529 Specify the requested format of the defect list.
530 The format argument is
532 Most drives support the physical sector format.
534 support the logical block format.
535 Many drives, if they do not support the
536 requested format, return the data in an alternate format, along with sense
537 information indicating that the requested data format is not supported.
541 attempts to detect this, and print out whatever format the drive returns.
542 If the drive uses a non-standard sense code to report that it does not
543 support the requested format,
545 will probably see the error as a failure to complete the request.
547 The format options are:
550 Print out the list as logical blocks.
551 This is limited to 32-bit block sizes, and isn't supported by many modern
554 Print out the list as logical blocks.
555 This option uses a 64-bit block size.
557 Print out the list in bytes from index format.
559 Print out the list in extended bytes from index format.
560 The extended format allows for ranges of blocks to be printed.
562 Print out the list in physical sector format.
563 Most drives support this format.
565 Print out the list in extended physical sector format.
566 The extended format allows for ranges of blocks to be printed.
570 Print out the grown defect list.
571 This is a list of bad blocks that have
572 been remapped since the disk left the factory.
574 Print out the primary defect list.
575 This is the list of defects that were present in the factory.
577 When printing status information with
579 only print the number of defects.
581 Just print the number of defects, not the list of defects.
583 Specify the starting offset into the defect list.
584 This implies using the
586 READ DEFECT DATA (12) command, as the 10 byte version of the command
587 doesn't support the address descriptor index field.
588 Not all drives support the 12 byte command, and some drives that support
589 the 12 byte command don't support the address descriptor index field.
591 Print out defects in hexadecimal (base 16) form instead of base 10 form.
600 will print out the number of defects given in the READ DEFECT DATA header
601 returned from the drive.
602 Some drives will report 0 defects if neither the primary or grown defect
605 Allows the user to display and optionally edit a SCSI mode page.
607 page formats are located in
608 .Pa /usr/share/misc/scsi_modes .
609 This can be overridden by specifying a different file in the
611 environment variable.
614 command takes several arguments:
617 Disable block descriptors for mode sense.
619 Displays mode page data in binary format.
621 This flag allows the user to edit values in the mode page.
623 either edit mode page values with the text editor pointed to by his
625 environment variable, or supply mode page values via standard input, using
628 uses to display mode page values.
629 The editor will be invoked if
631 detects that standard input is terminal.
633 Lists all available mode pages.
634 .It Fl m Ar mode_page
635 This specifies the number of the mode page the user would like to view
637 This argument is mandatory unless
641 This allows the user to specify the page control field.
643 .Bl -tag -width xxx -compact
655 Allows the user to send an arbitrary ATA or SCSI CDB to any device.
658 function requires the
660 argument to specify SCSI CDB or the
662 argument to specify ATA Command Block registers values.
663 Other arguments are optional, depending on
665 The command and data specification syntax is documented
668 NOTE: If the CDB specified causes data to be transferred to or from the
669 SCSI device in question, you MUST specify either
674 .It Fl a Ar cmd Op args
675 This specifies the content of 12 ATA Command Block registers (command,
676 features, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp.
677 lba_high_exp, features_exp, sector_count, sector_count_exp).
678 .It Fl c Ar cmd Op args
679 This specifies the SCSI CDB.
680 SCSI CDBs may be 6, 10, 12 or 16 bytes.
682 Specifies DMA protocol to be used for ATA command.
684 Specifies FPDMA (NCQ) protocol to be used for ATA command.
685 .It Fl i Ar len Ar fmt
686 This specifies the amount of data to read, and how it should be displayed.
690 bytes of data will be read from the device and written to standard output.
691 .It Fl o Ar len Ar fmt Op args
692 This specifies the amount of data to be written to a device, and the data
693 that is to be written.
697 bytes of data will be read from standard input and written to the device.
699 This specifies that 11 result ATA Command Block registers should be displayed
700 (status, error, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp,
701 lba_high_exp, sector_count, sector_count_exp), and how.
704 11 result registers will be written to standard output in hex.
707 Allows the user to send an arbitrary Serial
708 Management Protocol (SMP) command to a device.
711 function requires the
713 argument to specify the SMP request to be sent, and the
715 argument to specify the format of the SMP response.
716 The syntax for the SMP request and response arguments is documented in
719 Note that SAS adapters that support SMP passthrough (at least the currently
720 known adapters) do not accept CRC bytes from the user in the request and do
721 not pass CRC bytes back to the user in the response.
722 Therefore users should not include the CRC bytes in the length of the
723 request and not expect CRC bytes to be returned in the response.
725 .It Fl r Ar len Ar fmt Op args
726 This specifies the size of the SMP request, without the CRC bytes, and the
731 bytes of data will be read from standard input and written as the SMP
733 .It Fl R Ar len Ar fmt Op args
734 This specifies the size of the buffer allocated for the SMP response, and
735 the SMP response format.
739 bytes of data will be allocated for the response and the response will be
740 written to standard output.
743 Allows the user to send the Serial Management Protocol (SMP) Report General
746 will display the data returned by the Report General command.
747 If the SMP target supports the long response format, the additional data
748 will be requested and displayed automatically.
751 Request the long response format only.
752 Not all SMP targets support the long response format.
755 to skip sending the initial report general request without the long bit set
756 and only issue a report general request with the long bit set.
759 Allows the user to issue the Serial Management Protocol (SMP) PHY Control
761 This function should be used with some caution, as it can render devices
762 inaccessible, and could potentially cause data corruption as well.
765 argument is required to specify the PHY to operate on.
768 Specify the PHY to operate on.
769 This argument is required.
771 Request the long request/response format.
772 Not all SMP targets support the long response format.
773 For the PHY Control command, this currently only affects whether the
774 request length is set to a value other than 0.
775 .It Fl o Ar operation
776 Specify a PHY control operation.
779 operation may be specified.
780 The operation may be specified numerically (in decimal, hexadecimal, or octal)
781 or one of the following operation names may be specified:
785 It is not necessary to specify this argument.
787 Send the LINK RESET command to the phy.
789 Send the HARD RESET command to the phy.
791 Send the DISABLE command to the phy.
792 Note that the LINK RESET or HARD RESET commands should re-enable the phy.
794 Send the CLEAR ERROR LOG command.
795 This clears the error log counters for the specified phy.
797 Send the CLEAR AFFILIATION command.
798 This clears the affiliation from the STP initiator port with the same SAS
799 address as the SMP initiator that requests the clear operation.
801 Send the TRANSMIT SATA PORT SELECTION SIGNAL command to the phy.
802 This will cause a SATA port selector to use the given phy as its active phy
803 and make the other phy inactive.
805 Send the CLEAR STP I_T NEXUS LOSS command to the PHY.
807 Send the SET ATTACHED DEVICE NAME command to the PHY.
810 argument to specify the device name.
813 Specify the attached device name.
814 This option is needed with the
817 The name is a 64-bit number, and can be specified in decimal, hexadecimal
820 Set the minimum physical link rate for the phy.
821 This is a numeric argument.
822 Currently known link rates are:
825 Do not change current value.
834 Other values may be specified for newer physical link rates.
836 Set the maximum physical link rate for the phy.
837 This is a numeric argument.
840 argument description for known link rate arguments.
841 .It Fl T Ar pp_timeout
842 Set the partial pathway timeout value, in microseconds.
847 specification for more information on this field.
848 .It Fl a Ar enable|disable
849 Enable or disable SATA slumber phy power conditions.
850 .It Fl A Ar enable|disable
851 Enable or disable SATA partial power conditions.
852 .It Fl s Ar enable|disable
853 Enable or disable SAS slumber phy power conditions.
854 .It Fl S Ar enable|disable
855 Enable or disable SAS partial phy power conditions.
858 List phys attached to a SAS expander, the address of the end device
859 attached to the phy, and the inquiry data for that device and peripheral
860 devices attached to that device.
861 The inquiry data and peripheral devices are displayed if available.
864 Turn on the long response format for the underlying SMP commands used for
867 Only print out phys that are attached to a device in the CAM EDT (Existing
871 Send the SMP Report Manufacturer Information command to the device and
872 display the response.
875 Turn on the long response format for the underlying SMP commands used for
879 Turn on CAM debugging printfs in the kernel.
880 This requires options CAMDEBUG
881 in your kernel config file.
882 WARNING: enabling debugging printfs currently
883 causes an EXTREME number of kernel printfs.
884 You may have difficulty
885 turning off the debugging printfs once they start, since the kernel will be
886 busy printing messages and unable to service other requests quickly.
889 function takes a number of arguments:
892 Enable CAM_DEBUG_INFO printfs.
894 Enable CAM_DEBUG_PERIPH printfs.
896 Enable CAM_DEBUG_TRACE printfs.
898 Enable CAM_DEBUG_SUBTRACE printfs.
900 Enable CAM_DEBUG_XPT printfs.
902 Enable CAM_DEBUG_CDB printfs.
903 This will cause the kernel to print out the
904 SCSI CDBs sent to the specified device(s).
906 Enable CAM_DEBUG_PROBE printfs.
908 Enable debugging for all devices.
910 Turn off debugging for all devices
911 .It bus Ns Op :target Ns Op :lun
912 Turn on debugging for the given bus, target or lun.
914 and lun are not specified, they are wildcarded.
915 (i.e., just specifying a
916 bus turns on debugging printfs for all devices on that bus.)
919 Show or set the number of "tagged openings" or simultaneous transactions
920 we attempt to queue to a particular device.
923 command, with no command-specific arguments (i.e., only generic arguments)
924 prints out the "soft" maximum number of transactions that can be queued to
925 the device in question.
926 For more detailed information, use the
928 argument described below.
931 Set the number of tags for the given device.
932 This must be between the
933 minimum and maximum number set in the kernel quirk table.
935 most devices that support tagged queueing is a minimum of 2 and a maximum
937 The minimum and maximum values for a given device may be
938 determined by using the
945 subcommand is described below.
947 Be quiet, and do not report the number of tags.
948 This is generally used when
949 setting the number of tags.
951 The verbose flag has special functionality for the
956 to print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB:
959 This is the amount of capacity for transactions queued to a given device.
961 This is the number of transactions currently queued to a device.
963 This is the kernel queue space for transactions.
964 This count usually mirrors
965 dev_openings except during error recovery operations when
966 the device queue is frozen (device is not allowed to receive
967 commands), the number of dev_openings is reduced, or transaction
970 This is the number of transactions waiting in the kernel queue for capacity
972 This number is usually zero unless error recovery is in
975 The held count is the number of CCBs held by peripheral drivers that have
976 either just been completed or are about to be released to the transport
977 layer for service by a device.
978 Held CCBs reserve capacity on a given
981 This is the current "hard" minimum number of transactions that can be
982 queued to a device at once.
985 value above cannot go below this number.
986 The default value for
988 is 2, although it may be set higher or lower for various devices.
990 This is the "hard" maximum number of transactions that can be queued to a
994 value cannot go above this number.
995 The default value for
997 is 255, although it may be set higher or lower for various devices.
1001 Show or negotiate various communication parameters.
1002 Some controllers may
1003 not support setting or changing some of these values.
1005 Adaptec 174x controllers do not support changing a device's sync rate or
1010 will not attempt to set the parameter if the controller indicates that it
1011 does not support setting the parameter.
1012 To find out what the controller
1020 command is described below.
1021 Also, some controller drivers do not support
1022 setting negotiation parameters, even if the underlying controller supports
1023 negotiation changes.
1024 Some controllers, such as the Advansys wide
1025 controllers, support enabling and disabling synchronous negotiation for
1026 a device, but do not support setting the synchronous negotiation rate.
1029 Attempt to make the negotiation settings take effect immediately by sending
1030 a Test Unit Ready command to the device.
1032 Show or set current negotiation settings.
1033 This is the default.
1034 .It Fl D Ar enable|disable
1035 Enable or disable disconnection.
1039 Set the command delay offset.
1041 Be quiet, do not print anything.
1042 This is generally useful when you want to
1043 set a parameter, but do not want any status information.
1044 .It Fl R Ar syncrate
1045 Change the synchronization rate for a device.
1046 The sync rate is a floating
1047 point value specified in MHz.
1050 is a legal value, as is
1052 .It Fl T Ar enable|disable
1053 Enable or disable tagged queueing for a device.
1055 Show or set user negotiation settings.
1056 The default is to show or set
1057 current negotiation settings.
1059 The verbose switch has special meaning for the
1064 to print out the contents of a Path Inquiry (XPT_PATH_INQ) CCB sent to the
1066 .It Fl W Ar bus_width
1067 Specify the bus width to negotiate with a device.
1070 The only useful values to specify are 8, 16, and 32
1072 The controller must support the bus width in question in order for
1073 the setting to take effect.
1076 In general, sync rate and offset settings will not take effect for a
1077 device until a command has been sent to the device.
1080 switch above will automatically send a Test Unit Ready to the device so
1081 negotiation parameters will take effect.
1085 FORMAT UNIT command to the named device.
1087 .Em WARNING! WARNING! WARNING!
1089 Low level formatting a disk will destroy ALL data on the disk.
1091 extreme caution when issuing this command.
1092 Many users low-level format
1093 disks that do not really need to be low-level formatted.
1095 relatively few scenarios that call for low-level formatting a disk.
1097 low-level formatting a disk is to initialize the disk after changing
1098 its physical sector size.
1099 Another reason for low-level formatting a disk
1100 is to revive the disk if you are getting "medium format corrupted" errors
1101 from the disk in response to read and write requests.
1103 Some disks take longer than others to format.
1104 Users should specify a
1105 timeout long enough to allow the format to complete.
1107 timeout is 3 hours, which should be long enough for most disks.
1109 disks will complete a format operation in a very short period of time
1110 (on the order of 5 minutes or less).
1111 This is often because the drive
1112 does not really support the FORMAT UNIT command -- it just accepts the
1113 command, waits a few minutes and then returns it.
1117 subcommand takes several arguments that modify its default behavior.
1122 arguments can be useful for scripts.
1125 Be quiet, do not print any status messages.
1126 This option will not disable
1127 the questions, however.
1128 To disable questions, use the
1135 This will report status on a format that is already running on the drive.
1137 Issue a non-immediate format command.
1140 issues the FORMAT UNIT command with the immediate bit set.
1142 device to immediately return the format command, before the format has
1148 sense information from the device every second to determine how far along
1149 in the format process it is.
1152 argument is specified,
1154 will issue a non-immediate format command, and will be unable to print any
1155 information to let the user know what percentage of the disk has been
1158 Do not ask any questions.
1161 will ask the user if he/she really wants to format the disk in question,
1162 and also if the default format command timeout is acceptable.
1164 will not be asked about the timeout if a timeout is specified on the
1170 SANITIZE command to the named device.
1172 .Em WARNING! WARNING! WARNING!
1174 ALL data in the cache and on the disk will be destroyed or made inaccessible.
1175 Recovery of the data is not possible.
1176 Use extreme caution when issuing this command.
1180 subcommand takes several arguments that modify its default behavior.
1185 arguments can be useful for scripts.
1187 .It Fl a Ar operation
1188 Specify the sanitize operation to perform.
1191 Perform an overwrite operation by writing a user supplied
1192 data pattern to the device one or more times.
1193 The pattern is given by the
1196 The number of times is given by the
1200 Perform a block erase operation.
1201 All the device's blocks are set to a vendor defined
1202 value, typically zero.
1204 Perform a cryptographic erase operation.
1205 The encryption keys are changed to prevent the decryption
1208 Exits a previously failed sanitize operation.
1209 A failed sanitize operation can only be exited if it was
1210 run in the unrestricted completion mode, as provided by the
1215 The number of passes when performing an
1218 Valid values are between 1 and 31.
1223 operation, the pattern is inverted between consecutive passes.
1225 Path to the file containing the pattern to use when
1229 The pattern is repeated as needed to fill each block.
1231 Be quiet, do not print any status messages.
1232 This option will not disable
1233 the questions, however.
1234 To disable questions, use the
1238 Perform the sanitize in the unrestricted completion mode.
1239 If the operation fails, it can later be exited with the
1246 This will report status on a sanitize that is already running on the drive.
1248 Issue a non-immediate sanitize command.
1251 issues the SANITIZE command with the immediate bit set.
1253 device to immediately return the sanitize command, before
1254 the sanitize has actually completed.
1259 sense information from the device every second to determine how far along
1260 in the sanitize process it is.
1263 argument is specified,
1265 will issue a non-immediate sanitize command, and will be unable to print any
1266 information to let the user know what percentage of the disk has been
1269 Do not ask any questions.
1272 will ask the user if he/she really wants to sanitize the disk in question,
1273 and also if the default sanitize command timeout is acceptable.
1275 will not be asked about the timeout if a timeout is specified on the
1279 Put ATA device into IDLE state.
1282 specifies automatic standby timer value in seconds.
1283 Value 0 disables timer.
1285 Put ATA device into STANDBY state.
1288 specifies automatic standby timer value in seconds.
1289 Value 0 disables timer.
1291 Put ATA device into SLEEP state.
1292 Note that the only way get device out of
1293 this state may be reset.
1295 Update or report security settings, using an ATA identify command (0xec).
1298 will print out the security support and associated settings of the device.
1301 command takes several arguments:
1305 Disable device security using the given password for the selected user according
1306 to the devices configured security level.
1309 Erase the device using the given password for the selected user.
1311 .Em WARNING! WARNING! WARNING!
1313 Issuing a secure erase will
1315 user data on the device and may take several hours to complete.
1317 When this command is used against an SSD drive all its cells will be marked as
1318 empty, restoring it to factory default write performance.
1319 For SSD's this action
1320 usually takes just a few seconds.
1323 Freeze the security configuration of the specified device.
1325 After command completion any other commands that update the device lock mode
1326 shall be command aborted.
1327 Frozen mode is disabled by power-off or hardware reset.
1330 Enhanced erase the device using the given password for the selected user.
1332 .Em WARNING! WARNING! WARNING!
1334 Issuing an enhanced secure erase will
1336 user data on the device and may take several hours to complete.
1338 An enhanced erase writes predetermined data patterns to all user data areas,
1339 all previously written user data shall be overwritten, including sectors that
1340 are no longer in use due to reallocation.
1343 Unlock the device using the given password for the selected user according to
1344 the devices configured security level.
1345 .It Fl l Ar high|maximum
1347 Specifies which security level to set when issuing a
1350 The security level determines device behavior when the master
1351 password is used to unlock the device.
1352 When the security level is set to high
1353 the device requires the unlock command and the master password to unlock.
1354 When the security level is set to maximum the device requires a secure erase
1355 with the master password to unlock.
1357 This option must be used in conjunction with one of the security action commands.
1363 Be quiet, do not print any status messages.
1364 This option will not disable the questions, however.
1365 To disable questions, use the
1370 Password the device (enable security) using the given password for the selected
1372 This option can be combined with other options such as
1375 A master password may be set in a addition to the user password. The purpose of
1376 the master password is to allow an administrator to establish a password that
1377 is kept secret from the user, and which may be used to unlock the device if the
1378 user password is lost.
1381 Setting the master password does not enable device security.
1383 If the master password is set and the drive supports a Master Revision Code
1384 feature the Master Password Revision Code will be decremented.
1387 Overrides the default timeout, specified in seconds, used for both
1391 this is useful if your system has problems processing long timeouts correctly.
1393 Usually the timeout is calculated from the information stored on the drive if
1394 present, otherwise it defaults to 2 hours.
1395 .It Fl U Ar user|master
1397 Specifies which user to set / use for the running action command, valid values
1398 are user or master and defaults to master if not set.
1400 This option must be used in conjunction with one of the security action commands.
1406 Confirm yes to dangerous options such as
1408 without prompting for confirmation.
1411 If the password specified for any action commands does not match the configured
1412 password for the specified user the command will fail.
1414 The password in all cases is limited to 32 characters, longer passwords will
1417 Update or report Host Protected Area details.
1420 will print out the HPA support and associated settings of the device.
1423 command takes several optional arguments:
1427 Freeze the HPA configuration of the specified device.
1429 After command completion any other commands that update the HPA configuration
1430 shall be command aborted.
1431 Frozen mode is disabled by power-off or hardware reset.
1434 Lock the HPA configuration of the device until a successful call to unlock or
1435 the next power-on reset occurs.
1438 Make the HPA max sectors persist across power-on reset or a hardware reset.
1439 This must be used in combination with
1440 .Fl s Ar max_sectors
1444 Set the HPA configuration password required for unlock calls.
1447 Be quiet, do not print any status messages.
1448 This option will not disable the questions.
1449 To disable questions, use the
1452 .It Fl s Ar max_sectors
1454 Configures the maximum user accessible sectors of the device.
1455 This will change the number of sectors the device reports.
1457 .Em WARNING! WARNING! WARNING!
1459 Changing the max sectors of a device using this option will make the data on
1460 the device beyond the specified value inaccessible.
1463 .Fl s Ar max_sectors
1464 call can be made without a power-on reset or a hardware reset of the device.
1467 Unlock the HPA configuration of the specified device using the given password.
1468 If the password specified does not match the password configured via
1470 the command will fail.
1472 After 5 failed unlock calls, due to password miss-match, the device will refuse
1473 additional unlock calls until after a power-on reset.
1476 Confirm yes to dangerous options such as
1478 without prompting for confirmation
1481 The password for all HPA commands is limited to 32 characters, longer passwords
1484 Program firmware of the named SCSI device using the image file provided.
1486 Current list of supported vendors:
1487 .Bl -bullet -offset indent -compact
1504 .Em WARNING! WARNING! WARNING!
1506 Little testing has been done to make sure that different device models from
1507 each vendor work correctly with the fwdownload command.
1508 A vendor name appearing in the supported list means only that firmware of at
1509 least one device type from that vendor has successfully been programmed with
1510 the fwdownload command.
1511 Extra caution should be taken when using this command since there is no
1512 guarantee it will not break a device from the listed vendors.
1513 Ensure that you have a recent backup of the data on the device before
1514 performing a firmware update.
1516 .It Fl f Ar fw_image
1517 Path to the firmware image file to be downloaded to the specified device.
1519 Do not ask for confirmation.
1521 Run in simulation mode.
1522 Packet sizes that will be sent are shown, but no actual packet is sent to the
1524 No confirmation is asked in simulation mode.
1526 Besides showing sense information in case of a failure, the verbose option
1529 to output a line for every firmware segment that is sent to the device by the
1531 -- the same as the ones shown in simulation mode.
1534 Persistent reservation support.
1535 Persistent reservations are a way to reserve a particular
1537 LUN for use by one or more
1542 option is specified,
1546 PERSISTENT RESERVE IN
1547 command using the requested service action.
1550 option is specified,
1554 PERSISTENT RESERVE OUT
1555 command using the requested service action.
1556 One of those two options is required.
1558 Persistent reservations are complex, and fully explaining them is outside
1559 the scope of this manual.
1562 and download the latest SPC spec for a full explanation of persistent
1566 Specify the service action for the PERSISTENT RESERVE IN command.
1567 Supported service actions:
1570 Report the current persistent reservation generation (PRgeneration) and any
1572 .It read_reservation
1573 Report the persistent reservation, if any.
1574 .It report_capabilities
1575 Report the persistent reservation capabilities of the LUN.
1576 .It read_full_status
1577 Report the full status of persistent reservations on the LUN.
1580 Specify the service action for the PERSISTENT RESERVE OUT command.
1581 For service actions like register that are components of other service
1582 action names, the entire name must be specified.
1583 Otherwise, enough of the service action name must be specified to
1584 distinguish it from other possible service actions.
1585 Supported service actions:
1588 Register a reservation key with the LUN or unregister a reservation key.
1589 To register a key, specify the requested key as the Service Action
1591 To unregister a key, specify the previously registered key as the
1593 To change a key, specify the old key as the Reservation Key and the new
1594 key as the Service Action Reservation Key.
1596 This is similar to the register subcommand, except that the Reservation Key
1598 The Service Action Reservation Key will overwrite any previous key
1599 registered for the initiator.
1601 Create a reservation.
1602 A key must be registered with the LUN before the LUN can be reserved, and
1603 it must be specified as the Reservation Key.
1604 The type of reservation must also be specified.
1605 The scope defaults to LUN scope (LU_SCOPE), but may be changed.
1607 Release a reservation.
1608 The Reservation Key must be specified.
1610 Release a reservation and remove all keys from the device.
1611 The Reservation Key must be specified.
1613 Remove a reservation belonging to another initiator.
1614 The Reservation Key must be specified.
1615 The Service Action Reservation Key may be specified, depending on the
1616 operation being performed.
1618 Remove a reservation belonging to another initiator and abort all
1619 outstanding commands from that initiator.
1620 The Reservation Key must be specified.
1621 The Service Action Reservation Key may be specified, depending on the
1622 operation being performed.
1624 Register another initiator with the LUN, and establish a reservation on the
1625 LUN for that initiator.
1626 The Reservation Key and Service Action Reservation Key must be specified.
1628 Replace Lost Reservation information.
1631 Set the All Target Ports (ALL_TG_PT) bit.
1632 This requests that the key registration be applied to all target ports and
1633 not just the particular target port that receives the command.
1634 This only applies to the register and register_ignore actions.
1636 Specify a Transport ID.
1637 This only applies to the Register and Register and Move service actions for
1638 Persistent Reserve Out.
1639 Multiple Transport IDs may be specified with multiple
1642 With the Register service action, specifying one or more Transport IDs
1643 implicitly enables the
1645 option which turns on the SPEC_I_PT bit.
1646 Transport IDs generally have the format protocol,id.
1649 A SAS Transport ID consists of
1651 followed by a 64-bit SAS address.
1654 .Dl sas,0x1234567812345678
1656 A Fibre Channel Transport ID consists of
1658 followed by a 64-bit Fibre Channel World Wide Name.
1661 .Dl fcp,0x1234567812345678
1663 A Parallel SCSI address consists of
1665 followed by a SCSI target ID and a relative target port identifier.
1670 An IEEE 1394 (Firewire) Transport ID consists of
1672 followed by a 64-bit EUI-64 IEEE 1394 node unique identifier.
1675 .Dl sbp,0x1234567812345678
1677 A SCSI over RDMA Transport ID consists of
1679 followed by a 128-bit RDMA initiator port identifier.
1680 The port identifier must be exactly 32 or 34 (if the leading 0x is
1681 included) hexadecimal digits.
1682 Only hexadecimal (base 16) numbers are supported.
1685 .Dl srp,0x12345678123456781234567812345678
1687 An iSCSI Transport ID consists an iSCSI name and optionally a separator and
1689 For example, if only the iSCSI name is specified:
1691 .Dl iqn.2012-06.com.example:target0
1693 If the iSCSI separator and initiator session ID are specified:
1695 .Dl iqn.2012-06.com.example:target0,i,0x123
1697 A SCSI over PCIe Transport ID consists of
1699 followed by a PCIe Routing ID.
1700 The Routing ID consists of a bus, device and function or in the alternate
1701 form, a bus and function.
1702 The bus must be in the range of 0 to 255 inclusive and the device must be
1703 in the range of 0 to 31 inclusive.
1704 The function must be in the range of 0 to 7 inclusive if the standard form
1705 is used, and in the range of 0 to 255 inclusive if the alternate form is
1707 For example, if a bus, device and function are specified for the standard
1712 If the alternate Routing ID form is used:
1717 Specify the Reservation Key.
1718 This may be in decimal, octal or hexadecimal format.
1719 The value is zero by default if not otherwise specified.
1720 The value must be between 0 and 2^64 - 1, inclusive.
1722 Specify the Service Action Reservation Key.
1723 This may be in decimal, octal or hexadecimal format.
1724 The value is zero by default if not otherwise specified.
1725 The value must be between 0 and 2^64 - 1, inclusive.
1727 Enable the Activate Persist Through Power Loss bit.
1728 This is only used for the register and register_ignore actions.
1729 This requests that the reservation persist across power loss events.
1731 Specify the scope of the reservation.
1732 The scope may be specified by name or by number.
1733 The scope is ignored for register, register_ignore and clear.
1734 If the desired scope isn't available by name, you may specify the number.
1738 This encompasses the entire LUN.
1740 Extent scope (0x01).
1742 Element scope (0x02).
1745 Specify the Relative Target Port.
1746 This only applies to the Register and Move service action of the Persistent
1747 Reserve Out command.
1749 Enable the SPEC_I_PT bit.
1750 This only applies to the Register service action of Persistent Reserve Out.
1751 You must also specify at least one Transport ID with
1753 if this option is set.
1754 If you specify a Transport ID, this option is automatically set.
1755 It is an error to specify this option for any service action other than
1758 Specify the reservation type.
1759 The reservation type may be specified by name or by number.
1760 If the desired reservation type isn't available by name, you may specify
1762 Supported reservation type names:
1767 Write Exclusive mode.
1768 May also be specified as
1769 .Dq write_exclusive .
1771 Read Exclusive mode.
1772 May also be specified as
1773 .Dq read_exclusive .
1775 Exclusive access mode.
1776 May also be specified as
1777 .Dq exclusive_access .
1779 Write Exclusive Registrants Only mode.
1780 May also be specified as
1781 .Dq write_exclusive_reg_only .
1783 Exclusive Access Registrants Only mode.
1784 May also be specified as
1785 .Dq exclusive_access_reg_only .
1787 Write Exclusive All Registrants mode.
1788 May also be specified as
1789 .Dq write_exclusive_all_regs .
1791 Exclusive Access All Registrants mode.
1792 May also be specified as
1793 .Dq exclusive_access_all_regs .
1796 Specify that the target should unregister the initiator that sent
1797 the Register and Move request.
1798 By default, the target will not unregister the initiator that sends the
1799 Register and Move request.
1800 This option only applies to the Register and Move service action of the
1801 Persistent Reserve Out command.
1804 Print out verbose usage information.
1809 variable allows the user to specify an alternate mode page format file.
1813 variable determines which text editor
1815 starts when editing mode pages.
1817 .Bl -tag -width /usr/share/misc/scsi_modes -compact
1818 .It Pa /usr/share/misc/scsi_modes
1819 is the SCSI mode format database.
1821 is the transport layer device.
1823 are the CAM application passthrough devices.
1826 .Dl camcontrol eject -n cd -u 1 -v
1828 Eject the CD from cd1, and print SCSI sense information if the command
1831 .Dl camcontrol tur da0
1833 Send the SCSI test unit ready command to da0.
1836 utility will report whether the disk is ready, but will not display sense
1837 information if the command fails since the
1839 switch was not specified.
1840 .Bd -literal -offset indent
1841 camcontrol tur da1 -E -C 4 -t 50 -v
1844 Send a test unit ready command to da1.
1845 Enable kernel error recovery.
1846 Specify a retry count of 4, and a timeout of 50 seconds.
1850 flag) if the command fails.
1851 Since error recovery is turned on, the
1852 disk will be spun up if it is not currently spinning.
1855 utility will report whether the disk is ready.
1856 .Bd -literal -offset indent
1857 camcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \e
1858 -i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1"
1861 Issue a READ BUFFER command (0x3C) to cd1.
1862 Display the buffer size of cd1,
1863 and display the first 10 bytes from the cache on cd1.
1865 information if the command fails.
1866 .Bd -literal -offset indent
1867 camcontrol cmd -n cd -u 1 -v -c "3B 00 00 00 00 00 00 00 0e 00" \e
1868 -o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8
1871 Issue a WRITE BUFFER (0x3B) command to cd1.
1872 Write out 10 bytes of data,
1873 not including the (reserved) 4 byte header.
1874 Print out sense information if
1876 Be very careful with this command, improper use may
1877 cause data corruption.
1878 .Bd -literal -offset indent
1879 camcontrol modepage da3 -m 1 -e -P 3
1882 Edit mode page 1 (the Read-Write Error Recover page) for da3, and save the
1883 settings on the drive.
1884 Mode page 1 contains a disk drive's auto read and
1885 write reallocation settings, among other things.
1887 .Dl camcontrol rescan all
1889 Rescan all SCSI busses in the system for devices that have been added,
1892 .Dl camcontrol rescan 0
1894 Rescan SCSI bus 0 for devices that have been added, removed or changed.
1896 .Dl camcontrol rescan 0:1:0
1898 Rescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or
1901 .Dl camcontrol tags da5 -N 24
1903 Set the number of concurrent transactions for da5 to 24.
1904 .Bd -literal -offset indent
1905 camcontrol negotiate -n da -u 4 -T disable
1908 Disable tagged queueing for da4.
1909 .Bd -literal -offset indent
1910 camcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a
1913 Negotiate a sync rate of 20MHz and an offset of 15 with da3.
1915 Test Unit Ready command to make the settings take effect.
1916 .Bd -literal -offset indent
1917 camcontrol smpcmd ses0 -v -r 4 "40 0 00 0" -R 1020 "s9 i1"
1920 Send the SMP REPORT GENERAL command to ses0, and display the number of PHYs
1922 Display SMP errors if the command fails.
1923 .Bd -literal -offset indent
1924 camcontrol security ada0
1927 Report security support and settings for ada0
1928 .Bd -literal -offset indent
1929 camcontrol security ada0 -U user -s MyPass
1932 Enable security on device ada0 with the password MyPass
1933 .Bd -literal -offset indent
1934 camcontrol security ada0 -U user -e MyPass
1937 Secure erase ada0 which has had security enabled with user password MyPass
1939 .Em WARNING! WARNING! WARNING!
1943 data from the device, so backup your data before using!
1945 This command can be used against an SSD drive to restoring it to
1946 factory default write performance.
1947 .Bd -literal -offset indent
1951 Report HPA support and settings for ada0 (also reported via
1953 .Bd -literal -offset indent
1954 camcontrol hpa ada0 -s 10240
1957 Enables HPA on ada0 setting the maximum reported sectors to 10240.
1959 .Em WARNING! WARNING! WARNING!
1963 to all data on the device beyond this limit until HPA is disabled by setting
1964 HPA to native max sectors of the device, which can only be done after a
1965 power-on or hardware reset!
1968 use this on a device which has an active filesystem!
1969 .Bd -literal -offset indent
1970 camcontrol persist da0 -v -i read_keys
1973 This will read any persistent reservation keys registered with da0, and
1974 display any errors encountered when sending the PERSISTENT RESERVE IN
1977 .Bd -literal -offset indent
1978 camcontrol persist da0 -v -o register -a -K 0x12345678
1981 This will register the persistent reservation key 0x12345678 with da0,
1982 apply that registration to all ports on da0, and display any errors that
1983 occur when sending the PERSISTENT RESERVE OUT command.
1984 .Bd -literal -offset indent
1985 camcontrol persist da0 -v -o reserve -s lun -k 0x12345678 -T ex_ac
1988 This will reserve da0 for the exlusive use of the initiator issuing the
1990 The scope of the reservation is the entire LUN.
1991 Any errors sending the PERSISTENT RESERVE OUT command will be displayed.
1992 .Bd -literal -offset indent
1993 camcontrol persist da0 -v -i read_full
1996 This will display the full status of all reservations on da0 and print out
1997 status if there are any errors.
1998 .Bd -literal -offset indent
1999 camcontrol persist da0 -v -o release -k 0x12345678 -T ex_ac
2002 This will release a reservation on da0 of the type ex_ac
2004 The Reservation Key for this registration is 0x12345678.
2005 Any errors that occur will be displayed.
2006 .Bd -literal -offset indent
2007 camcontrol persist da0 -v -o register -K 0x12345678 -S \e
2008 -I sas,0x1234567812345678 -I sas,0x8765432187654321
2011 This will register the key 0x12345678 with da0, specifying that it applies
2012 to the SAS initiators with SAS addresses 0x1234567812345678 and
2014 .Bd -literal -offset indent
2015 camcontrol persist da0 -v -o register_move -k 0x87654321 \e
2016 -K 0x12345678 -U -p -R 2 -I fcp,0x1234567812345678
2019 This will move the registration from the current initiator, whose
2020 Registration Key is 0x87654321, to the Fibre Channel initiator with the
2021 Fiber Channel World Wide Node Name 0x1234567812345678.
2022 A new registration key, 0x12345678, will be registered for the initiator
2023 with the Fibre Channel World Wide Node Name 0x1234567812345678, and the
2024 current initiator will be unregistered from the target.
2025 The reservation will be moved to relative target port 2 on the target
2027 The registration will persist across power losses.
2030 .Xr cam_cdbparse 3 ,
2037 utility first appeared in
2040 The mode page editing code and arbitrary SCSI command code are based upon
2045 library, written by Julian Elischer and Peter Dufault.
2048 program first appeared in
2050 and first appeared in
2055 .An Kenneth Merry Aq Mt ken@FreeBSD.org
2057 The code that parses the generic command line arguments does not know that
2058 some of the subcommands take multiple arguments.
2059 So if, for instance, you
2060 tried something like this:
2061 .Bd -literal -offset indent
2062 camcontrol cmd -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v
2065 The sense information from the test unit ready command would not get
2066 printed out, since the first
2070 bails out when it sees the second argument to
2074 Fixing this behavior would take some gross code, or changes to the
2077 The best way to circumvent this problem is to always make sure
2080 arguments before any command-specific arguments.