CTLADM(8) | MidnightBSD System Manager's Manual | CTLADM(8) |
ctladm
— CAM
Target Layer control utility
ctladm |
⟨command⟩ [lun] [generic args] [command args] |
ctladm |
tur ⟨lun⟩ [general options] |
ctladm |
inquiry ⟨lun⟩ [general
options] |
ctladm |
reqsense ⟨lun⟩ [general
options] |
ctladm |
reportluns ⟨lun⟩ [general
options] |
ctladm |
read ⟨lun⟩ [general options]
⟨-l lba⟩
⟨-d datalen⟩
⟨-f file|-⟩
⟨-b
blocksize_bytes⟩ [-c
cdbsize] [-N ] |
ctladm |
write ⟨lun⟩ [general options]
⟨-l lba⟩
⟨-d datalen⟩
⟨-f file|-⟩
⟨-b
blocksize_bytes⟩ [-c
cdbsize] [-N ] |
ctladm |
readcap ⟨lun⟩ [general options]
[-c cdbsize] |
ctladm |
modesense ⟨lun⟩
⟨-m page |
-l ⟩ [-P
pc] [-d ]
[-S subpage]
[-c size] |
ctladm |
start ⟨lun⟩ [general options]
[-i ] [-o ] |
ctladm |
stop ⟨lun⟩ [general options]
[-i ] [-o ] |
ctladm |
synccache ⟨lun⟩ [general options]
[-l lba]
[-b blockcount]
[-r ] [-i ]
[-c cdbsize] |
ctladm |
lunlist |
ctladm |
delay ⟨lun⟩
⟨-l
datamove|done⟩
⟨-t secs⟩
[-T oneshot|cont] |
ctladm |
inject ⟨-i
action⟩ ⟨-p
pattern⟩ [-r
lba,len] [-s
len fmt [args]]
[-c ] [-d
delete_id] |
ctladm |
create ⟨-b
backend⟩ [-B
blocksize] [-d
device_id] [-l
lun_id] [-o
name=value] [-s
size_bytes] [-S
serial_num] [-t
device_type] |
ctladm |
remove ⟨-b
backend⟩ ⟨-l
lun_id⟩ [-o
name=value] |
ctladm |
modify ⟨-b
backend⟩ ⟨-l
lun_id⟩ [-o
name=value] ⟨-s
size_bytes⟩ |
ctladm |
devlist [-b
backend] [-v ]
[-x ] |
ctladm |
port [-c ]
[-o on|off]
[-w wwpn]
[-W wwnn]
[-O pp|vp]
[-p targ_port]
[-r targ_port]
[-t fe_type] |
ctladm |
portlist [-f
frontend] [-i ]
[-l ] [-p
targ_port] [-q ]
[-v ] [-x ] |
ctladm |
lunmap ⟨-p
targ_port⟩ [-l
pLUN] [-L
cLUN] |
ctladm |
dumpooa |
ctladm |
dumpstructs |
ctladm |
islist [-v ]
[-x ] |
ctladm |
islogout ⟨-a |
-c connection-id |
-i name |
-p portal⟩ |
ctladm |
isterminate ⟨-a |
-c connection-id |
-i name |
-p portal⟩ |
ctladm |
help |
The ctladm
utility is designed to provide
a way to access and control the CAM Target Layer (CTL). It provides a way to
send SCSI commands to the CTL layer, and also provides some meta-commands
that utilize SCSI commands. (For instance, the
lunlist
command is implemented using the SCSI REPORT
LUNS and INQUIRY commands.)
The ctladm
utility has a number of primary
functions, many of which require a device identifier. The device identifier
takes the following form:
ctladm
utility take
the following optional arguments:
-C
retries-D
device-I
idctladm
will use 7 as the initiator number.Primary commands:
tur
inquiry
reqsense
reportluns
read
-l
lba-d
datalen-f
file-c
cdbsize-b
blocksize-N
ctladm
from the kernel
when doing a read, just execute the command without copying data. This
is to be used for performance testing.write
-l
lba-d
atalen-f
file-c
cdbsize-b
blocksize-N
ctladm
to the kernel when
doing a write, just execute the command without copying data. This is
to be used for performance testing.readcap
ctladm
will automatically issue a READ
CAPACITY(16), which is implemented as a service action of the SERVICE
ACTION IN(16) opcode. The user can specify the minimum CDB size with the
-c
argument. Valid values for the
-c
option are 10 and 16. If a 10 byte CDB is
specified, the request will be automatically reissued with a 16 byte CDB
if the maximum LBA returned is 0xffffffff.modesense
-m
page-l
option are mutually exclusive. One of the
two must be specified, though. Mode page numbers may be specified in
decimal or hexadecimal.-l
-m
option are
mutually exclusive. One of the two must be specified, though.-P
pc-d
-S
subpage-c
cdbsizestart
-i
stop
ctladm
sends an ordered tag for
completeness.)
-i
synccache
-c
argument.
-l
lba-b
blockcount-r
-i
-c
cdbsizelunlist
delay
-l
option. The -t
option must also be specified.
-l
delayloc-t
delaytime-T
delaytypedelay
option will delay the next command sent to the given LUN. With the
-T
cont option, every
command will be delayed by the specified period of time. With the
-T
oneshot the next
command sent to the given LUN will be delayed and all subsequent
commands will be completed normally. This is the default.inject
Errors are only injected for commands that have not already failed for other reasons. By default, only the first command matching the pattern specified is returned with the supplied error.
If the -c
flag is specified, all
commands matching the pattern will be returned with the specified error
until the error injection command is deleted with
-d
flag.
-i
action-s
argument must
be specified.-p
pattern-r
lba,len-s
len fmt [args]-c
-d
argument.-d
delete_idport
-l
), turn one or more frontends on
or off (-o
on|off), or set
the World Wide Node Name (-w
wwnn) or World Wide Port Name
(-W
wwpn) for a given port.
One of -l
, -o
, or
-w
or -W
must be
specified. The WWNN and WWPN may both be specified at the same time, but
cannot be combined with enabling/disabling or listing ports.
-c
-o
on|off-O
pp|vp-p
targ_port-r
-p
targ_port).-t
fe_type-w
wwnn-n
argument must be specified, since this is
only possible to implement on a single port. As a general rule, the
WWNN should be the same across all ports on the system.-W
wwpn-n
argument must be specified, since this is
only possible to implement on a single port. As a general rule, the
WWPN must be different for every port in the system.portlist
lunmap
dumpooa
dumpstructs
create
-b
backend-b
flag is required. This specifies the
name backend to use when creating the LUN. Examples are
“ramdisk” and “block”.-B
blocksize-d
device_id-l
lun_id-o
name=value-o
arguments may be specified. Refer to the
backend documentation for arguments that may be used.-s
size_bytes-S
serial_num-t
device_typeremove
-o
flag.
-b
backend-l
lun_id-o
name=value-o
arguments may be specified. Refer to the
backend documentation for arguments that may be used.modify
-b
backend-l
lun_id-o
name=value-o
arguments may be specified. Refer to the
backend documentation for arguments that may be used.-s
size_bytesdevlist
-b
backend-v
-x
-v
and
-b
options are mutually exclusive. If you
specify -x
, the entire LUN database is
displayed in XML format.islist
islogout
isterminate
help
ctladm
usage information.Number of additional configuration options may be specified for LUNs. Some options are global, others are backend-specific.
Global options:
Options specific for block backend:
Options specific for ramdisk backend:
Send a SCSI TEST UNIT READY command to LUN 1.
ctladm tur 1
Display the list of mode pages supported by LUN 1.
ctladm modesense 1 -l
Display the saved version of the Control mode page (page 10) on LUN 0. Disable fetching block descriptors, and use a 10 byte MODE SENSE command instead of the default 6 byte command.
ctladm modesense 0 -m 10 -P 3 -d -c
10
Read the first 512 byte block from LUN 2 and dump it to the file
ctladm read 2 -l 0 -d 1 -b 512 -f -
> foo
Read 10240 bytes from the file /tmp/bar and write it to LUN 3. starting at LBA 0xff432140.
ctladm write 3 -l 0xff432140 -d 20 -b
512 -f /tmp/bar
Create a LUN with the “fake” ramdisk as a backing store. The LUN will claim to have a size of approximately 10 terabytes, while having no real data store (all written data are lost).
ctladm create -b ramdisk -s
10485760000000000
Create a thin provisioned LUN with a ramdisk as a backing store. The LUN will have maximal backing store capacity of 10 gigabytes, while reporting size of 10 terabytes,
ctladm create -b ramdisk -s 10T -o
capacity=10G
Create a LUN using the block backend, and specify the file src/usr.sbin/ctladm/ctladm.8 as the backing store. The size of the LUN will be derived from the size of the file.
ctladm create -b block -o
file=src/usr.sbin/ctladm/ctladm.8
Create a LUN using the block backend, specify the file
src/usr.sbin/ctladm/ctladm.8 as the backing store,
and specify the SCSI VPD page 0x80 and 0x83 serial number
(-S
) and device ID (-d
).
ctladm create -b block -o
file=src/usr.sbin/ctladm/ctladm.8 -S MYSERIAL321 -d MYDEVID123
Use to specify generic options on ioctl frontend port, now it is only possible to set pp and/or vp port number.
ctladm port -c -O pp=11 -O
vp=12
Remove specified targ_port.
ctladm port -r -p 4
Remove LUN 12, which is handled by the block backend, from the system.
ctladm remove -b block -l
12
List configured LUNs in the system, along with their backend and serial number. This works when the Front End Target Drivers are enabled or disabled.
ctladm devlist
List all LUNs in the system, along with their inquiry data and device type. This only works when the FETDs are enabled, since the commands go through the ioctl port.
ctladm lunlist
Inject a medium error on LUN 6 for every read that covers the first 512 blocks of the LUN.
ctladm inject 6 -i mediumerr -p read
-r 0,512 -c
Inject a custom error on LUN 6 for the next TEST UNIT READY command only. This will result in a sense key of NOT READY (0x02), and an ASC/ASCQ of 0x04,0x02 ("Logical unit not ready, initializing command required").
ctladm inject 6 -i custom -p tur -s 18 "f0 0 02 s12 04 02"
cam(3), cam_cdbparse(3), cam(4), ctl(4), xpt(4), camcontrol(8), ctld(8), ctlstat(8)
The ctladm
utility was originally written
during the Winter/Spring of 2003 as an interface to CTL.
Ken Merry <ken@FreeBSD.org>
August 6, 2020 | midnightbsd-3.1 |