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
117 .Aq Fl m Ar page | Fl l
125 .Aq Fl a Ar cmd Op args
126 .Aq Fl c Ar cmd Op args
129 .Op Fl i Ar len Ar fmt
131 .Op Fl o Ar len Ar fmt Op args
138 .Aq Fl r Ar len Ar fmt Op args
139 .Aq Fl R Ar len Ar fmt Op args
151 .Op Fl o Ar operation
155 .Op Fl T Ar pp_timeout
156 .Op Fl a Ar enable|disable
157 .Op Fl A Ar enable|disable
158 .Op Fl s Ar enable|disable
159 .Op Fl S Ar enable|disable
180 .Aq all|off|bus Ns Op :target Ns Op :lun
193 .Op Fl D Ar enable|disable
198 .Op Fl T Ar enable|disable
200 .Op Fl W Ar bus_width
214 .Aq Fl a Ar overwrite | block | crypto | exitfailure
253 .Op Fl l Ar high|maximum
257 .Op Fl U Ar user|master
268 .Op Fl s Ar max_sectors
275 .Aq Fl i Ar action | Fl o Ar action
281 .Op Fl R Ar rel_tgt_port
291 utility is designed to provide a way for users to access and control the
298 can cause a loss of data and/or system crashes if used improperly.
300 expert users are encouraged to exercise caution when using this command.
301 Novice users should stay away from this utility.
305 utility has a number of primary functions, many of which support an optional
307 A device identifier can take one of three forms:
310 Specify a device name and unit number combination, like "da5" or "cd3".
312 Specify a bus number and target id.
313 The bus number can be determined from
315 .Dq camcontrol devlist .
316 The lun defaults to 0.
318 Specify the bus, target and lun for a device.
322 The device identifier, if it is specified,
324 come immediately after the function name, and before any generic or
325 function-specific arguments.
330 arguments described below will override any device name or unit number
331 specified beforehand.
338 override a specified bus:target or bus:target:lun, however.
342 primary functions support these generic arguments:
345 SCSI command retry count.
346 In order for this to work, error recovery
350 Instruct the kernel to perform generic SCSI error recovery for the given
352 This is needed in order for the retry count
355 Other than retrying commands, the generic error recovery in
356 the code will generally attempt to spin up drives that are not spinning.
357 It may take some other actions, depending upon the sense code returned from
360 Specify the device type to operate on, e.g.\& "da", "cd".
362 SCSI command timeout in seconds.
363 This overrides the default timeout for
365 .It Fl u Ar unit_number
366 Specify the device unit number, e.g.\& "1", "5".
368 Be verbose, print out sense information for failed SCSI commands.
371 Primary command functions:
372 .Bl -tag -width periphlist
374 List all physical devices (logical units) attached to the CAM subsystem.
375 This also includes a list of peripheral drivers attached to each device.
378 argument, SCSI bus number, adapter name and unit numbers are printed as
380 On the other hand, with the
382 argument, only the bus adapter, and unit information will be printed, and
383 device information will be omitted.
385 List all peripheral drivers attached to a given physical device (logical
388 Send the SCSI test unit ready (0x00) command to the given device.
391 utility will report whether the device is ready or not.
393 Send a SCSI inquiry command (0x12) to a device.
396 will print out the standard inquiry data, device serial number, and
397 transfer rate information.
398 The user can specify that only certain types of
399 inquiry data be printed:
402 Get the standard inquiry data.
404 Print out the serial number.
405 If this flag is the only one specified,
407 will not print out "Serial Number" before the value returned by the drive.
408 This is to aid in script writing.
410 Print out transfer rate information.
413 Send a ATA identify command (0xec) to a device.
415 Send the SCSI REPORT LUNS (0xA0) command to the given device.
418 will print out the list of logical units (LUNs) supported by the target device.
419 There are a couple of options to modify the output:
422 Just print out a count of LUNs, not the actual LUN numbers.
424 Just print out the LUNs, and do not print out the count.
425 .It Fl r Ar reporttype
426 Specify the type of report to request from the target:
427 .Bl -tag -width 012345678
429 Return the default report.
433 Most targets will support this report if they support the REPORT LUNS
436 Return only well known LUNs.
438 Return all available LUNs.
443 will try to print out LUN numbers in a reasonable format.
444 It can understand the peripheral, flat, LUN and extended LUN formats.
446 Send the SCSI READ CAPACITY command to the given device and display
448 If the device is larger than 2TB, the SCSI READ CAPACITY (16) service
449 action will be sent to obtain the full size of the device.
452 will print out the last logical block of the device, and the blocksize of
454 To modify the output format, use the following options:
457 Just print out the blocksize, not the last block or device size.
458 This cannot be used with
463 Print out the device size in human readable (base 2, 1K == 1024) format.
466 and cannot be used with
471 Print out the device size in human readable (base 10, 1K == 1000) format.
473 Print out the number of blocks in the device instead of the last logical
476 Quiet, print out the numbers only (separated by a comma if
482 Print out the last logical block or the size of the device only, and omit
486 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
489 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
492 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
493 start bit set and the load/eject bit set.
495 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
496 start bit cleared and the load/eject bit set.
498 Tell the kernel to scan all busses in the system (with the
500 argument), the given bus (XPT_SCAN_BUS), or bus:target:lun
501 (XPT_SCAN_LUN) for new devices or devices that have gone away.
503 may specify a scan of all busses, a single bus, or a lun.
505 on a target is not supported.
507 Tell the kernel to reset all busses in the system (with the
509 argument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus
510 reset for that bus, or to reset the given bus:target:lun
511 (XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after
512 connecting to that device.
513 Note that this can have a destructive impact
516 Send the SCSI READ DEFECT DATA (10) command (0x37) to the given device, and
517 print out any combination of: the total number of defects, the primary
518 defect list (PLIST), and the grown defect list (GLIST).
521 The three format options are:
523 to print out the list as logical blocks,
525 to print out the list in bytes from index format, and
527 to print out the list in physical sector format.
528 The format argument is
530 Most drives support the physical sector format.
532 support the logical block format.
533 Many drives, if they do not support the
534 requested format, return the data in an alternate format, along with sense
535 information indicating that the requested data format is not supported.
539 attempts to detect this, and print out whatever format the drive returns.
540 If the drive uses a non-standard sense code to report that it does not
541 support the requested format,
543 will probably see the error as a failure to complete the request.
545 Print out the grown defect list.
546 This is a list of bad blocks that have
547 been remapped since the disk left the factory.
549 Print out the primary defect list.
558 will print out the number of defects given in the READ DEFECT DATA header
559 returned from the drive.
560 Some drives will report 0 defects if neither the primary or grown defect
563 Allows the user to display and optionally edit a SCSI mode page.
565 page formats are located in
566 .Pa /usr/share/misc/scsi_modes .
567 This can be overridden by specifying a different file in the
569 environment variable.
572 command takes several arguments:
575 Disable block descriptors for mode sense.
577 Displays mode page data in binary format.
579 This flag allows the user to edit values in the mode page.
581 either edit mode page values with the text editor pointed to by his
583 environment variable, or supply mode page values via standard input, using
586 uses to display mode page values.
587 The editor will be invoked if
589 detects that standard input is terminal.
591 Lists all available mode pages.
592 .It Fl m Ar mode_page
593 This specifies the number of the mode page the user would like to view
595 This argument is mandatory unless
599 This allows the user to specify the page control field.
601 .Bl -tag -width xxx -compact
613 Allows the user to send an arbitrary ATA or SCSI CDB to any device.
616 function requires the
618 argument to specify SCSI CDB or the
620 argument to specify ATA Command Block registers values.
621 Other arguments are optional, depending on
623 The command and data specification syntax is documented
626 NOTE: If the CDB specified causes data to be transferred to or from the
627 SCSI device in question, you MUST specify either
632 .It Fl a Ar cmd Op args
633 This specifies the content of 12 ATA Command Block registers (command,
634 features, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp.
635 lba_high_exp, features_exp, sector_count, sector_count_exp).
636 .It Fl c Ar cmd Op args
637 This specifies the SCSI CDB.
638 SCSI CDBs may be 6, 10, 12 or 16 bytes.
640 Specifies DMA protocol to be used for ATA command.
642 Specifies FPDMA (NCQ) protocol to be used for ATA command.
643 .It Fl i Ar len Ar fmt
644 This specifies the amount of data to read, and how it should be displayed.
648 bytes of data will be read from the device and written to standard output.
649 .It Fl o Ar len Ar fmt Op args
650 This specifies the amount of data to be written to a device, and the data
651 that is to be written.
655 bytes of data will be read from standard input and written to the device.
657 This specifies that 11 result ATA Command Block registers should be displayed
658 (status, error, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp,
659 lba_high_exp, sector_count, sector_count_exp), and how.
662 11 result registers will be written to standard output in hex.
665 Allows the user to send an arbitrary Serial
666 Management Protocol (SMP) command to a device.
669 function requires the
671 argument to specify the SMP request to be sent, and the
673 argument to specify the format of the SMP response.
674 The syntax for the SMP request and response arguments is documented in
677 Note that SAS adapters that support SMP passthrough (at least the currently
678 known adapters) do not accept CRC bytes from the user in the request and do
679 not pass CRC bytes back to the user in the response.
680 Therefore users should not include the CRC bytes in the length of the
681 request and not expect CRC bytes to be returned in the response.
683 .It Fl r Ar len Ar fmt Op args
684 This specifies the size of the SMP request, without the CRC bytes, and the
689 bytes of data will be read from standard input and written as the SMP
691 .It Fl R Ar len Ar fmt Op args
692 This specifies the size of the buffer allocated for the SMP response, and
693 the SMP response format.
697 bytes of data will be allocated for the response and the response will be
698 written to standard output.
701 Allows the user to send the Serial Management Protocol (SMP) Report General
704 will display the data returned by the Report General command.
705 If the SMP target supports the long response format, the additional data
706 will be requested and displayed automatically.
709 Request the long response format only.
710 Not all SMP targets support the long response format.
713 to skip sending the initial report general request without the long bit set
714 and only issue a report general request with the long bit set.
717 Allows the user to issue the Serial Management Protocol (SMP) PHY Control
719 This function should be used with some caution, as it can render devices
720 inaccessible, and could potentially cause data corruption as well.
723 argument is required to specify the PHY to operate on.
726 Specify the PHY to operate on.
727 This argument is required.
729 Request the long request/response format.
730 Not all SMP targets support the long response format.
731 For the PHY Control command, this currently only affects whether the
732 request length is set to a value other than 0.
733 .It Fl o Ar operation
734 Specify a PHY control operation.
737 operation may be specified.
738 The operation may be specified numerically (in decimal, hexadecimal, or octal)
739 or one of the following operation names may be specified:
743 It is not necessary to specify this argument.
745 Send the LINK RESET command to the phy.
747 Send the HARD RESET command to the phy.
749 Send the DISABLE command to the phy.
750 Note that the LINK RESET or HARD RESET commands should re-enable the phy.
752 Send the CLEAR ERROR LOG command.
753 This clears the error log counters for the specified phy.
755 Send the CLEAR AFFILIATION command.
756 This clears the affiliation from the STP initiator port with the same SAS
757 address as the SMP initiator that requests the clear operation.
759 Send the TRANSMIT SATA PORT SELECTION SIGNAL command to the phy.
760 This will cause a SATA port selector to use the given phy as its active phy
761 and make the other phy inactive.
763 Send the CLEAR STP I_T NEXUS LOSS command to the PHY.
765 Send the SET ATTACHED DEVICE NAME command to the PHY.
768 argument to specify the device name.
771 Specify the attached device name.
772 This option is needed with the
775 The name is a 64-bit number, and can be specified in decimal, hexadecimal
778 Set the minimum physical link rate for the phy.
779 This is a numeric argument.
780 Currently known link rates are:
783 Do not change current value.
792 Other values may be specified for newer physical link rates.
794 Set the maximum physical link rate for the phy.
795 This is a numeric argument.
798 argument description for known link rate arguments.
799 .It Fl T Ar pp_timeout
800 Set the partial pathway timeout value, in microseconds.
805 specification for more information on this field.
806 .It Fl a Ar enable|disable
807 Enable or disable SATA slumber phy power conditions.
808 .It Fl A Ar enable|disable
809 Enable or disable SATA partial power conditions.
810 .It Fl s Ar enable|disable
811 Enable or disable SAS slumber phy power conditions.
812 .It Fl S Ar enable|disable
813 Enable or disable SAS partial phy power conditions.
816 List phys attached to a SAS expander, the address of the end device
817 attached to the phy, and the inquiry data for that device and peripheral
818 devices attached to that device.
819 The inquiry data and peripheral devices are displayed if available.
822 Turn on the long response format for the underlying SMP commands used for
825 Only print out phys that are attached to a device in the CAM EDT (Existing
829 Send the SMP Report Manufacturer Information command to the device and
830 display the response.
833 Turn on the long response format for the underlying SMP commands used for
837 Turn on CAM debugging printfs in the kernel.
838 This requires options CAMDEBUG
839 in your kernel config file.
840 WARNING: enabling debugging printfs currently
841 causes an EXTREME number of kernel printfs.
842 You may have difficulty
843 turning off the debugging printfs once they start, since the kernel will be
844 busy printing messages and unable to service other requests quickly.
847 function takes a number of arguments:
850 Enable CAM_DEBUG_INFO printfs.
852 Enable CAM_DEBUG_PERIPH printfs.
854 Enable CAM_DEBUG_TRACE printfs.
856 Enable CAM_DEBUG_SUBTRACE printfs.
858 Enable CAM_DEBUG_XPT printfs.
860 Enable CAM_DEBUG_CDB printfs.
861 This will cause the kernel to print out the
862 SCSI CDBs sent to the specified device(s).
864 Enable CAM_DEBUG_PROBE printfs.
866 Enable debugging for all devices.
868 Turn off debugging for all devices
869 .It bus Ns Op :target Ns Op :lun
870 Turn on debugging for the given bus, target or lun.
872 and lun are not specified, they are wildcarded.
873 (i.e., just specifying a
874 bus turns on debugging printfs for all devices on that bus.)
877 Show or set the number of "tagged openings" or simultaneous transactions
878 we attempt to queue to a particular device.
881 command, with no command-specific arguments (i.e., only generic arguments)
882 prints out the "soft" maximum number of transactions that can be queued to
883 the device in question.
884 For more detailed information, use the
886 argument described below.
889 Set the number of tags for the given device.
890 This must be between the
891 minimum and maximum number set in the kernel quirk table.
893 most devices that support tagged queueing is a minimum of 2 and a maximum
895 The minimum and maximum values for a given device may be
896 determined by using the
903 subcommand is described below.
905 Be quiet, and do not report the number of tags.
906 This is generally used when
907 setting the number of tags.
909 The verbose flag has special functionality for the
914 to print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB:
917 This is the amount of capacity for transactions queued to a given device.
919 This is the number of transactions currently queued to a device.
921 This is the kernel queue space for transactions.
922 This count usually mirrors
923 dev_openings except during error recovery operations when
924 the device queue is frozen (device is not allowed to receive
925 commands), the number of dev_openings is reduced, or transaction
928 This is the number of transactions waiting in the kernel queue for capacity
930 This number is usually zero unless error recovery is in
933 The held count is the number of CCBs held by peripheral drivers that have
934 either just been completed or are about to be released to the transport
935 layer for service by a device.
936 Held CCBs reserve capacity on a given
939 This is the current "hard" minimum number of transactions that can be
940 queued to a device at once.
943 value above cannot go below this number.
944 The default value for
946 is 2, although it may be set higher or lower for various devices.
948 This is the "hard" maximum number of transactions that can be queued to a
952 value cannot go above this number.
953 The default value for
955 is 255, although it may be set higher or lower for various devices.
959 Show or negotiate various communication parameters.
961 not support setting or changing some of these values.
963 Adaptec 174x controllers do not support changing a device's sync rate or
968 will not attempt to set the parameter if the controller indicates that it
969 does not support setting the parameter.
970 To find out what the controller
978 command is described below.
979 Also, some controller drivers do not support
980 setting negotiation parameters, even if the underlying controller supports
982 Some controllers, such as the Advansys wide
983 controllers, support enabling and disabling synchronous negotiation for
984 a device, but do not support setting the synchronous negotiation rate.
987 Attempt to make the negotiation settings take effect immediately by sending
988 a Test Unit Ready command to the device.
990 Show or set current negotiation settings.
992 .It Fl D Ar enable|disable
993 Enable or disable disconnection.
997 Set the command delay offset.
999 Be quiet, do not print anything.
1000 This is generally useful when you want to
1001 set a parameter, but do not want any status information.
1002 .It Fl R Ar syncrate
1003 Change the synchronization rate for a device.
1004 The sync rate is a floating
1005 point value specified in MHz.
1008 is a legal value, as is
1010 .It Fl T Ar enable|disable
1011 Enable or disable tagged queueing for a device.
1013 Show or set user negotiation settings.
1014 The default is to show or set
1015 current negotiation settings.
1017 The verbose switch has special meaning for the
1022 to print out the contents of a Path Inquiry (XPT_PATH_INQ) CCB sent to the
1024 .It Fl W Ar bus_width
1025 Specify the bus width to negotiate with a device.
1028 The only useful values to specify are 8, 16, and 32
1030 The controller must support the bus width in question in order for
1031 the setting to take effect.
1034 In general, sync rate and offset settings will not take effect for a
1035 device until a command has been sent to the device.
1038 switch above will automatically send a Test Unit Ready to the device so
1039 negotiation parameters will take effect.
1043 FORMAT UNIT command to the named device.
1045 .Em WARNING! WARNING! WARNING!
1047 Low level formatting a disk will destroy ALL data on the disk.
1049 extreme caution when issuing this command.
1050 Many users low-level format
1051 disks that do not really need to be low-level formatted.
1053 relatively few scenarios that call for low-level formatting a disk.
1055 low-level formatting a disk is to initialize the disk after changing
1056 its physical sector size.
1057 Another reason for low-level formatting a disk
1058 is to revive the disk if you are getting "medium format corrupted" errors
1059 from the disk in response to read and write requests.
1061 Some disks take longer than others to format.
1062 Users should specify a
1063 timeout long enough to allow the format to complete.
1065 timeout is 3 hours, which should be long enough for most disks.
1067 disks will complete a format operation in a very short period of time
1068 (on the order of 5 minutes or less).
1069 This is often because the drive
1070 does not really support the FORMAT UNIT command -- it just accepts the
1071 command, waits a few minutes and then returns it.
1075 subcommand takes several arguments that modify its default behavior.
1080 arguments can be useful for scripts.
1083 Be quiet, do not print any status messages.
1084 This option will not disable
1085 the questions, however.
1086 To disable questions, use the
1093 This will report status on a format that is already running on the drive.
1095 Issue a non-immediate format command.
1098 issues the FORMAT UNIT command with the immediate bit set.
1100 device to immediately return the format command, before the format has
1106 sense information from the device every second to determine how far along
1107 in the format process it is.
1110 argument is specified,
1112 will issue a non-immediate format command, and will be unable to print any
1113 information to let the user know what percentage of the disk has been
1116 Do not ask any questions.
1119 will ask the user if he/she really wants to format the disk in question,
1120 and also if the default format command timeout is acceptable.
1122 will not be asked about the timeout if a timeout is specified on the
1128 SANITIZE command to the named device.
1130 .Em WARNING! WARNING! WARNING!
1132 ALL data in the cache and on the disk will be destroyed or made inaccessible.
1133 Recovery of the data is not possible.
1134 Use extreme caution when issuing this command.
1138 subcommand takes several arguments that modify its default behavior.
1143 arguments can be useful for scripts.
1145 .It Fl a Ar operation
1146 Specify the sanitize operation to perform.
1149 Perform an overwrite operation by writing a user supplied
1150 data pattern to the device one or more times.
1151 The pattern is given by the
1154 The number of times is given by the
1158 Perform a block erase operation.
1159 All the device's blocks are set to a vendor defined
1160 value, typically zero.
1162 Perform a cryptographic erase operation.
1163 The encryption keys are changed to prevent the decryption
1166 Exits a previously failed sanitize operation.
1167 A failed sanitize operation can only be exited if it was
1168 run in the unrestricted completion mode, as provided by the
1173 The number of passes when performing an
1176 Valid values are between 1 and 31.
1181 operation, the pattern is inverted between consecutive passes.
1183 Path to the file containing the pattern to use when
1187 The pattern is repeated as needed to fill each block.
1189 Be quiet, do not print any status messages.
1190 This option will not disable
1191 the questions, however.
1192 To disable questions, use the
1196 Perform the sanitize in the unrestricted completion mode.
1197 If the operation fails, it can later be exited with the
1204 This will report status on a sanitize that is already running on the drive.
1206 Issue a non-immediate sanitize command.
1209 issues the SANITIZE command with the immediate bit set.
1211 device to immediately return the sanitize command, before
1212 the sanitize has actually completed.
1217 sense information from the device every second to determine how far along
1218 in the sanitize process it is.
1221 argument is specified,
1223 will issue a non-immediate sanitize command, and will be unable to print any
1224 information to let the user know what percentage of the disk has been
1227 Do not ask any questions.
1230 will ask the user if he/she really wants to sanitize the disk in question,
1231 and also if the default sanitize command timeout is acceptable.
1233 will not be asked about the timeout if a timeout is specified on the
1237 Put ATA device into IDLE state.
1240 specifies automatic standby timer value in seconds.
1241 Value 0 disables timer.
1243 Put ATA device into STANDBY state.
1246 specifies automatic standby timer value in seconds.
1247 Value 0 disables timer.
1249 Put ATA device into SLEEP state.
1250 Note that the only way get device out of
1251 this state may be reset.
1253 Update or report security settings, using an ATA identify command (0xec).
1256 will print out the security support and associated settings of the device.
1259 command takes several arguments:
1263 Disable device security using the given password for the selected user according
1264 to the devices configured security level.
1267 Erase the device using the given password for the selected user.
1269 .Em WARNING! WARNING! WARNING!
1271 Issuing a secure erase will
1273 user data on the device and may take several hours to complete.
1275 When this command is used against an SSD drive all its cells will be marked as
1276 empty, restoring it to factory default write performance.
1277 For SSD's this action
1278 usually takes just a few seconds.
1281 Freeze the security configuration of the specified device.
1283 After command completion any other commands that update the device lock mode
1284 shall be command aborted.
1285 Frozen mode is disabled by power-off or hardware reset.
1288 Enhanced erase the device using the given password for the selected user.
1290 .Em WARNING! WARNING! WARNING!
1292 Issuing an enhanced secure erase will
1294 user data on the device and may take several hours to complete.
1296 An enhanced erase writes predetermined data patterns to all user data areas,
1297 all previously written user data shall be overwritten, including sectors that
1298 are no longer in use due to reallocation.
1301 Unlock the device using the given password for the selected user according to
1302 the devices configured security level.
1303 .It Fl l Ar high|maximum
1305 Specifies which security level to set when issuing a
1308 The security level determines device behavior when the master
1309 password is used to unlock the device.
1310 When the security level is set to high
1311 the device requires the unlock command and the master password to unlock.
1312 When the security level is set to maximum the device requires a secure erase
1313 with the master password to unlock.
1315 This option must be used in conjunction with one of the security action commands.
1321 Be quiet, do not print any status messages.
1322 This option will not disable the questions, however.
1323 To disable questions, use the
1328 Password the device (enable security) using the given password for the selected
1330 This option can be combined with other options such as
1333 A master password may be set in a addition to the user password. The purpose of
1334 the master password is to allow an administrator to establish a password that
1335 is kept secret from the user, and which may be used to unlock the device if the
1336 user password is lost.
1339 Setting the master password does not enable device security.
1341 If the master password is set and the drive supports a Master Revision Code
1342 feature the Master Password Revision Code will be decremented.
1345 Overrides the default timeout, specified in seconds, used for both
1349 this is useful if your system has problems processing long timeouts correctly.
1351 Usually the timeout is calculated from the information stored on the drive if
1352 present, otherwise it defaults to 2 hours.
1353 .It Fl U Ar user|master
1355 Specifies which user to set / use for the running action command, valid values
1356 are user or master and defaults to master if not set.
1358 This option must be used in conjunction with one of the security action commands.
1364 Confirm yes to dangerous options such as
1366 without prompting for confirmation.
1369 If the password specified for any action commands does not match the configured
1370 password for the specified user the command will fail.
1372 The password in all cases is limited to 32 characters, longer passwords will
1375 Update or report Host Protected Area details.
1378 will print out the HPA support and associated settings of the device.
1381 command takes several optional arguments:
1385 Freeze the HPA configuration of the specified device.
1387 After command completion any other commands that update the HPA configuration
1388 shall be command aborted.
1389 Frozen mode is disabled by power-off or hardware reset.
1392 Lock the HPA configuration of the device until a successful call to unlock or
1393 the next power-on reset occurs.
1396 Make the HPA max sectors persist across power-on reset or a hardware reset.
1397 This must be used in combination with
1398 .Fl s Ar max_sectors
1402 Set the HPA configuration password required for unlock calls.
1405 Be quiet, do not print any status messages.
1406 This option will not disable the questions.
1407 To disable questions, use the
1410 .It Fl s Ar max_sectors
1412 Configures the maximum user accessible sectors of the device.
1413 This will change the number of sectors the device reports.
1415 .Em WARNING! WARNING! WARNING!
1417 Changing the max sectors of a device using this option will make the data on
1418 the device beyond the specified value inaccessible.
1421 .Fl s Ar max_sectors
1422 call can be made without a power-on reset or a hardware reset of the device.
1425 Unlock the HPA configuration of the specified device using the given password.
1426 If the password specified does not match the password configured via
1428 the command will fail.
1430 After 5 failed unlock calls, due to password miss-match, the device will refuse
1431 additional unlock calls until after a power-on reset.
1434 Confirm yes to dangerous options such as
1436 without prompting for confirmation
1439 The password for all HPA commands is limited to 32 characters, longer passwords
1442 Program firmware of the named SCSI device using the image file provided.
1444 Current list of supported vendors:
1445 .Bl -bullet -offset indent -compact
1462 .Em WARNING! WARNING! WARNING!
1464 Little testing has been done to make sure that different device models from
1465 each vendor work correctly with the fwdownload command.
1466 A vendor name appearing in the supported list means only that firmware of at
1467 least one device type from that vendor has successfully been programmed with
1468 the fwdownload command.
1469 Extra caution should be taken when using this command since there is no
1470 guarantee it will not break a device from the listed vendors.
1471 Ensure that you have a recent backup of the data on the device before
1472 performing a firmware update.
1474 .It Fl f Ar fw_image
1475 Path to the firmware image file to be downloaded to the specified device.
1477 Do not ask for confirmation.
1479 Run in simulation mode.
1480 Packet sizes that will be sent are shown, but no actual packet is sent to the
1482 No confirmation is asked in simulation mode.
1484 Besides showing sense information in case of a failure, the verbose option
1487 to output a line for every firmware segment that is sent to the device by the
1489 -- the same as the ones shown in simulation mode.
1492 Persistent reservation support.
1493 Persistent reservations are a way to reserve a particular
1495 LUN for use by one or more
1500 option is specified,
1504 PERSISTENT RESERVE IN
1505 command using the requested service action.
1508 option is specified,
1512 PERSISTENT RESERVE OUT
1513 command using the requested service action.
1514 One of those two options is required.
1516 Persistent reservations are complex, and fully explaining them is outside
1517 the scope of this manual.
1520 and download the latest SPC spec for a full explanation of persistent
1524 Specify the service action for the PERSISTENT RESERVE IN command.
1525 Supported service actions:
1528 Report the current persistent reservation generation (PRgeneration) and any
1530 .It read_reservation
1531 Report the persistent reservation, if any.
1532 .It report_capabilities
1533 Report the persistent reservation capabilities of the LUN.
1534 .It read_full_status
1535 Report the full status of persistent reservations on the LUN.
1538 Specify the service action for the PERSISTENT RESERVE OUT command.
1539 For service actions like register that are components of other service
1540 action names, the entire name must be specified.
1541 Otherwise, enough of the service action name must be specified to
1542 distinguish it from other possible service actions.
1543 Supported service actions:
1546 Register a reservation key with the LUN or unregister a reservation key.
1547 To register a key, specify the requested key as the Service Action
1549 To unregister a key, specify the previously registered key as the
1551 To change a key, specify the old key as the Reservation Key and the new
1552 key as the Service Action Reservation Key.
1554 This is similar to the register subcommand, except that the Reservation Key
1556 The Service Action Reservation Key will overwrite any previous key
1557 registered for the initiator.
1559 Create a reservation.
1560 A key must be registered with the LUN before the LUN can be reserved, and
1561 it must be specified as the Reservation Key.
1562 The type of reservation must also be specified.
1563 The scope defaults to LUN scope (LU_SCOPE), but may be changed.
1565 Release a reservation.
1566 The Reservation Key must be specified.
1568 Release a reservation and remove all keys from the device.
1569 The Reservation Key must be specified.
1571 Remove a reservation belonging to another initiator.
1572 The Reservation Key must be specified.
1573 The Service Action Reservation Key may be specified, depending on the
1574 operation being performed.
1576 Remove a reservation belonging to another initiator and abort all
1577 outstanding commands from that initiator.
1578 The Reservation Key must be specified.
1579 The Service Action Reservation Key may be specified, depending on the
1580 operation being performed.
1582 Register another initiator with the LUN, and establish a reservation on the
1583 LUN for that initiator.
1584 The Reservation Key and Service Action Reservation Key must be specified.
1586 Replace Lost Reservation information.
1589 Set the All Target Ports (ALL_TG_PT) bit.
1590 This requests that the key registration be applied to all target ports and
1591 not just the particular target port that receives the command.
1592 This only applies to the register and register_ignore actions.
1594 Specify a Transport ID.
1595 This only applies to the Register and Register and Move service actions for
1596 Persistent Reserve Out.
1597 Multiple Transport IDs may be specified with multiple
1600 With the Register service action, specifying one or more Transport IDs
1601 implicitly enables the
1603 option which turns on the SPEC_I_PT bit.
1604 Transport IDs generally have the format protocol,id.
1607 A SAS Transport ID consists of
1609 followed by a 64-bit SAS address.
1612 .Dl sas,0x1234567812345678
1614 A Fibre Channel Transport ID consists of
1616 followed by a 64-bit Fibre Channel World Wide Name.
1619 .Dl fcp,0x1234567812345678
1621 A Parallel SCSI address consists of
1623 followed by a SCSI target ID and a relative target port identifier.
1628 An IEEE 1394 (Firewire) Transport ID consists of
1630 followed by a 64-bit EUI-64 IEEE 1394 node unique identifier.
1633 .Dl sbp,0x1234567812345678
1635 A SCSI over RDMA Transport ID consists of
1637 followed by a 128-bit RDMA initiator port identifier.
1638 The port identifier must be exactly 32 or 34 (if the leading 0x is
1639 included) hexadecimal digits.
1640 Only hexadecimal (base 16) numbers are supported.
1643 .Dl srp,0x12345678123456781234567812345678
1645 An iSCSI Transport ID consists an iSCSI name and optionally a separator and
1647 For example, if only the iSCSI name is specified:
1649 .Dl iqn.2012-06.com.example:target0
1651 If the iSCSI separator and initiator session ID are specified:
1653 .Dl iqn.2012-06.com.example:target0,i,0x123
1655 A SCSI over PCIe Transport ID consists of
1657 followed by a PCIe Routing ID.
1658 The Routing ID consists of a bus, device and function or in the alternate
1659 form, a bus and function.
1660 The bus must be in the range of 0 to 255 inclusive and the device must be
1661 in the range of 0 to 31 inclusive.
1662 The function must be in the range of 0 to 7 inclusive if the standard form
1663 is used, and in the range of 0 to 255 inclusive if the alternate form is
1665 For example, if a bus, device and function are specified for the standard
1670 If the alternate Routing ID form is used:
1675 Specify the Reservation Key.
1676 This may be in decimal, octal or hexadecimal format.
1677 The value is zero by default if not otherwise specified.
1678 The value must be between 0 and 2^64 - 1, inclusive.
1680 Specify the Service Action Reservation Key.
1681 This may be in decimal, octal or hexadecimal format.
1682 The value is zero by default if not otherwise specified.
1683 The value must be between 0 and 2^64 - 1, inclusive.
1685 Enable the Activate Persist Through Power Loss bit.
1686 This is only used for the register and register_ignore actions.
1687 This requests that the reservation persist across power loss events.
1689 Specify the scope of the reservation.
1690 The scope may be specified by name or by number.
1691 The scope is ignored for register, register_ignore and clear.
1692 If the desired scope isn't available by name, you may specify the number.
1696 This encompasses the entire LUN.
1698 Extent scope (0x01).
1700 Element scope (0x02).
1703 Specify the Relative Target Port.
1704 This only applies to the Register and Move service action of the Persistent
1705 Reserve Out command.
1707 Enable the SPEC_I_PT bit.
1708 This only applies to the Register service action of Persistent Reserve Out.
1709 You must also specify at least one Transport ID with
1711 if this option is set.
1712 If you specify a Transport ID, this option is automatically set.
1713 It is an error to specify this option for any service action other than
1716 Specify the reservation type.
1717 The reservation type may be specified by name or by number.
1718 If the desired reservation type isn't available by name, you may specify
1720 Supported reservation type names:
1725 Write Exclusive mode.
1726 May also be specified as
1727 .Dq write_exclusive .
1729 Read Exclusive mode.
1730 May also be specified as
1731 .Dq read_exclusive .
1733 Exclusive access mode.
1734 May also be specified as
1735 .Dq exclusive_access .
1737 Write Exclusive Registrants Only mode.
1738 May also be specified as
1739 .Dq write_exclusive_reg_only .
1741 Exclusive Access Registrants Only mode.
1742 May also be specified as
1743 .Dq exclusive_access_reg_only .
1745 Write Exclusive All Registrants mode.
1746 May also be specified as
1747 .Dq write_exclusive_all_regs .
1749 Exclusive Access All Registrants mode.
1750 May also be specified as
1751 .Dq exclusive_access_all_regs .
1754 Specify that the target should unregister the initiator that sent
1755 the Register and Move request.
1756 By default, the target will not unregister the initiator that sends the
1757 Register and Move request.
1758 This option only applies to the Register and Move service action of the
1759 Persistent Reserve Out command.
1762 Print out verbose usage information.
1767 variable allows the user to specify an alternate mode page format file.
1771 variable determines which text editor
1773 starts when editing mode pages.
1775 .Bl -tag -width /usr/share/misc/scsi_modes -compact
1776 .It Pa /usr/share/misc/scsi_modes
1777 is the SCSI mode format database.
1779 is the transport layer device.
1781 are the CAM application passthrough devices.
1784 .Dl camcontrol eject -n cd -u 1 -v
1786 Eject the CD from cd1, and print SCSI sense information if the command
1789 .Dl camcontrol tur da0
1791 Send the SCSI test unit ready command to da0.
1794 utility will report whether the disk is ready, but will not display sense
1795 information if the command fails since the
1797 switch was not specified.
1798 .Bd -literal -offset indent
1799 camcontrol tur da1 -E -C 4 -t 50 -v
1802 Send a test unit ready command to da1.
1803 Enable kernel error recovery.
1804 Specify a retry count of 4, and a timeout of 50 seconds.
1808 flag) if the command fails.
1809 Since error recovery is turned on, the
1810 disk will be spun up if it is not currently spinning.
1813 utility will report whether the disk is ready.
1814 .Bd -literal -offset indent
1815 camcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \e
1816 -i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1"
1819 Issue a READ BUFFER command (0x3C) to cd1.
1820 Display the buffer size of cd1,
1821 and display the first 10 bytes from the cache on cd1.
1823 information if the command fails.
1824 .Bd -literal -offset indent
1825 camcontrol cmd -n cd -u 1 -v -c "3B 00 00 00 00 00 00 00 0e 00" \e
1826 -o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8
1829 Issue a WRITE BUFFER (0x3B) command to cd1.
1830 Write out 10 bytes of data,
1831 not including the (reserved) 4 byte header.
1832 Print out sense information if
1834 Be very careful with this command, improper use may
1835 cause data corruption.
1836 .Bd -literal -offset indent
1837 camcontrol modepage da3 -m 1 -e -P 3
1840 Edit mode page 1 (the Read-Write Error Recover page) for da3, and save the
1841 settings on the drive.
1842 Mode page 1 contains a disk drive's auto read and
1843 write reallocation settings, among other things.
1845 .Dl camcontrol rescan all
1847 Rescan all SCSI busses in the system for devices that have been added,
1850 .Dl camcontrol rescan 0
1852 Rescan SCSI bus 0 for devices that have been added, removed or changed.
1854 .Dl camcontrol rescan 0:1:0
1856 Rescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or
1859 .Dl camcontrol tags da5 -N 24
1861 Set the number of concurrent transactions for da5 to 24.
1862 .Bd -literal -offset indent
1863 camcontrol negotiate -n da -u 4 -T disable
1866 Disable tagged queueing for da4.
1867 .Bd -literal -offset indent
1868 camcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a
1871 Negotiate a sync rate of 20MHz and an offset of 15 with da3.
1873 Test Unit Ready command to make the settings take effect.
1874 .Bd -literal -offset indent
1875 camcontrol smpcmd ses0 -v -r 4 "40 0 00 0" -R 1020 "s9 i1"
1878 Send the SMP REPORT GENERAL command to ses0, and display the number of PHYs
1880 Display SMP errors if the command fails.
1881 .Bd -literal -offset indent
1882 camcontrol security ada0
1885 Report security support and settings for ada0
1886 .Bd -literal -offset indent
1887 camcontrol security ada0 -U user -s MyPass
1890 Enable security on device ada0 with the password MyPass
1891 .Bd -literal -offset indent
1892 camcontrol security ada0 -U user -e MyPass
1895 Secure erase ada0 which has had security enabled with user password MyPass
1897 .Em WARNING! WARNING! WARNING!
1901 data from the device, so backup your data before using!
1903 This command can be used against an SSD drive to restoring it to
1904 factory default write performance.
1905 .Bd -literal -offset indent
1909 Report HPA support and settings for ada0 (also reported via
1911 .Bd -literal -offset indent
1912 camcontrol hpa ada0 -s 10240
1915 Enables HPA on ada0 setting the maximum reported sectors to 10240.
1917 .Em WARNING! WARNING! WARNING!
1921 to all data on the device beyond this limit until HPA is disabled by setting
1922 HPA to native max sectors of the device, which can only be done after a
1923 power-on or hardware reset!
1926 use this on a device which has an active filesystem!
1928 .Bd -literal -offset indent
1929 camcontrol persist da0 -v -i read_keys
1932 This will read any persistent reservation keys registered with da0, and
1933 display any errors encountered when sending the PERSISTENT RESERVE IN
1936 .Bd -literal -offset indent
1937 camcontrol persist da0 -v -o register -a -K 0x12345678
1940 This will register the persistent reservation key 0x12345678 with da0,
1941 apply that registration to all ports on da0, and display any errors that
1942 occur when sending the PERSISTENT RESERVE OUT command.
1943 .Bd -literal -offset indent
1944 camcontrol persist da0 -v -o reserve -s lun -k 0x12345678 -T ex_ac
1947 This will reserve da0 for the exlusive use of the initiator issuing the
1949 The scope of the reservation is the entire LUN.
1950 Any errors sending the PERSISTENT RESERVE OUT command will be displayed.
1951 .Bd -literal -offset indent
1952 camcontrol persist da0 -v -i read_full
1955 This will display the full status of all reservations on da0 and print out
1956 status if there are any errors.
1957 .Bd -literal -offset indent
1958 camcontrol persist da0 -v -o release -k 0x12345678 -T ex_ac
1961 This will release a reservation on da0 of the type ex_ac
1963 The Reservation Key for this registration is 0x12345678.
1964 Any errors that occur will be displayed.
1965 .Bd -literal -offset indent
1966 camcontrol persist da0 -v -o register -K 0x12345678 -S \e
1967 -I sas,0x1234567812345678 -I sas,0x8765432187654321
1970 This will register the key 0x12345678 with da0, specifying that it applies
1971 to the SAS initiators with SAS addresses 0x1234567812345678 and
1973 .Bd -literal -offset indent
1974 camcontrol persist da0 -v -o register_move -k 0x87654321 \e
1975 -K 0x12345678 -U -p -R 2 -I fcp,0x1234567812345678
1978 This will move the registration from the current initiator, whose
1979 Registration Key is 0x87654321, to the Fibre Channel initiator with the
1980 Fiber Channel World Wide Node Name 0x1234567812345678.
1981 A new registration key, 0x12345678, will be registered for the initiator
1982 with the Fibre Channel World Wide Node Name 0x1234567812345678, and the
1983 current initiator will be unregistered from the target.
1984 The reservation will be moved to relative target port 2 on the target
1986 The registration will persist across power losses.
1989 .Xr cam_cdbparse 3 ,
1996 utility first appeared in
1999 The mode page editing code and arbitrary SCSI command code are based upon
2004 library, written by Julian Elischer and Peter Dufault.
2007 program first appeared in
2009 and first appeared in
2014 .An Kenneth Merry Aq ken@FreeBSD.org
2016 The code that parses the generic command line arguments does not know that
2017 some of the subcommands take multiple arguments.
2018 So if, for instance, you
2019 tried something like this:
2020 .Bd -literal -offset indent
2021 camcontrol cmd -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v
2024 The sense information from the test unit ready command would not get
2025 printed out, since the first
2029 bails out when it sees the second argument to
2033 Fixing this behavior would take some gross code, or changes to the
2036 The best way to circumvent this problem is to always make sure
2039 arguments before any command-specific arguments.