CAMCONTROL(8) | MidnightBSD System Manager's Manual | CAMCONTROL(8) |
camcontrol
— CAM
control program
camcontrol |
⟨command⟩ [device id] [generic args] [command args] |
camcontrol |
devlist [-b ]
[-v ] |
camcontrol |
periphlist [device id]
[-n dev_name]
[-u unit_number] |
camcontrol |
tur [device id] [generic args] |
camcontrol |
inquiry [device id] [generic args]
[-D ] [-S ]
[-R ] |
camcontrol |
identify [device id] [generic args]
[-v ] |
camcontrol |
reportluns [device id] [generic args]
[-c ] [-l ]
[-r reporttype] |
camcontrol |
readcap [device id] [generic args]
[-b ] [-h ]
[-H ] [-l ]
[-N ] [-q ]
[-s ] |
camcontrol |
start [device id] [generic args] |
camcontrol |
stop [device id] [generic args] |
camcontrol |
load [device id] [generic args] |
camcontrol |
eject [device id] [generic args] |
camcontrol |
reprobe [device id] |
camcontrol |
rescan ⟨all | device id |
bus[:target:lun]⟩ |
camcontrol |
reset ⟨all | device id |
bus[:target:lun]⟩ |
camcontrol |
defects [device id] [generic args]
⟨-f format⟩
[-P ] [-G ]
[-q ] [-s ]
[-S offset]
[-X ] |
camcontrol |
modepage [device id] [generic args]
[-6 ] ⟨-m
page[,subpage] | -l ⟩
[-P pgctl]
[-D ] [-L ]
[-b | -e ]
[-d ] |
camcontrol |
cmd [device id] [generic args]
⟨-a cmd
[args]⟩ ⟨-c
cmd [args]⟩ [-d ]
[-f ] [-i
len fmt]
[-o len fmt [args]]
[-r fmt] |
camcontrol |
smpcmd [device id] [generic args]
⟨-r len
fmt [args]⟩
⟨-R len
fmt [args]⟩ |
camcontrol |
smprg [device id] [generic args]
[-l ] |
camcontrol |
smppc [device id] [generic args]
⟨-p phy⟩
[-l ] [-o
operation] [-d
name] [-m
rate] [-M
rate] [-T
pp_timeout] [-a
enable|disable] [-A
enable|disable] [-s
enable|disable] [-S
enable|disable] |
camcontrol |
smpphylist [device id] [generic args]
[-l ] [-q ] |
camcontrol |
smpmaninfo [device id] [generic args]
[-l ] |
camcontrol |
debug [-I ]
[-P ] [-T ]
[-S ] [-X ]
[-c ] [-p ] ⟨all |
off | device id | bus[:target[:lun]]⟩ |
camcontrol |
tags [device id] [generic args]
[-N tags]
[-q ] [-v ] |
camcontrol |
negotiate [device id] [generic args]
[-c ] [-D
enable|disable] [-M
mode] [-O
offset] [-q ]
[-R syncrate]
[-T enable|disable]
[-U ] [-W
bus_width] [-v ] |
camcontrol |
format [device id] [generic args]
[-q ] [-r ]
[-w ] [-y ] |
camcontrol |
sanitize [device id] [generic args]
⟨-a overwrite |
block | crypto |
exitfailure⟩ [-c
passes] [-I ]
[-P pattern]
[-q ] [-U ]
[-r ] [-w ]
[-y ] |
camcontrol |
idle [device id] [generic args]
[-t time] |
camcontrol |
standby [device id] [generic args]
[-t time] |
camcontrol |
sleep [device id] [generic args] |
camcontrol |
powermode [device id] [generic args] |
camcontrol |
apm [device id] [generic args]
[-l level] |
camcontrol |
aam [device id] [generic args]
[-l level] |
camcontrol |
fwdownload [device id] [generic args]
⟨-f fw_image⟩
[-q ] [-s ]
[-y ] |
camcontrol |
security [device id] [generic args]
[-d pwd]
[-e pwd]
[-f ] [-h
pwd] [-k
pwd] [-l
high|maximum] [-q ]
[-s pwd]
[-T timeout]
[-U user|master]
[-y ] |
camcontrol |
hpa [device id] [generic args]
[-f ] [-l ]
[-P ] [-p
pwd] [-q ]
[-s max_sectors]
[-U pwd]
[-y ] |
camcontrol |
ama [device id] [generic args]
[-f ] [-q ]
[-s max_sectors] |
camcontrol |
persist [device id] [generic args]
⟨-i action |
-o action⟩
[-a ] [-I
trans_id] [-k
key] [-K
sa_key] [-p ]
[-R rel_tgt_port]
[-s scope]
[-S ] [-T
res_type] [-U ] |
camcontrol |
attrib [device id] [generic args]
⟨-r action |
-w attrib⟩
[-a attr_num]
[-c ] [-e
elem_addr] [-F
form1,form2] [-p
part] [-s
start_addr] [-T
elem_type] [-V
lv_num] |
camcontrol |
opcodes [device id] [generic args]
[-o opcode]
[-s service_action]
[-N ] [-T ] |
camcontrol |
zone ⟨-c
cmd⟩ [-a ]
[-l lba]
[-o rep_opts]
[-P print_opts] |
camcontrol |
epc ⟨-c
cmd⟩ [-d ]
[-D ] [-e ]
[-H ] [-p
power_cond] [-P ]
[-r restore_src]
[-s ] [-S
power_src] [-T
timer] |
camcontrol |
timestamp [device id] [generic args]
⟨-r [-f
format | -m |
-U ] | -s
⟨-f format
-T time |
-U ⟩⟩ |
camcontrol |
devtype [device id] |
camcontrol |
help |
The camcontrol
utility is designed to
provide a way for users to access and control the
FreeBSD CAM subsystem.
The camcontrol
utility can cause a loss of
data and/or system crashes if used improperly. Even expert users are
encouraged to exercise caution when using this command. Novice users should
stay away from this utility.
The camcontrol
utility has a number of
primary functions, many of which support an optional device identifier. A
device identifier can take one of three forms:
The device identifier, if it is specified,
must come
immediately after the function name, and before any generic or
function-specific arguments. Note that the -n
and
-u
arguments described below will override any
device name or unit number specified beforehand. The
-n
and -u
arguments will
not override
a specified bus:target or bus:target:lun, however.
Most of the camcontrol
primary functions
support these generic arguments:
-C
count-E
) must be turned on.-E
-C
) to be honored. Other than retrying commands,
the generic error recovery in the code will generally attempt to spin up
drives that are not spinning. It may take some other actions, depending
upon the sense code returned from the command.-n
dev_name-Q
task_attr-t
timeout-u
unit_number-v
Primary command functions:
devlist
-v
argument, SCSI bus number, adapter
name and unit numbers are printed as well. On the other hand, with the
-b
argument, only the bus adapter, and unit
information will be printed, and device information will be omitted.periphlist
tur
camcontrol
utility will report whether the device
is ready or not.inquiry
camcontrol
will print out the standard inquiry
data, device serial number, and transfer rate information. The user can
specify that only certain types of inquiry data be printed:
identify
reportluns
camcontrol
will print out the list of logical
units (LUNs) supported by the target device. There are a couple of options
to modify the output:
-c
-l
-r
reporttypecamcontrol
default. Most targets will
support this report if they support the REPORT LUNS command.camcontrol
will try to print out LUN
numbers in a reasonable format. It can understand the peripheral, flat,
LUN and extended LUN formats.
readcap
camcontrol
will print out the last
logical block of the device, and the blocksize of the device in bytes. To
modify the output format, use the following options:
-b
-N
or
-s
.-h
-N
and cannot be used
with -q
or -b
.-H
-l
-N
-q
-b
or -s
are not
specified).-s
Note that this command only displays the information, it does
not update the kernel data structures. Use the
camcontrol
reprobe subcommand to do that.
start
stop
load
eject
rescan
If a device is specified by peripheral name and unit number,
for instance da4, it may only be rescanned if that device currently
exists in the CAM EDT (Existing Device Table). If the device is no
longer there (see camcontrol
devlist ), you must
use the bus:target:lun form to rescan it.
reprobe
reset
defects
-f
formatcamcontrol
utility
attempts to detect this, and print out whatever format the drive
returns. If the drive uses a non-standard sense code to report that it
does not support the requested format,
camcontrol
will probably see the error as a
failure to complete the request.
The format options are:
-G
-P
-q
-s
, only
print the number of defects.-s
-S
offset-X
If neither -P
nor
-G
is specified,
camcontrol
will print out the number of defects
given in the READ DEFECT DATA header returned from the drive. Some
drives will report 0 defects if neither the primary or grown defect
lists are requested.
modepage
SCSI_MODES
environment variable. The modepage
command takes
several arguments:
-6
camcontrol
starts with 10 byte commands and
falls back to 6 byte on error.-d
-D
-L
-b
-e
EDITOR
environment variable, or supply
mode page values via standard input, using the same format that
camcontrol
uses to display mode page values.
The editor will be invoked if camcontrol
detects that standard input is terminal.-l
-m
page[,subpage]-l
is specified.-P
pgctlcmd
cmd
function requires the
-c
argument to specify SCSI CDB or the
-a
argument to specify ATA Command Block registers
values. Other arguments are optional, depending on the command type. The
command and data specification syntax is documented in
cam_cdbparse(3).
NOTE: If the CDB specified causes data to be transferred to or from the
SCSI device in question, you MUST specify either
-i
or -o
.
-a
cmd [args]-c
cmd [args]-d
-f
-i
len fmt-o
len fmt [args]-r
fmtsmpcmd
smpcmd
function requires
the -r
argument to specify the SMP request to be
sent, and the -R
argument to specify the format of
the SMP response. The syntax for the SMP request and response arguments is
documented in
cam_cdbparse(3).
Note that SAS adapters that support SMP passthrough (at least the currently known adapters) do not accept CRC bytes from the user in the request and do not pass CRC bytes back to the user in the response. Therefore users should not include the CRC bytes in the length of the request and not expect CRC bytes to be returned in the response.
-r
len fmt [args]-R
len fmt [args]smprg
camcontrol
will
display the data returned by the Report General command. If the SMP target
supports the long response format, the additional data will be requested
and displayed automatically.
-l
camcontrol
to skip sending the initial report
general request without the long bit set and only issue a report
general request with the long bit set.smppc
-p
argument is required to
specify the PHY to operate on.
-p
phy-l
-o
operation-o
operation may be specified. The operation may be specified numerically
(in decimal, hexadecimal, or octal) or one of the following operation
names may be specified:
-d
argument to specify the
device name.-d
name-o
setdevname phy
operation. The name is a 64-bit number, and can be specified in
decimal, hexadecimal or octal format.-m
rateOther values may be specified for newer physical link rates.
-M
rate-m
argument description for
known link rate arguments.-T
pp_timeout-a
enable|disable-A
enable|disable-s
enable|disable-S
enable|disablesmpphylist
smpmaninfo
-l
debug
debug
function takes a number of
arguments:
-I
-P
-T
-S
-X
-c
-p
tags
command, with no command-specific arguments
(i.e., only generic arguments) prints out the "soft" maximum
number of transactions that can be queued to the device in question. For
more detailed information, use the -v
argument
described below.
-N
tags-v
switch. The
meaning of the -v
switch for this
camcontrol
subcommand is described below.-q
-v
camcontrol
to print out the tagged queueing
related fields of the XPT_GDEV_TYPE CCB:
negotiate
camcontrol
utility will not attempt to
set the parameter if the controller indicates that it does not support
setting the parameter. To find out what the controller supports, use the
-v
flag. The meaning of the
-v
flag for the negotiate
command is described below. Also, some controller drivers do not support
setting negotiation parameters, even if the underlying controller supports
negotiation changes. Some controllers, such as the Advansys wide
controllers, support enabling and disabling synchronous negotiation for a
device, but do not support setting the synchronous negotiation rate.
-a
-c
-D
enable|disable-M
mode-O
offset-q
-R
syncrate-T
enable|disable-U
-v
negotiate
subcommand. It causes
camcontrol
to print out the contents of a Path
Inquiry (XPT_PATH_INQ) CCB sent to the controller driver.-W
bus_widthIn general, sync rate and offset settings will not take effect
for a device until a command has been sent to the device. The
-a
switch above will automatically send a Test
Unit Ready to the device so negotiation parameters will take effect.
format
WARNING! WARNING! WARNING!
Low level formatting a disk will destroy ALL data on the disk. Use extreme caution when issuing this command. Many users low-level format disks that do not really need to be low-level formatted. There are relatively few scenarios that call for low-level formatting a disk. One reason for low-level formatting a disk is to initialize the disk after changing its physical sector size. Another reason for low-level formatting a disk is to revive the disk if you are getting "medium format corrupted" errors from the disk in response to read and write requests.
Some disks take longer than others to format. Users should specify a timeout long enough to allow the format to complete. The default format timeout is 3 hours, which should be long enough for most disks. Some hard disks will complete a format operation in a very short period of time (on the order of 5 minutes or less). This is often because the drive does not really support the FORMAT UNIT command -- it just accepts the command, waits a few minutes and then returns it.
The ‘format’ subcommand takes several arguments
that modify its default behavior. The -q
and
-y
arguments can be useful for scripts.
-q
-y
argument, below.-r
-w
camcontrol
issues the FORMAT UNIT command with
the immediate bit set. This tells the device to immediately return the
format command, before the format has actually completed. Then,
camcontrol
gathers SCSI sense information from
the device every second to determine how far along in the format
process it is. If the -w
argument is
specified, camcontrol
will issue a
non-immediate format command, and will be unable to print any
information to let the user know what percentage of the disk has been
formatted.-y
camcontrol
will ask the user if he/she really
wants to format the disk in question, and also if the default format
command timeout is acceptable. The user will not be asked about the
timeout if a timeout is specified on the command line.sanitize
WARNING! WARNING! WARNING!
ALL data on the disk will be destroyed or made inaccessible. Recovery of the data is not possible. Use extreme caution when issuing this command.
The ‘sanitize’ subcommand takes several
arguments that modify its default behavior. The
-q
and -y
arguments can
be useful for scripts.
-a
operation-P
argument. The number of times is
given by the -c
argument.-U
argument.-c
passes-I
-P
pattern-q
-y
argument, below.-U
-r
-w
camcontrol
issues the SANITIZE command with
the immediate bit set. This tells the device to immediately return the
sanitize command, before the sanitize has actually completed. Then,
camcontrol
gathers SCSI sense information from
the device every second to determine how far along in the sanitize
process it is. If the -w
argument is
specified, camcontrol
will issue a
non-immediate sanitize command, and will be unable to print any
information to let the user know what percentage of the disk has been
sanitized.-y
camcontrol
will ask the user if he/she really
wants to sanitize the disk in question, and also if the default
sanitize command timeout is acceptable. The user will not be asked
about the timeout if a timeout is specified on the command line.idle
-t
) specifies automatic standby timer value in
seconds. Value 0 disables timer.standby
-t
) specifies automatic standby timer value in
seconds. Value 0 disables timer.sleep
powermode
apm
-l
) specified, enables and
sets advanced power management level, where 1 -- minimum power, 127 --
maximum performance with standby, 128 -- minimum power without standby,
254 -- maximum performance. If not specified -- APM is disabled.aam
-l
) specified, enables and
sets automatic acoustic management level, where 1 -- minimum noise, 254 --
maximum performance. If not specified -- AAM is disabled.security
camcontrol
will print out the security
support and associated settings of the device. The
security
command takes several arguments:
-d
pwdDisable device security using the given password for the selected user according to the devices configured security level.
-e
pwdErase the device using the given password for the selected user.
WARNING! WARNING! WARNING!
Issuing a secure erase will ERASE ALL user data on the device and may take several hours to complete.
When this command is used against an SSD drive all its cells will be marked as empty, restoring it to factory default write performance. For SSD's this action usually takes just a few seconds.
-f
Freeze the security configuration of the specified device.
After command completion any other commands that update the device lock mode shall be command aborted. Frozen mode is disabled by power-off or hardware reset.
-h
pwdEnhanced erase the device using the given password for the selected user.
WARNING! WARNING! WARNING!
Issuing an enhanced secure erase will ERASE ALL user data on the device and may take several hours to complete.
An enhanced erase writes predetermined data patterns to all user data areas, all previously written user data shall be overwritten, including sectors that are no longer in use due to reallocation.
-k
pwdUnlock the device using the given password for the selected user according to the devices configured security level.
-l
high|maximumSpecifies which security level to set when issuing a
-s
pwd command. The
security level determines device behavior when the master password
is used to unlock the device. When the security level is set to high
the device requires the unlock command and the master password to
unlock. When the security level is set to maximum the device
requires a secure erase with the master password to unlock.
This option must be used in conjunction with one of the security action commands.
Defaults to high
-q
Be quiet, do not print any status messages. This option
will not disable the questions, however. To disable questions, use
the -y
argument, below.
-s
pwdPassword the device (enable security) using the
given password for the selected user. This option can be combined
with other options such as -e
pwd
A master password may be set in a addition to the user password. The purpose of the master password is to allow an administrator to establish a password that is kept secret from the user, and which may be used to unlock the device if the user password is lost.
Note: Setting the master password does not enable device security.
If the master password is set and the drive supports a Master Revision Code feature the Master Password Revision Code will be decremented.
-T
timeoutOverrides the default timeout, specified in seconds, used
for both -e
and -h
this is useful if your system has problems processing long timeouts
correctly.
Usually the timeout is calculated from the information stored on the drive if present, otherwise it defaults to 2 hours.
-U
user|masterSpecifies which user to set / use for the running action command, valid values are user or master and defaults to master if not set.
This option must be used in conjunction with one of the security action commands.
Defaults to master
-y
Confirm yes to dangerous options such as
-e
without prompting for confirmation.
If the password specified for any action commands does not match the configured password for the specified user the command will fail.
The password in all cases is limited to 32 characters, longer passwords will fail.
hpa
camcontrol
will print out the HPA support and
associated settings of the device. The hpa
command
takes several optional arguments:
-f
Freeze the HPA configuration of the specified device.
After command completion any other commands that update the HPA configuration shall be command aborted. Frozen mode is disabled by power-off or hardware reset.
-l
Lock the HPA configuration of the device until a successful call to unlock or the next power-on reset occurs.
-P
Make the HPA max sectors persist across power-on reset or
a hardware reset. This must be used in combination with
-s
max_sectors
-p
pwdSet the HPA configuration password required for unlock calls.
-q
Be quiet, do not print any status messages. This option
will not disable the questions. To disable questions, use the
-y
argument, below.
-s
max_sectorsConfigures the maximum user accessible sectors of the device. This will change the number of sectors the device reports.
WARNING! WARNING! WARNING!
Changing the max sectors of a device using this option will make the data on the device beyond the specified value inaccessible.
Only one successful -s
max_sectors call can be made without a
power-on reset or a hardware reset of the device.
-U
pwdUnlock the HPA configuration of the specified device using
the given password. If the password specified does not match the
password configured via -p
pwd the command will fail.
After 5 failed unlock calls, due to password miss-match, the device will refuse additional unlock calls until after a power-on reset.
-y
Confirm yes to dangerous options such as
-e
without prompting for confirmation
The password for all HPA commands is limited to 32 characters, longer passwords will fail.
ama
camcontrol
will print out the Accessible Max
Address Configuration support and associated settings of the device. The
ama
command takes several optional arguments:
-f
Freeze the Accessible Max Address Configuration of the specified device.
After command completion any other commands that update the configuration shall be command aborted. Frozen mode is disabled by power-off.
-q
Be quiet, do not print any status messages.
-s
max_sectorsConfigures the maximum user accessible sectors of the device. This will change the number of sectors the device reports.
WARNING! WARNING! WARNING!
Changing the max sectors of a device using this option will make the data on the device beyond the specified value indeterminate.
Only one successful -s
max_sectors call can be made without a
power-on reset of the device.
fwdownload
If the device is a SCSI device and it provides a recommended
timeout for the WRITE BUFFER command (see the
camcontrol
opcodes subcommand), that timeout
will be used for the firmware download. The drive-recommended timeout
value may be overridden on the command line with the
-t
option.
Current list of supported vendors for SCSI/SAS drives:
WARNING! WARNING! WARNING!
Little testing has been done to make sure that different device models from each vendor work correctly with the fwdownload command. A vendor name appearing in the supported list means only that firmware of at least one device type from that vendor has successfully been programmed with the fwdownload command. Extra caution should be taken when using this command since there is no guarantee it will not break a device from the listed vendors. Ensure that you have a recent backup of the data on the device before performing a firmware update.
Note that unknown SCSI protocol devices will not be programmed, since there is little chance of the firmware download succeeding.
camcontrol
will currently attempt a
firmware download to any ATA or SATA device, since the standard ATA
DOWNLOAD MICROCODE command may work. Firmware downloads to ATA and SATA
devices are supported for devices connected to standard ATA and SATA
controllers, and devices connected to SAS controllers with SCSI to ATA
translation capability. In the latter case,
camcontrol
uses the SCSI ATA PASS-THROUGH
command to send the ATA DOWNLOAD MICROCODE command to the drive. Some
SCSI to ATA translation implementations don't work fully when
translating SCSI WRITE BUFFER commands to ATA DOWNLOAD MICROCODE
commands, but do support ATA passthrough well enough to do a firmware
download.
-f
fw_image-q
-y
option to suppress
all output.-s
-v
In simulation mode, print out the SCSI CDB or ATA register values that would be used for the firmware download command.
-y
persist
-i
option is specified,
camcontrol
will issue the SCSI PERSISTENT RESERVE
IN command using the requested service action. If the
-o
option is specified,
camcontrol
will issue the SCSI PERSISTENT RESERVE
OUT command using the requested service action. One of those two options
is required.
Persistent reservations are complex, and fully explaining them is outside the scope of this manual. Please visit http://www.t10.org and download the latest SPC spec for a full explanation of persistent reservations.
-i
mode-o
mode-a
-I
tid-I
arguments. With the Register service
action, specifying one or more Transport IDs implicitly enables the
-S
option which turns on the SPEC_I_PT bit.
Transport IDs generally have the format protocol,id.
sas,0x1234567812345678
fcp,0x1234567812345678
spi,4,1
sbp,0x1234567812345678
srp,0x12345678123456781234567812345678
iqn.2012-06.com.example:target0
If the iSCSI separator and initiator session ID are specified:
iqn.2012-06.com.example:target0,i,0x123
sop,4,5,1
If the alternate Routing ID form is used:
sop,4,1
-k
key-K
key-p
-s
scope-R
rtp-S
-I
if this option is set. If
you specify a Transport ID, this option is automatically set. It is an
error to specify this option for any service action other than
Register.-T
type-U
attrib
-r
option or the -w
option
must be specified.
-r
action-w
attr-a
num-r
.-c
-e
num-F
form1,form2The text options are mutually exclusive; if you specify more than one, you will get unpredictable results. The nonascii options are also mutually exclusive. Most of the field options may be logically ORed together.
-p
part-s
start_num-T
elem_type-e
). Valid types are: “all”,
“picker”, “slot”, “portal”,
and “drive”.-V
vol_numopcodes
-o
opcode-s
service_action-N
-T
-o
and -s
options,
which request information on a specific command and service action.
This requests that the device report Nominal and Recommended timeout
values for the given command or commands. The timeout values are in
seconds. The timeout descriptor also includes a command-specificzone
SMR drives are divided into zones (typically in the range of 256MB each) that fall into three general categories:
-c
cmd-o
and
printing options with -P
. Specify the
starting LBA with -l
. Note that
“reportzones” is also accepted as a command
argument.-a
-l
lba-o
rep_opt-P
print_optepc
camcontrol
subcommand.
-c
cmd-p
cond-D
-H
-e
-e
or -d
is required.-d
-d
or -e
is required.-T
timer-p
cond-s
-e
-e
or -d
is required.-d
-d
or -e
is required.-p
cond-s
-S
src-P
camcontrol
will only issue
the ATA CHECK POWER MODE command to the drive.timestamp
-r
option or the -s
option
must be specified.
-r
-f
format-m
-U
-s
-f
and
-T
options or the -U
option must be specified.
devtype
help
The SCSI_MODES
variable allows the user to
specify an alternate mode page format file.
The EDITOR
variable determines which text
editor camcontrol
starts when editing mode
pages.
camcontrol eject -n cd -u 1
-v
Eject the CD from cd1, and print SCSI sense information if the command fails.
camcontrol tur da0
Send the SCSI test unit ready command to da0. The
camcontrol
utility will report whether the disk is
ready, but will not display sense information if the command fails since the
-v
switch was not specified.
camcontrol tur da1 -E -C 4 -t 50 -Q head -v
Send a test unit ready command to da1. Enable kernel error
recovery. Specify a retry count of 4, and a timeout of 50 seconds. Enable
sense printing (with the -v
flag) if the command
fails. Since error recovery is turned on, the disk will be spun up if it is
not currently spinning. The SCSI task attribute for the command will be set
to Head of Queue. The camcontrol
utility will report
whether the disk is ready.
camcontrol cmd -n cd -u 1 -v -c "3C 00 00 00 00 00 00 00 0e 00" \ -i 0xe "s1 i3 i1 i1 i1 i1 i1 i1 i1 i1 i1 i1"
Issue a READ BUFFER command (0x3C) to cd1. Display the buffer size of cd1, and display the first 10 bytes from the cache on cd1. Display SCSI sense information if the command fails.
camcontrol cmd -n cd -u 1 -v -c "3B 00 00 00 00 00 00 00 0e 00" \ -o 14 "00 00 00 00 1 2 3 4 5 6 v v v v" 7 8 9 8
Issue a WRITE BUFFER (0x3B) command to cd1. Write out 10 bytes of data, not including the (reserved) 4 byte header. Print out sense information if the command fails. Be very careful with this command, improper use may cause data corruption.
camcontrol modepage da3 -m 1 -e -P 3
Edit mode page 1 (the Read-Write Error Recover page) for da3, and save the settings on the drive. Mode page 1 contains a disk drive's auto read and write reallocation settings, among other things.
camcontrol rescan all
Rescan all SCSI buses in the system for devices that have been added, removed or changed.
camcontrol rescan 0
Rescan SCSI bus 0 for devices that have been added, removed or changed.
camcontrol rescan 0:1:0
Rescan SCSI bus 0, target 1, lun 0 to see if it has been added, removed, or changed.
camcontrol tags da5 -N
24
Set the number of concurrent transactions for da5 to 24.
camcontrol negotiate -n da -u 4 -T disable
Disable tagged queueing for da4.
camcontrol negotiate -n da -u 3 -R 20.000 -O 15 -a
Negotiate a sync rate of 20MHz and an offset of 15 with da3. Then send a Test Unit Ready command to make the settings take effect.
camcontrol smpcmd ses0 -v -r 4 "40 0 00 0" -R 1020 "s9 i1"
Send the SMP REPORT GENERAL command to ses0, and display the number of PHYs it contains. Display SMP errors if the command fails.
camcontrol security ada0
Report security support and settings for ada0
camcontrol security ada0 -U user -s MyPass
Enable security on device ada0 with the password MyPass
camcontrol security ada0 -U user -e MyPass
Secure erase ada0 which has had security enabled with user password MyPass
WARNING! WARNING! WARNING!
This will ERASE ALL data from the device, so backup your data before using!
This command can be used against an SSD drive to restoring it to factory default write performance.
camcontrol hpa ada0
Report HPA support and settings for ada0 (also reported via identify).
camcontrol hpa ada0 -s 10240
Enables HPA on ada0 setting the maximum reported sectors to 10240.
WARNING! WARNING! WARNING!
This will PREVENT ACCESS to all data on the device beyond this limit until HPA is disabled by setting HPA to native max sectors of the device, which can only be done after a power-on or hardware reset!
DO NOT use this on a device which has an active filesystem!
camcontrol persist da0 -v -i read_keys
This will read any persistent reservation keys registered with da0, and display any errors encountered when sending the PERSISTENT RESERVE IN SCSI command.
camcontrol persist da0 -v -o register -a -K 0x12345678
This will register the persistent reservation key 0x12345678 with da0, apply that registration to all ports on da0, and display any errors that occur when sending the PERSISTENT RESERVE OUT command.
camcontrol persist da0 -v -o reserve -s lun -k 0x12345678 -T ex_ac
This will reserve da0 for the exlusive use of the initiator issuing the command. The scope of the reservation is the entire LUN. Any errors sending the PERSISTENT RESERVE OUT command will be displayed.
camcontrol persist da0 -v -i read_full
This will display the full status of all reservations on da0 and print out status if there are any errors.
camcontrol persist da0 -v -o release -k 0x12345678 -T ex_ac
This will release a reservation on da0 of the type ex_ac (Exclusive Access). The Reservation Key for this registration is 0x12345678. Any errors that occur will be displayed.
camcontrol persist da0 -v -o register -K 0x12345678 -S \ -I sas,0x1234567812345678 -I sas,0x8765432187654321
This will register the key 0x12345678 with da0, specifying that it applies to the SAS initiators with SAS addresses 0x1234567812345678 and 0x8765432187654321.
camcontrol persist da0 -v -o register_move -k 0x87654321 \ -K 0x12345678 -U -p -R 2 -I fcp,0x1234567812345678
This will move the registration from the current initiator, whose Registration Key is 0x87654321, to the Fibre Channel initiator with the Fiber Channel World Wide Node Name 0x1234567812345678. A new registration key, 0x12345678, will be registered for the initiator with the Fibre Channel World Wide Node Name 0x1234567812345678, and the current initiator will be unregistered from the target. The reservation will be moved to relative target port 2 on the target device. The registration will persist across power losses.
camcontrol attrib sa0 -v -i attr_values -p 1
This will read and decode the attribute values from partition 1 on the tape in tape drive sa0, and will display any SCSI errors that result.
camcontrol zone da0 -v -c rz -P summary
This will request the SMR zone list from disk da0, and print out a summary of the zone parameters, and display any SCSI or ATA errors that result.
camcontrol zone da0 -v -c rz -o reset
This will request the list of SMR zones that should have their write pointer reset from the disk da0, and display any SCSI or ATA errors that result.
camcontrol zone da0 -v -c rwp -l 0x2c80000
This will issue the Reset Write Pointer command to disk da0 for the zone that starts at LBA 0x2c80000 and display any SCSI or ATA errors that result.
camcontrol epc ada0 -c timer -T 60.1 -p Idle_a -e -s
Set the timer for the Idle_a power condition on drive ada0 to 60.1 seconds, enable that particular power condition, and save the timer value and the enabled state of the power condition.
camcontrol epc da4 -c goto -p Standby_z -H
Tell drive da4 to go to the Standby_z
power state (which is the drive's lowest power state) and hold in that state
until it is explicitly released by another goto
command.
camcontrol epc da2 -c status -P
Report only the power state of drive da2.
Some drives will power up in response to the commands sent by the
status subcommand, and the
-P
option causes camcontrol
to only send the ATA CHECK POWER MODE command, which should not trigger a
change in the drive's power state.
camcontrol epc ada0 -c list
Display the ATA Power Conditions log (Log Address 0x08) for drive ada0.
camcontrol timestamp sa0 -s -f "%a, %d %b %Y %T %z" \ -T "Wed, 26 Oct 2016 21:43:57 -0600"
Set the timestamp of drive sa0 using a strptime(3) format string followed by a time string that was created using this format string.
The camcontrol
utility first appeared in
FreeBSD 3.0.
The mode page editing code and arbitrary SCSI command code are based upon code in the old scsi(8) utility and scsi(3) library, written by Julian Elischer and Peter Dufault. The scsi(8) program first appeared in 386BSD-0.1.2.4, and first appeared in FreeBSD in FreeBSD 2.0.5.
Kenneth Merry <ken@FreeBSD.org>
The code that parses the generic command line arguments does not know that some of the subcommands take multiple arguments. So if, for instance, you tried something like this:
camcontrol cmd -n da -u 1 -c "00 00 00 00 00 v" 0x00 -v
The sense information from the test unit ready command would not
get printed out, since the first
getopt(3) call in
camcontrol
bails out when it sees the second
argument to -c
(0x00), above. Fixing this behavior
would take some gross code, or changes to the
getopt(3) interface. The
best way to circumvent this problem is to always make sure to specify
generic camcontrol
arguments before any
command-specific arguments.
August 6, 2019 | midnightbsd-3.1 |