CTL(4)
π NAME π
ctl β CAM Target Layer, aka the icon, the moment, the whole vibe β¨
πΈ SYNOPSIS πΈ
okay so if you wanna bake this driver right into your kernel, bestie, drop this line into your kernel configuration file:
device ctl
orrr, if you'd rather load it as a module at boot time (lowkey easier ngl), put this in loader.conf(5):
ctl_load="YES"
π¦ DESCRIPTION π¦
The ctl subsystem is literally the SCSI target devices emulation queen π. She does all of this:
- Disk, CD-ROM and processor device emulation π
- Tagged queueing
- SCSI task attribute support (ordered, head of queue, simple tags)
- SCSI implicit command ordering support
- Full task management support (abort, query, reset, etc.) β she can abort things, periodt
- Support for multiple ports, initiators, targets and backing stores
- Support for VMWare VAAI and Microsoft ODX offload (COMPARE AND WRITE, XCOPY, POPULATE TOKEN/WRITE USING TOKEN, WRITE SAME and UNMAP) π₯
- Persistent reservation support
- Extensive VPD/mode/log pages support
- Featured error reporting, error injection and basic SMART support
- High Availability clustering support with ALUA
- All I/O handled in-kernel, no userland context switch overhead β no context switching, no drama, no overhead, she's built different fr fr
The ctl subsystem also has multiple frontends so she can speak to everybody in their own love language π«Ά, each one giving access via a different transport protocol and implementation:
camsimβ gives access for local system via virtual initiator modeCAM(4)SIM.camtgtβ gives access for remote systems via target modeCAM(4)SIMs, such as Fibre Channelisp(4)andmpt(4).cfumassβ gives access for remote systems via USB Mass Storage Class Bulk Only (BBB) Transport.haβ internal frontend used to receive requests from other node ports in High Availability cluster.ioctlβ gives access for local user-level applications viaioctl(2)based API.iscsiβ gives access for remote systems via the iSCSI protocol usingcfiscsi(4).tpcβ internal frontend used to receive requests from Third Party Copy engine, implementing copy offload operations.
And she's got two backends to create logical units using different kinds of backing stores, because obviously she needs options πββοΈ:
blockβ stores data in ZFS ZVOLs, files or raw block devices.ramdiskβ stores data in RAM, that makes it mostly useful for performance testing. Depending on configured capacity can work as black hole, thin or thick provisioned disk.
β¨ SYSCTL VARIABLES β¨
These ones are available as both sysctl(8) variables and loader(8) tunables, so you can vibe with them however you like:
kern.cam.ctl.debugβ bit mask of enabled CTL log levels:1β log commands with errors;2β log all commands;4β log data for commands other then READ/WRITE.
Defaults to 0.
kern.cam.ctl.ha_idβ specifies unique position of this node within High Availability cluster. Default is0β no HA,1and2β HA enabled at specified position.kern.cam.ctl.ha_modeβ specifies High Availability cluster operation mode:0β Active/Standby β primary node has backend access and processes requests, while secondary can only do basic LUN discovery and reservation;1β Active/Active β both nodes have backend access and process requests, while secondary node synchronizes processing with primary one;2β Active/Active β primary node has backend access and processes requests, while secondary node forwards all requests and data to primary one.
All above modes require established connection between HA cluster nodes. If connection is not configured, secondary node will report Unavailable state; if configured but not established β Transitioning state. Defaults to 0.
kern.cam.ctl.ha_peerβ string value, specifying method to establish connection to peer HA node. Can be"listen IP:port","connect IP:port"or empty.kern.cam.ctl.ha_linkβ reports present state of connection between HA cluster nodes:0β not configured;1β configured but not established;2β established.
kern.cam.ctl.ha_roleβ specifies default role of this node:0β primary;1β secondary.
This role can be overridden on per-LUN basis using "ha_role" LUN option, so that for one LUN one node is primary, while for another β another. Role change from primary to secondary for HA modes 0 and 2 closes backends, the opposite change β opens. If there is no primary node (both nodes are secondary, or secondary node has no connection to primary one), secondary node(s) report Transitioning state. State with two primary nodes is illegal (split brain condition).
π¨ heads up bestie: two primary nodes = split brain = illegal, we do NOT do that here π
π TUNABLE VARIABLES π
These ones live as loader(8) tunables:
kern.cam.ctl.max_lunsβ specifies the maximum number of LUNs we support, must be a power of 2. The default value is1024.kern.cam.ctl.max_portsβ specifies the maximum number of ports we support, must be a power of 2. The default value is256.
π reminder: power of 2, bestie. Not 1000. Not 1023. Power. Of. Two. β¨
π SEE ALSO π
cfiscsi(4), cfumass(4), ctladm(8), ctld(8), ctlstat(8)
π HISTORY π
The ctl subsystem first appeared in FreeBSD 9.1. a true 2012-era icon, she's been serving looks for years π
π AUTHORS π
The ctl subsystem was originally written by Kenneth Merry <ken@FreeBSD.org>. Later work was done by Alexander Motin <mav@FreeBSD.org>. legends, honestly π«Ά
okay that's the whole page, you're so welcome π this was the Debian build, dated March 29, 2017 β mwah, go slay some SCSI targets β¨π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2013 Edward Tomasz Napierala
- Copyright (c) 2015-2017 Alexander Motin <mav@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms