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
267 .Op Fl l Ar high|maximum
271 .Op Fl U Ar user|master
282 .Op Fl s Ar max_sectors
289 .Aq Fl i Ar action | Fl o Ar action
295 .Op Fl R Ar rel_tgt_port
305 utility is designed to provide a way for users to access and control the
312 can cause a loss of data and/or system crashes if used improperly.
314 expert users are encouraged to exercise caution when using this command.
315 Novice users should stay away from this utility.
319 utility has a number of primary functions, many of which support an optional
321 A device identifier can take one of three forms:
324 Specify a device name and unit number combination, like "da5" or "cd3".
326 Specify a bus number and target id.
327 The bus number can be determined from
329 .Dq camcontrol devlist .
330 The lun defaults to 0.
332 Specify the bus, target and lun for a device.
336 The device identifier, if it is specified,
338 come immediately after the function name, and before any generic or
339 function-specific arguments.
344 arguments described below will override any device name or unit number
345 specified beforehand.
352 override a specified bus:target or bus:target:lun, however.
356 primary functions support these generic arguments:
359 SCSI command retry count.
360 In order for this to work, error recovery
364 Instruct the kernel to perform generic SCSI error recovery for the given
366 This is needed in order for the retry count
369 Other than retrying commands, the generic error recovery in
370 the code will generally attempt to spin up drives that are not spinning.
371 It may take some other actions, depending upon the sense code returned from
374 Specify the device type to operate on, e.g.\& "da", "cd".
376 SCSI command timeout in seconds.
377 This overrides the default timeout for
379 .It Fl u Ar unit_number
380 Specify the device unit number, e.g.\& "1", "5".
382 Be verbose, print out sense information for failed SCSI commands.
385 Primary command functions:
386 .Bl -tag -width periphlist
388 List all physical devices (logical units) attached to the CAM subsystem.
389 This also includes a list of peripheral drivers attached to each device.
392 argument, SCSI bus number, adapter name and unit numbers are printed as
394 On the other hand, with the
396 argument, only the bus adapter, and unit information will be printed, and
397 device information will be omitted.
399 List all peripheral drivers attached to a given physical device (logical
402 Send the SCSI test unit ready (0x00) command to the given device.
405 utility will report whether the device is ready or not.
407 Send a SCSI inquiry command (0x12) to a device.
410 will print out the standard inquiry data, device serial number, and
411 transfer rate information.
412 The user can specify that only certain types of
413 inquiry data be printed:
416 Get the standard inquiry data.
418 Print out the serial number.
419 If this flag is the only one specified,
421 will not print out "Serial Number" before the value returned by the drive.
422 This is to aid in script writing.
424 Print out transfer rate information.
427 Send a ATA identify command (0xec) to a device.
429 Send the SCSI REPORT LUNS (0xA0) command to the given device.
432 will print out the list of logical units (LUNs) supported by the target device.
433 There are a couple of options to modify the output:
436 Just print out a count of LUNs, not the actual LUN numbers.
438 Just print out the LUNs, and do not print out the count.
439 .It Fl r Ar reporttype
440 Specify the type of report to request from the target:
441 .Bl -tag -width 012345678
443 Return the default report.
447 Most targets will support this report if they support the REPORT LUNS
450 Return only well known LUNs.
452 Return all available LUNs.
457 will try to print out LUN numbers in a reasonable format.
458 It can understand the peripheral, flat, LUN and extended LUN formats.
460 Send the SCSI READ CAPACITY command to the given device and display
462 If the device is larger than 2TB, the SCSI READ CAPACITY (16) service
463 action will be sent to obtain the full size of the device.
466 will print out the last logical block of the device, and the blocksize of
468 To modify the output format, use the following options:
471 Just print out the blocksize, not the last block or device size.
472 This cannot be used with
477 Print out the device size in human readable (base 2, 1K == 1024) format.
480 and cannot be used with
485 Print out the device size in human readable (base 10, 1K == 1000) format.
487 Print out the number of blocks in the device instead of the last logical
490 Quiet, print out the numbers only (separated by a comma if
496 Print out the last logical block or the size of the device only, and omit
500 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
503 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
506 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
507 start bit set and the load/eject bit set.
509 Send the SCSI Start/Stop Unit (0x1B) command to the given device with the
510 start bit cleared and the load/eject bit set.
512 Tell the kernel to scan all busses in the system (with the
514 argument), the given bus (XPT_SCAN_BUS), or bus:target:lun
515 (XPT_SCAN_LUN) for new devices or devices that have gone away.
517 may specify a scan of all busses, a single bus, or a lun.
519 on a target is not supported.
521 Tell the kernel to reset all busses in the system (with the
523 argument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus
524 reset for that bus, or to reset the given bus:target:lun
525 (XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after
526 connecting to that device.
527 Note that this can have a destructive impact
532 READ DEFECT DATA (10) command (0x37) or the
534 READ DEFECT DATA (12) command (0xB7) to the given device, and
535 print out any combination of: the total number of defects, the primary
536 defect list (PLIST), and the grown defect list (GLIST).
539 Specify the requested format of the defect list.
540 The format argument is
542 Most drives support the physical sector format.
544 support the logical block format.
545 Many drives, if they do not support the
546 requested format, return the data in an alternate format, along with sense
547 information indicating that the requested data format is not supported.
551 attempts to detect this, and print out whatever format the drive returns.
552 If the drive uses a non-standard sense code to report that it does not
553 support the requested format,
555 will probably see the error as a failure to complete the request.
557 The format options are:
560 Print out the list as logical blocks.
561 This is limited to 32-bit block sizes, and isn't supported by many modern
564 Print out the list as logical blocks.
565 This option uses a 64-bit block size.
567 Print out the list in bytes from index format.
569 Print out the list in extended bytes from index format.
570 The extended format allows for ranges of blocks to be printed.
572 Print out the list in physical sector format.
573 Most drives support this format.
575 Print out the list in extended physical sector format.
576 The extended format allows for ranges of blocks to be printed.
579 Print out the grown defect list.
580 This is a list of bad blocks that have
581 been remapped since the disk left the factory.
583 Print out the primary defect list.
584 This is the list of defects that were present in the factory.
586 When printing status information with
588 only print the number of defects.
590 Just print the number of defects, not the list of defects.
592 Specify the starting offset into the defect list.
593 This implies using the
595 READ DEFECT DATA (12) command, as the 10 byte version of the command
596 doesn't support the address descriptor index field.
597 Not all drives support the 12 byte command, and some drives that support
598 the 12 byte command don't support the address descriptor index field.
600 Print out defects in hexadecimal (base 16) form instead of base 10 form.
609 will print out the number of defects given in the READ DEFECT DATA header
610 returned from the drive.
611 Some drives will report 0 defects if neither the primary or grown defect
614 Allows the user to display and optionally edit a SCSI mode page.
616 page formats are located in
617 .Pa /usr/share/misc/scsi_modes .
618 This can be overridden by specifying a different file in the
620 environment variable.
623 command takes several arguments:
626 Disable block descriptors for mode sense.
628 Displays mode page data in binary format.
630 This flag allows the user to edit values in the mode page.
632 either edit mode page values with the text editor pointed to by his
634 environment variable, or supply mode page values via standard input, using
637 uses to display mode page values.
638 The editor will be invoked if
640 detects that standard input is terminal.
642 Lists all available mode pages.
643 .It Fl m Ar mode_page
644 This specifies the number of the mode page the user would like to view
646 This argument is mandatory unless
650 This allows the user to specify the page control field.
652 .Bl -tag -width xxx -compact
664 Allows the user to send an arbitrary ATA or SCSI CDB to any device.
667 function requires the
669 argument to specify SCSI CDB or the
671 argument to specify ATA Command Block registers values.
672 Other arguments are optional, depending on
674 The command and data specification syntax is documented
677 NOTE: If the CDB specified causes data to be transferred to or from the
678 SCSI device in question, you MUST specify either
683 .It Fl a Ar cmd Op args
684 This specifies the content of 12 ATA Command Block registers (command,
685 features, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp.
686 lba_high_exp, features_exp, sector_count, sector_count_exp).
687 .It Fl c Ar cmd Op args
688 This specifies the SCSI CDB.
689 SCSI CDBs may be 6, 10, 12 or 16 bytes.
691 Specifies DMA protocol to be used for ATA command.
693 Specifies FPDMA (NCQ) protocol to be used for ATA command.
694 .It Fl i Ar len Ar fmt
695 This specifies the amount of data to read, and how it should be displayed.
699 bytes of data will be read from the device and written to standard output.
700 .It Fl o Ar len Ar fmt Op args
701 This specifies the amount of data to be written to a device, and the data
702 that is to be written.
706 bytes of data will be read from standard input and written to the device.
708 This specifies that 11 result ATA Command Block registers should be displayed
709 (status, error, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp,
710 lba_high_exp, sector_count, sector_count_exp), and how.
713 11 result registers will be written to standard output in hex.
716 Allows the user to send an arbitrary Serial
717 Management Protocol (SMP) command to a device.
720 function requires the
722 argument to specify the SMP request to be sent, and the
724 argument to specify the format of the SMP response.
725 The syntax for the SMP request and response arguments is documented in
728 Note that SAS adapters that support SMP passthrough (at least the currently
729 known adapters) do not accept CRC bytes from the user in the request and do
730 not pass CRC bytes back to the user in the response.
731 Therefore users should not include the CRC bytes in the length of the
732 request and not expect CRC bytes to be returned in the response.
734 .It Fl r Ar len Ar fmt Op args
735 This specifies the size of the SMP request, without the CRC bytes, and the
740 bytes of data will be read from standard input and written as the SMP
742 .It Fl R Ar len Ar fmt Op args
743 This specifies the size of the buffer allocated for the SMP response, and
744 the SMP response format.
748 bytes of data will be allocated for the response and the response will be
749 written to standard output.
752 Allows the user to send the Serial Management Protocol (SMP) Report General
755 will display the data returned by the Report General command.
756 If the SMP target supports the long response format, the additional data
757 will be requested and displayed automatically.
760 Request the long response format only.
761 Not all SMP targets support the long response format.
764 to skip sending the initial report general request without the long bit set
765 and only issue a report general request with the long bit set.
768 Allows the user to issue the Serial Management Protocol (SMP) PHY Control
770 This function should be used with some caution, as it can render devices
771 inaccessible, and could potentially cause data corruption as well.
774 argument is required to specify the PHY to operate on.
777 Specify the PHY to operate on.
778 This argument is required.
780 Request the long request/response format.
781 Not all SMP targets support the long response format.
782 For the PHY Control command, this currently only affects whether the
783 request length is set to a value other than 0.
784 .It Fl o Ar operation
785 Specify a PHY control operation.
788 operation may be specified.
789 The operation may be specified numerically (in decimal, hexadecimal, or octal)
790 or one of the following operation names may be specified:
794 It is not necessary to specify this argument.
796 Send the LINK RESET command to the phy.
798 Send the HARD RESET command to the phy.
800 Send the DISABLE command to the phy.
801 Note that the LINK RESET or HARD RESET commands should re-enable the phy.
803 Send the CLEAR ERROR LOG command.
804 This clears the error log counters for the specified phy.
806 Send the CLEAR AFFILIATION command.
807 This clears the affiliation from the STP initiator port with the same SAS
808 address as the SMP initiator that requests the clear operation.
810 Send the TRANSMIT SATA PORT SELECTION SIGNAL command to the phy.
811 This will cause a SATA port selector to use the given phy as its active phy
812 and make the other phy inactive.
814 Send the CLEAR STP I_T NEXUS LOSS command to the PHY.
816 Send the SET ATTACHED DEVICE NAME command to the PHY.
819 argument to specify the device name.
822 Specify the attached device name.
823 This option is needed with the
826 The name is a 64-bit number, and can be specified in decimal, hexadecimal
829 Set the minimum physical link rate for the phy.
830 This is a numeric argument.
831 Currently known link rates are:
834 Do not change current value.
843 Other values may be specified for newer physical link rates.
845 Set the maximum physical link rate for the phy.
846 This is a numeric argument.
849 argument description for known link rate arguments.
850 .It Fl T Ar pp_timeout
851 Set the partial pathway timeout value, in microseconds.
856 specification for more information on this field.
857 .It Fl a Ar enable|disable
858 Enable or disable SATA slumber phy power conditions.
859 .It Fl A Ar enable|disable
860 Enable or disable SATA partial power conditions.
861 .It Fl s Ar enable|disable
862 Enable or disable SAS slumber phy power conditions.
863 .It Fl S Ar enable|disable
864 Enable or disable SAS partial phy power conditions.
867 List phys attached to a SAS expander, the address of the end device
868 attached to the phy, and the inquiry data for that device and peripheral
869 devices attached to that device.
870 The inquiry data and peripheral devices are displayed if available.
873 Turn on the long response format for the underlying SMP commands used for
876 Only print out phys that are attached to a device in the CAM EDT (Existing
880 Send the SMP Report Manufacturer Information command to the device and
881 display the response.
884 Turn on the long response format for the underlying SMP commands used for
888 Turn on CAM debugging printfs in the kernel.
889 This requires options CAMDEBUG
890 in your kernel config file.
891 WARNING: enabling debugging printfs currently
892 causes an EXTREME number of kernel printfs.
893 You may have difficulty
894 turning off the debugging printfs once they start, since the kernel will be
895 busy printing messages and unable to service other requests quickly.
898 function takes a number of arguments:
901 Enable CAM_DEBUG_INFO printfs.
903 Enable CAM_DEBUG_PERIPH printfs.
905 Enable CAM_DEBUG_TRACE printfs.
907 Enable CAM_DEBUG_SUBTRACE printfs.
909 Enable CAM_DEBUG_XPT printfs.
911 Enable CAM_DEBUG_CDB printfs.
912 This will cause the kernel to print out the
913 SCSI CDBs sent to the specified device(s).
915 Enable CAM_DEBUG_PROBE printfs.
917 Enable debugging for all devices.
919 Turn off debugging for all devices
920 .It bus Ns Op :target Ns Op :lun
921 Turn on debugging for the given bus, target or lun.
923 and lun are not specified, they are wildcarded.
924 (i.e., just specifying a
925 bus turns on debugging printfs for all devices on that bus.)
928 Show or set the number of "tagged openings" or simultaneous transactions
929 we attempt to queue to a particular device.
932 command, with no command-specific arguments (i.e., only generic arguments)
933 prints out the "soft" maximum number of transactions that can be queued to
934 the device in question.
935 For more detailed information, use the
937 argument described below.
940 Set the number of tags for the given device.
941 This must be between the
942 minimum and maximum number set in the kernel quirk table.
944 most devices that support tagged queueing is a minimum of 2 and a maximum
946 The minimum and maximum values for a given device may be
947 determined by using the
954 subcommand is described below.
956 Be quiet, and do not report the number of tags.
957 This is generally used when
958 setting the number of tags.
960 The verbose flag has special functionality for the
965 to print out the tagged queueing related fields of the XPT_GDEV_TYPE CCB:
968 This is the amount of capacity for transactions queued to a given device.
970 This is the number of transactions currently queued to a device.
972 This is the kernel queue space for transactions.
973 This count usually mirrors
974 dev_openings except during error recovery operations when
975 the device queue is frozen (device is not allowed to receive
976 commands), the number of dev_openings is reduced, or transaction
979 This is the number of transactions waiting in the kernel queue for capacity
981 This number is usually zero unless error recovery is in
984 The held count is the number of CCBs held by peripheral drivers that have
985 either just been completed or are about to be released to the transport
986 layer for service by a device.
987 Held CCBs reserve capacity on a given
990 This is the current "hard" minimum number of transactions that can be
991 queued to a device at once.
994 value above cannot go below this number.
995 The default value for
997 is 2, although it may be set higher or lower for various devices.
999 This is the "hard" maximum number of transactions that can be queued to a
1003 value cannot go above this number.
1004 The default value for
1006 is 255, although it may be set higher or lower for various devices.
1010 Show or negotiate various communication parameters.
1011 Some controllers may
1012 not support setting or changing some of these values.
1014 Adaptec 174x controllers do not support changing a device's sync rate or
1019 will not attempt to set the parameter if the controller indicates that it
1020 does not support setting the parameter.
1021 To find out what the controller
1029 command is described below.
1030 Also, some controller drivers do not support
1031 setting negotiation parameters, even if the underlying controller supports
1032 negotiation changes.
1033 Some controllers, such as the Advansys wide
1034 controllers, support enabling and disabling synchronous negotiation for
1035 a device, but do not support setting the synchronous negotiation rate.
1038 Attempt to make the negotiation settings take effect immediately by sending
1039 a Test Unit Ready command to the device.
1041 Show or set current negotiation settings.
1042 This is the default.
1043 .It Fl D Ar enable|disable
1044 Enable or disable disconnection.
1048 Set the command delay offset.
1050 Be quiet, do not print anything.
1051 This is generally useful when you want to
1052 set a parameter, but do not want any status information.
1053 .It Fl R Ar syncrate
1054 Change the synchronization rate for a device.
1055 The sync rate is a floating
1056 point value specified in MHz.
1059 is a legal value, as is
1061 .It Fl T Ar enable|disable
1062 Enable or disable tagged queueing for a device.
1064 Show or set user negotiation settings.
1065 The default is to show or set
1066 current negotiation settings.
1068 The verbose switch has special meaning for the
1073 to print out the contents of a Path Inquiry (XPT_PATH_INQ) CCB sent to the
1075 .It Fl W Ar bus_width
1076 Specify the bus width to negotiate with a device.
1079 The only useful values to specify are 8, 16, and 32
1081 The controller must support the bus width in question in order for
1082 the setting to take effect.
1085 In general, sync rate and offset settings will not take effect for a
1086 device until a command has been sent to the device.
1089 switch above will automatically send a Test Unit Ready to the device so
1090 negotiation parameters will take effect.
1094 FORMAT UNIT command to the named device.
1096 .Em WARNING! WARNING! WARNING!
1098 Low level formatting a disk will destroy ALL data on the disk.
1100 extreme caution when issuing this command.
1101 Many users low-level format
1102 disks that do not really need to be low-level formatted.
1104 relatively few scenarios that call for low-level formatting a disk.
1106 low-level formatting a disk is to initialize the disk after changing
1107 its physical sector size.
1108 Another reason for low-level formatting a disk
1109 is to revive the disk if you are getting "medium format corrupted" errors
1110 from the disk in response to read and write requests.
1112 Some disks take longer than others to format.
1113 Users should specify a
1114 timeout long enough to allow the format to complete.
1116 timeout is 3 hours, which should be long enough for most disks.
1118 disks will complete a format operation in a very short period of time
1119 (on the order of 5 minutes or less).
1120 This is often because the drive
1121 does not really support the FORMAT UNIT command -- it just accepts the
1122 command, waits a few minutes and then returns it.
1126 subcommand takes several arguments that modify its default behavior.
1131 arguments can be useful for scripts.
1134 Be quiet, do not print any status messages.
1135 This option will not disable
1136 the questions, however.
1137 To disable questions, use the
1144 This will report status on a format that is already running on the drive.
1146 Issue a non-immediate format command.
1149 issues the FORMAT UNIT command with the immediate bit set.
1151 device to immediately return the format command, before the format has
1157 sense information from the device every second to determine how far along
1158 in the format process it is.
1161 argument is specified,
1163 will issue a non-immediate format command, and will be unable to print any
1164 information to let the user know what percentage of the disk has been
1167 Do not ask any questions.
1170 will ask the user if he/she really wants to format the disk in question,
1171 and also if the default format command timeout is acceptable.
1173 will not be asked about the timeout if a timeout is specified on the
1179 SANITIZE command to the named device.
1181 .Em WARNING! WARNING! WARNING!
1183 ALL data in the cache and on the disk will be destroyed or made inaccessible.
1184 Recovery of the data is not possible.
1185 Use extreme caution when issuing this command.
1189 subcommand takes several arguments that modify its default behavior.
1194 arguments can be useful for scripts.
1196 .It Fl a Ar operation
1197 Specify the sanitize operation to perform.
1200 Perform an overwrite operation by writing a user supplied
1201 data pattern to the device one or more times.
1202 The pattern is given by the
1205 The number of times is given by the
1209 Perform a block erase operation.
1210 All the device's blocks are set to a vendor defined
1211 value, typically zero.
1213 Perform a cryptographic erase operation.
1214 The encryption keys are changed to prevent the decryption
1217 Exits a previously failed sanitize operation.
1218 A failed sanitize operation can only be exited if it was
1219 run in the unrestricted completion mode, as provided by the
1224 The number of passes when performing an
1227 Valid values are between 1 and 31.
1232 operation, the pattern is inverted between consecutive passes.
1234 Path to the file containing the pattern to use when
1238 The pattern is repeated as needed to fill each block.
1240 Be quiet, do not print any status messages.
1241 This option will not disable
1242 the questions, however.
1243 To disable questions, use the
1247 Perform the sanitize in the unrestricted completion mode.
1248 If the operation fails, it can later be exited with the
1255 This will report status on a sanitize that is already running on the drive.
1257 Issue a non-immediate sanitize command.
1260 issues the SANITIZE command with the immediate bit set.
1262 device to immediately return the sanitize command, before
1263 the sanitize has actually completed.
1268 sense information from the device every second to determine how far along
1269 in the sanitize process it is.
1272 argument is specified,
1274 will issue a non-immediate sanitize command, and will be unable to print any
1275 information to let the user know what percentage of the disk has been
1278 Do not ask any questions.
1281 will ask the user if he/she really wants to sanitize the disk in question,
1282 and also if the default sanitize command timeout is acceptable.
1284 will not be asked about the timeout if a timeout is specified on the
1288 Put ATA device into IDLE state.
1291 specifies automatic standby timer value in seconds.
1292 Value 0 disables timer.
1294 Put ATA device into STANDBY state.
1297 specifies automatic standby timer value in seconds.
1298 Value 0 disables timer.
1300 Put ATA device into SLEEP state.
1301 Note that the only way get device out of
1302 this state may be reset.
1304 It optional parameter
1306 specified, enables and sets advanced power management level, where
1307 1 -- minimum power, 127 -- maximum performance with standby,
1308 128 -- minimum power without standby, 254 -- maximum performance.
1309 If not specified -- APM is disabled.
1311 It optional parameter
1313 specified, enables and sets automatic acoustic management level, where
1314 1 -- minimum noise, 254 -- maximum performance.
1315 If not specified -- AAM is disabled.
1317 Update or report security settings, using an ATA identify command (0xec).
1320 will print out the security support and associated settings of the device.
1323 command takes several arguments:
1327 Disable device security using the given password for the selected user according
1328 to the devices configured security level.
1331 Erase the device using the given password for the selected user.
1333 .Em WARNING! WARNING! WARNING!
1335 Issuing a secure erase will
1337 user data on the device and may take several hours to complete.
1339 When this command is used against an SSD drive all its cells will be marked as
1340 empty, restoring it to factory default write performance.
1341 For SSD's this action
1342 usually takes just a few seconds.
1345 Freeze the security configuration of the specified device.
1347 After command completion any other commands that update the device lock mode
1348 shall be command aborted.
1349 Frozen mode is disabled by power-off or hardware reset.
1352 Enhanced erase the device using the given password for the selected user.
1354 .Em WARNING! WARNING! WARNING!
1356 Issuing an enhanced secure erase will
1358 user data on the device and may take several hours to complete.
1360 An enhanced erase writes predetermined data patterns to all user data areas,
1361 all previously written user data shall be overwritten, including sectors that
1362 are no longer in use due to reallocation.
1365 Unlock the device using the given password for the selected user according to
1366 the devices configured security level.
1367 .It Fl l Ar high|maximum
1369 Specifies which security level to set when issuing a
1372 The security level determines device behavior when the master
1373 password is used to unlock the device.
1374 When the security level is set to high
1375 the device requires the unlock command and the master password to unlock.
1376 When the security level is set to maximum the device requires a secure erase
1377 with the master password to unlock.
1379 This option must be used in conjunction with one of the security action commands.
1385 Be quiet, do not print any status messages.
1386 This option will not disable the questions, however.
1387 To disable questions, use the
1392 Password the device (enable security) using the given password for the selected
1394 This option can be combined with other options such as
1397 A master password may be set in a addition to the user password. The purpose of
1398 the master password is to allow an administrator to establish a password that
1399 is kept secret from the user, and which may be used to unlock the device if the
1400 user password is lost.
1403 Setting the master password does not enable device security.
1405 If the master password is set and the drive supports a Master Revision Code
1406 feature the Master Password Revision Code will be decremented.
1409 Overrides the default timeout, specified in seconds, used for both
1413 this is useful if your system has problems processing long timeouts correctly.
1415 Usually the timeout is calculated from the information stored on the drive if
1416 present, otherwise it defaults to 2 hours.
1417 .It Fl U Ar user|master
1419 Specifies which user to set / use for the running action command, valid values
1420 are user or master and defaults to master if not set.
1422 This option must be used in conjunction with one of the security action commands.
1428 Confirm yes to dangerous options such as
1430 without prompting for confirmation.
1433 If the password specified for any action commands does not match the configured
1434 password for the specified user the command will fail.
1436 The password in all cases is limited to 32 characters, longer passwords will
1439 Update or report Host Protected Area details.
1442 will print out the HPA support and associated settings of the device.
1445 command takes several optional arguments:
1449 Freeze the HPA configuration of the specified device.
1451 After command completion any other commands that update the HPA configuration
1452 shall be command aborted.
1453 Frozen mode is disabled by power-off or hardware reset.
1456 Lock the HPA configuration of the device until a successful call to unlock or
1457 the next power-on reset occurs.
1460 Make the HPA max sectors persist across power-on reset or a hardware reset.
1461 This must be used in combination with
1462 .Fl s Ar max_sectors
1466 Set the HPA configuration password required for unlock calls.
1469 Be quiet, do not print any status messages.
1470 This option will not disable the questions.
1471 To disable questions, use the
1474 .It Fl s Ar max_sectors
1476 Configures the maximum user accessible sectors of the device.
1477 This will change the number of sectors the device reports.
1479 .Em WARNING! WARNING! WARNING!
1481 Changing the max sectors of a device using this option will make the data on
1482 the device beyond the specified value inaccessible.
1485 .Fl s Ar max_sectors
1486 call can be made without a power-on reset or a hardware reset of the device.
1489 Unlock the HPA configuration of the specified device using the given password.
1490 If the password specified does not match the password configured via
1492 the command will fail.
1494 After 5 failed unlock calls, due to password miss-match, the device will refuse
1495 additional unlock calls until after a power-on reset.
1498 Confirm yes to dangerous options such as
1500 without prompting for confirmation
1503 The password for all HPA commands is limited to 32 characters, longer passwords
1506 Program firmware of the named SCSI device using the image file provided.
1508 Current list of supported vendors:
1509 .Bl -bullet -offset indent -compact
1526 .Em WARNING! WARNING! WARNING!
1528 Little testing has been done to make sure that different device models from
1529 each vendor work correctly with the fwdownload command.
1530 A vendor name appearing in the supported list means only that firmware of at
1531 least one device type from that vendor has successfully been programmed with
1532 the fwdownload command.
1533 Extra caution should be taken when using this command since there is no
1534 guarantee it will not break a device from the listed vendors.
1535 Ensure that you have a recent backup of the data on the device before
1536 performing a firmware update.
1538 .It Fl f Ar fw_image
1539 Path to the firmware image file to be downloaded to the specified device.
1541 Do not ask for confirmation.
1543 Run in simulation mode.
1544 Packet sizes that will be sent are shown, but no actual packet is sent to the
1546 No confirmation is asked in simulation mode.
1548 Besides showing sense information in case of a failure, the verbose option
1551 to output a line for every firmware segment that is sent to the device by the
1553 -- the same as the ones shown in simulation mode.
1556 Persistent reservation support.
1557 Persistent reservations are a way to reserve a particular
1559 LUN for use by one or more
1564 option is specified,
1568 PERSISTENT RESERVE IN
1569 command using the requested service action.
1572 option is specified,
1576 PERSISTENT RESERVE OUT
1577 command using the requested service action.
1578 One of those two options is required.
1580 Persistent reservations are complex, and fully explaining them is outside
1581 the scope of this manual.
1584 and download the latest SPC spec for a full explanation of persistent
1588 Specify the service action for the PERSISTENT RESERVE IN command.
1589 Supported service actions:
1592 Report the current persistent reservation generation (PRgeneration) and any
1594 .It read_reservation
1595 Report the persistent reservation, if any.
1596 .It report_capabilities
1597 Report the persistent reservation capabilities of the LUN.
1598 .It read_full_status
1599 Report the full status of persistent reservations on the LUN.
1602 Specify the service action for the PERSISTENT RESERVE OUT command.
1603 For service actions like register that are components of other service
1604 action names, the entire name must be specified.
1605 Otherwise, enough of the service action name must be specified to
1606 distinguish it from other possible service actions.
1607 Supported service actions:
1610 Register a reservation key with the LUN or unregister a reservation key.
1611 To register a key, specify the requested key as the Service Action
1613 To unregister a key, specify the previously registered key as the
1615 To change a key, specify the old key as the Reservation Key and the new
1616 key as the Service Action Reservation Key.
1618 This is similar to the register subcommand, except that the Reservation Key
1620 The Service Action Reservation Key will overwrite any previous key
1621 registered for the initiator.
1623 Create a reservation.
1624 A key must be registered with the LUN before the LUN can be reserved, and
1625 it must be specified as the Reservation Key.
1626 The type of reservation must also be specified.
1627 The scope defaults to LUN scope (LU_SCOPE), but may be changed.
1629 Release a reservation.
1630 The Reservation Key must be specified.
1632 Release a reservation and remove all keys from the device.
1633 The Reservation Key must be specified.
1635 Remove a reservation belonging to another initiator.
1636 The Reservation Key must be specified.
1637 The Service Action Reservation Key may be specified, depending on the
1638 operation being performed.
1640 Remove a reservation belonging to another initiator and abort all
1641 outstanding commands from that initiator.
1642 The Reservation Key must be specified.
1643 The Service Action Reservation Key may be specified, depending on the
1644 operation being performed.
1646 Register another initiator with the LUN, and establish a reservation on the
1647 LUN for that initiator.
1648 The Reservation Key and Service Action Reservation Key must be specified.
1650 Replace Lost Reservation information.
1653 Set the All Target Ports (ALL_TG_PT) bit.
1654 This requests that the key registration be applied to all target ports and
1655 not just the particular target port that receives the command.
1656 This only applies to the register and register_ignore actions.
1658 Specify a Transport ID.
1659 This only applies to the Register and Register and Move service actions for
1660 Persistent Reserve Out.
1661 Multiple Transport IDs may be specified with multiple
1664 With the Register service action, specifying one or more Transport IDs
1665 implicitly enables the
1667 option which turns on the SPEC_I_PT bit.
1668 Transport IDs generally have the format protocol,id.
1671 A SAS Transport ID consists of
1673 followed by a 64-bit SAS address.
1676 .Dl sas,0x1234567812345678
1678 A Fibre Channel Transport ID consists of
1680 followed by a 64-bit Fibre Channel World Wide Name.
1683 .Dl fcp,0x1234567812345678
1685 A Parallel SCSI address consists of
1687 followed by a SCSI target ID and a relative target port identifier.
1692 An IEEE 1394 (Firewire) Transport ID consists of
1694 followed by a 64-bit EUI-64 IEEE 1394 node unique identifier.
1697 .Dl sbp,0x1234567812345678
1699 A SCSI over RDMA Transport ID consists of
1701 followed by a 128-bit RDMA initiator port identifier.
1702 The port identifier must be exactly 32 or 34 (if the leading 0x is
1703 included) hexadecimal digits.
1704 Only hexadecimal (base 16) numbers are supported.
1707 .Dl srp,0x12345678123456781234567812345678
1709 An iSCSI Transport ID consists an iSCSI name and optionally a separator and
1711 For example, if only the iSCSI name is specified:
1713 .Dl iqn.2012-06.com.example:target0
1715 If the iSCSI separator and initiator session ID are specified:
1717 .Dl iqn.2012-06.com.example:target0,i,0x123
1719 A SCSI over PCIe Transport ID consists of
1721 followed by a PCIe Routing ID.
1722 The Routing ID consists of a bus, device and function or in the alternate
1723 form, a bus and function.
1724 The bus must be in the range of 0 to 255 inclusive and the device must be
1725 in the range of 0 to 31 inclusive.
1726 The function must be in the range of 0 to 7 inclusive if the standard form
1727 is used, and in the range of 0 to 255 inclusive if the alternate form is
1729 For example, if a bus, device and function are specified for the standard
1734 If the alternate Routing ID form is used:
1739 Specify the Reservation Key.
1740 This may be in decimal, octal or hexadecimal format.
1741 The value is zero by default if not otherwise specified.
1742 The value must be between 0 and 2^64 - 1, inclusive.
1744 Specify the Service Action Reservation Key.
1745 This may be in decimal, octal or hexadecimal format.
1746 The value is zero by default if not otherwise specified.
1747 The value must be between 0 and 2^64 - 1, inclusive.
1749 Enable the Activate Persist Through Power Loss bit.
1750 This is only used for the register and register_ignore actions.
1751 This requests that the reservation persist across power loss events.
1753 Specify the scope of the reservation.
1754 The scope may be specified by name or by number.
1755 The scope is ignored for register, register_ignore and clear.
1756 If the desired scope isn't available by name, you may specify the number.
1760 This encompasses the entire LUN.
1762 Extent scope (0x01).
1764 Element scope (0x02).
1767 Specify the Relative Target Port.
1768 This only applies to the Register and Move service action of the Persistent
1769 Reserve Out command.
1771 Enable the SPEC_I_PT bit.
1772 This only applies to the Register service action of Persistent Reserve Out.
1773 You must also specify at least one Transport ID with
1775 if this option is set.
1776 If you specify a Transport ID, this option is automatically set.
1777 It is an error to specify this option for any service action other than
1780 Specify the reservation type.
1781 The reservation type may be specified by name or by number.
1782 If the desired reservation type isn't available by name, you may specify
1784 Supported reservation type names:
1789 Write Exclusive mode.
1790 May also be specified as
1791 .Dq write_exclusive .
1793 Read Exclusive mode.
1794 May also be specified as
1795 .Dq read_exclusive .
1797 Exclusive access mode.
1798 May also be specified as
1799 .Dq exclusive_access .
1801 Write Exclusive Registrants Only mode.
1802 May also be specified as
1803 .Dq write_exclusive_reg_only .
1805 Exclusive Access Registrants Only mode.
1806 May also be specified as
1807 .Dq exclusive_access_reg_only .
1809 Write Exclusive All Registrants mode.
1810 May also be specified as
1811 .Dq write_exclusive_all_regs .
1813 Exclusive Access All Registrants mode.
1814 May also be specified as
1815 .Dq exclusive_access_all_regs .
1818 Specify that the target should unregister the initiator that sent
1819 the Register and Move request.
1820 By default, the target will not unregister the initiator that sends the
1821 Register and Move request.
1822 This option only applies to the Register and Move service action of the
1823 Persistent Reserve Out command.
1826 Print out verbose usage information.
1831 variable allows the user to specify an alternate mode page format file.
1835 variable determines which text editor
1837 starts when editing mode pages.
1839 .Bl -tag -width /usr/share/misc/scsi_modes -compact
1840 .It Pa /usr/share/misc/scsi_modes
1841 is the SCSI mode format database.
1843 is the transport layer device.
1845 are the CAM application passthrough devices.
1848 .Dl camcontrol eject -n cd -u 1 -v
1850 Eject the CD from cd1, and print SCSI sense information if the command
1853 .Dl camcontrol tur da0
1855 Send the SCSI test unit ready command to da0.
1858 utility will report whether the disk is ready, but will not display sense
1859 information if the command fails since the
1861 switch was not specified.
1862 .Bd -literal -offset indent
1863 camcontrol tur da1 -E -C 4 -t 50 -v
1866 Send a test unit ready command to da1.
1867 Enable kernel error recovery.
1868 Specify a retry count of 4, and a timeout of 50 seconds.
1872 flag) if the command fails.
1873 Since error recovery is turned on, the
1874 disk will be spun up if it is not currently spinning.
1877 utility will report whether the disk is ready.
1878 .Bd -literal -offset indent
1879 camcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \e
1880 -i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1"
1883 Issue a READ BUFFER command (0x3C) to cd1.
1884 Display the buffer size of cd1,
1885 and display the first 10 bytes from the cache on cd1.
1887 information if the command fails.
1888 .Bd -literal -offset indent
1889 camcontrol cmd -n cd -u 1 -v -c "3B 00 00 00 00 00 00 00 0e 00" \e
1890 -o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8
1893 Issue a WRITE BUFFER (0x3B) command to cd1.
1894 Write out 10 bytes of data,
1895 not including the (reserved) 4 byte header.
1896 Print out sense information if
1898 Be very careful with this command, improper use may
1899 cause data corruption.
1900 .Bd -literal -offset indent
1901 camcontrol modepage da3 -m 1 -e -P 3
1904 Edit mode page 1 (the Read-Write Error Recover page) for da3, and save the
1905 settings on the drive.
1906 Mode page 1 contains a disk drive's auto read and
1907 write reallocation settings, among other things.
1909 .Dl camcontrol rescan all
1911 Rescan all SCSI busses in the system for devices that have been added,
1914 .Dl camcontrol rescan 0
1916 Rescan SCSI bus 0 for devices that have been added, removed or changed.
1918 .Dl camcontrol rescan 0:1:0
1920 Rescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or
1923 .Dl camcontrol tags da5 -N 24
1925 Set the number of concurrent transactions for da5 to 24.
1926 .Bd -literal -offset indent
1927 camcontrol negotiate -n da -u 4 -T disable
1930 Disable tagged queueing for da4.
1931 .Bd -literal -offset indent
1932 camcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a
1935 Negotiate a sync rate of 20MHz and an offset of 15 with da3.
1937 Test Unit Ready command to make the settings take effect.
1938 .Bd -literal -offset indent
1939 camcontrol smpcmd ses0 -v -r 4 "40 0 00 0" -R 1020 "s9 i1"
1942 Send the SMP REPORT GENERAL command to ses0, and display the number of PHYs
1944 Display SMP errors if the command fails.
1945 .Bd -literal -offset indent
1946 camcontrol security ada0
1949 Report security support and settings for ada0
1950 .Bd -literal -offset indent
1951 camcontrol security ada0 -U user -s MyPass
1954 Enable security on device ada0 with the password MyPass
1955 .Bd -literal -offset indent
1956 camcontrol security ada0 -U user -e MyPass
1959 Secure erase ada0 which has had security enabled with user password MyPass
1961 .Em WARNING! WARNING! WARNING!
1965 data from the device, so backup your data before using!
1967 This command can be used against an SSD drive to restoring it to
1968 factory default write performance.
1969 .Bd -literal -offset indent
1973 Report HPA support and settings for ada0 (also reported via
1975 .Bd -literal -offset indent
1976 camcontrol hpa ada0 -s 10240
1979 Enables HPA on ada0 setting the maximum reported sectors to 10240.
1981 .Em WARNING! WARNING! WARNING!
1985 to all data on the device beyond this limit until HPA is disabled by setting
1986 HPA to native max sectors of the device, which can only be done after a
1987 power-on or hardware reset!
1990 use this on a device which has an active filesystem!
1991 .Bd -literal -offset indent
1992 camcontrol persist da0 -v -i read_keys
1995 This will read any persistent reservation keys registered with da0, and
1996 display any errors encountered when sending the PERSISTENT RESERVE IN
1999 .Bd -literal -offset indent
2000 camcontrol persist da0 -v -o register -a -K 0x12345678
2003 This will register the persistent reservation key 0x12345678 with da0,
2004 apply that registration to all ports on da0, and display any errors that
2005 occur when sending the PERSISTENT RESERVE OUT command.
2006 .Bd -literal -offset indent
2007 camcontrol persist da0 -v -o reserve -s lun -k 0x12345678 -T ex_ac
2010 This will reserve da0 for the exlusive use of the initiator issuing the
2012 The scope of the reservation is the entire LUN.
2013 Any errors sending the PERSISTENT RESERVE OUT command will be displayed.
2014 .Bd -literal -offset indent
2015 camcontrol persist da0 -v -i read_full
2018 This will display the full status of all reservations on da0 and print out
2019 status if there are any errors.
2020 .Bd -literal -offset indent
2021 camcontrol persist da0 -v -o release -k 0x12345678 -T ex_ac
2024 This will release a reservation on da0 of the type ex_ac
2026 The Reservation Key for this registration is 0x12345678.
2027 Any errors that occur will be displayed.
2028 .Bd -literal -offset indent
2029 camcontrol persist da0 -v -o register -K 0x12345678 -S \e
2030 -I sas,0x1234567812345678 -I sas,0x8765432187654321
2033 This will register the key 0x12345678 with da0, specifying that it applies
2034 to the SAS initiators with SAS addresses 0x1234567812345678 and
2036 .Bd -literal -offset indent
2037 camcontrol persist da0 -v -o register_move -k 0x87654321 \e
2038 -K 0x12345678 -U -p -R 2 -I fcp,0x1234567812345678
2041 This will move the registration from the current initiator, whose
2042 Registration Key is 0x87654321, to the Fibre Channel initiator with the
2043 Fiber Channel World Wide Node Name 0x1234567812345678.
2044 A new registration key, 0x12345678, will be registered for the initiator
2045 with the Fibre Channel World Wide Node Name 0x1234567812345678, and the
2046 current initiator will be unregistered from the target.
2047 The reservation will be moved to relative target port 2 on the target
2049 The registration will persist across power losses.
2052 .Xr cam_cdbparse 3 ,
2059 utility first appeared in
2062 The mode page editing code and arbitrary SCSI command code are based upon
2067 library, written by Julian Elischer and Peter Dufault.
2070 program first appeared in
2072 and first appeared in
2077 .An Kenneth Merry Aq Mt ken@FreeBSD.org
2079 The code that parses the generic command line arguments does not know that
2080 some of the subcommands take multiple arguments.
2081 So if, for instance, you
2082 tried something like this:
2083 .Bd -literal -offset indent
2084 camcontrol cmd -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v
2087 The sense information from the test unit ready command would not get
2088 printed out, since the first
2092 bails out when it sees the second argument to
2096 Fixing this behavior would take some gross code, or changes to the
2099 The best way to circumvent this problem is to always make sure
2102 arguments before any command-specific arguments.