TARGETS.CONF(5)
π targets.conf(5) π
okay so this is the manpage for targets.conf β literally the Linux SCSI Target Configuration File β and bestie, if you're messing with iSCSI targets you're gonna want to get cozy with it. π
β¨ NAME β¨
targets.conf β Linux SCSI Target Configuration File π¦
πΈ DESCRIPTION πΈ
So tgt-admin reads /etc/tgt/targets.conf to initialize the tgtd configuration β that's the default, no cap. The layout is giving HTML, honestly: it's a whole hierarchy of nested tags that define your targets and your LUNs. Think of it like a vibe-coded little XML cousin and you're golden. β¨
π CONFIGURATION FILE SYNTAX π
Global directives configure the options that are global to tgtd's configuration β and they also define your exported targets, via target sections. Two jobs, main character energy. π
Target sections hold directives specific to one target device. They define each target's exported LUNs via the backing-store and direct-store directives, plus all the other target-wide options.
LUN directives (you guessed it: backing-store and direct-store) can contain options specific to a single exported logical unit. Tiny but mighty. π§
π GLOBAL DIRECTIVES π
Heads up before we go: with the exception of target directives, each of these should occur at most once. So no spamming them, okay? π«Ά
<target <IQN>>β this kicks off a target definition, the opening tag basically. IQN is an ISCSI Qualified Name, likeiqn.2001-04.com.example:storage1. Inside this block you put the target-level directives (documented below, mwah π). The whole thing closes with</target>.default-driver <lld>β instead of specifying a driver type for every single target (exhausting),default-driversets a default low-level driver for all exported targets. It can be overriden on a per-target basis, so it's not a forever commitment. Valid lld values areiscsioriser. And sinceiscsiis assumed when this directive isn't present, you only really need this ifiseris the default you're after.include <path>β pulls the configuration in from another config file. Wildcards are allowed! So something likeinclude /etc/tgt/xen/*.confis fully legal. slay. β¨ignore-errors yesβ errors fromtgtadmget ignored. Default is no.control-port <port>β define a different local socket key for communicating withtgtd. Defaults to 0. Only generally useful when you've got multiple instances oftgtdrunning.iSNSServerIP <addr>β define the address of the iSNS server, in IPv4 dotted-quad address format. Required when you're using iSNS; otherwise it just sits there ignored. πiSNSAccessControl <value>β set iSNS access control. Valid values areOnorOff. Again: required when using iSNS, otherwise ignored.iSNSServerPort <port>β set a different iSNS server port. Default is 3205. Optional when you're using iSNS, otherwise ignored.iSNS Onβ enables iSNS. The only valid value isOn. Default is off.incomingdiscoveryuser <user> <userpassword>β define the iscsi incoming discovery authentication setting. If no value is given, no authentication is performed. (fyi, "no auth" is a whole vibe but maybe not the vibe π€¨)outgoingdiscoveryuser <user> <userpassword>β define the iscsi outgoing discovery authentication setting. If no value is given, no authentication is performed.
π¦ TARGET-LEVEL DIRECTIVES π¦
Every target can export multiple block devices, aka logical units (LUNs). And for the purposes of LUN numbering: backing-store directives are processed before direct-store directives. Order matters, iykyk. π
backing-store <path>β defines a logical unit (LUN) exported by the target. The path can be a regular file or a block device.direct-store <path>β defines a direct mapped logical unit (LUN) with the same properties as the physical device β stuff likeVENDOR_ID,SERIAL_NUM, etc. It's literally the device, no filter. πͺdriver <lld>β the low-level driver for this target, eitheriscsioriser(no quotes, queen). This overrides thatdefault-driverglobal directive from earlier. Override era.initiator-address <addr>β allows connections only from the specified IP address. Defaults to ALL if you don't specify anyinitiator-addressdirective.initiator-name <addr>β allows connections only from the specified initiator name.incominguser <user> <userpassword>β define the iscsi incoming authentication setting. If noincominguseris specified, it's not used. This one can be used multiple times per target, go off. π₯outgoinguser <user> <userpassword>β define the iscsi outgoing authentication setting. If nooutgoinguseris specified, it's not used. Also usable multiple times per target.controller_tid <val>β define the tid of the controller. Default is the next available integer.
π LUN-LEVEL DIRECTIVES π
Okay so here's the tea: all of these can be listed at the target level (in which case they apply to all LUNs) or inside an individual LUN's definition β that second thing only works if the LUN is defined with the container-style, multi-line definition instead of the single-line format:
<backing-store /dev/sdb1>
# LUN directives go here
</backing-store>
<direct-store /dev/sdb1>
# LUN directives go here
</direct-store>
β οΈ real talk: use either single-line or container-style LUN definitions within a target. Mixing the two styles can cause parser errors, and the parser is not in the mood. π
write-cache <val>βonoroff. Default is on.scsi_id <val>β that's it, that's the entry π«Άscsi_sn <val>vendor_id <val>product_id <val>product_rev <val>sense_format <val>removable <val>path <val>mode_page <val>readonly <val>device-type <val>bs-type <val>allow-in-use <val>block-size <val>β specify the block size for this LUN.lbppbe <val>β specify the Logical blocks per physical block exponent. By defaultTGTDwill set thelbppbeto automatically match the underlying filesystem β use this parameter to override that setting.
π this is an internal option that should not be set directly. Like, seriously.
la_lba <val>β specify the lowest aligned logical block address.
π also an internal option that should not be set directly.
optimal_xfer_gran <val>β specify the optimal transfer granularity, to be reflected in the Block Limits VPD.
π internal option, do not set directly. seeing a pattern?
optimal_xfer_len <val>β specify the optimal transfer length, to be reflected in the Block Limits VPD.
π internal option, do not set directly.
params <vals>β pass additional parameters totgtadm.
Note that '${tid}' and '${lun}' can be used verbatim to refer to the tid and lun that are being configured. See targets.conf.vtl.L700 for an example. β¨
β CONFIGURATION FILE EXAMPLE β
Example configuration file:
<target iqn.2007-04.com.example:san.monitoring>
backing-store /dev/san/monitoring
# if no "incominguser" is specified, it is not used
incominguser backup secretpass12
# defaults to ALL if no "initiator-address" is specified
initiator-address 192.168.1.2
</target>
<target iqn.2007-02.com.example:san.xen1>
backing-store /dev/san/xen1-disk1 # LUN1
direct-store /dev/san/xen1-disk2 # LUN2
initiator-address 192.168.1.2 # Allowed IP
initiator-address 192.168.5.6 # Allowed IP
incominguser user1 secretpass12
incominguser user2 secretpass23
outgoinguser userA secretpassA
</target>
<target iqn.2007-02.com.example:san.xen2>
backing-store /dev/san/xen2
</target>
<target iqn.2007-06.com.example:san.vmware1>
backing-store /dev/san/vmware1
</target>
π FILES π
/etc/tgt/targets.confβ configuration file fortgt-admin./usr/share/doc/tgt/targets.conf.exampleβ example configuration file fortgt-admin.
π SEE ALSO π
tgtd(8), tgtadm(8), tgtimg(8), tgt-setup-lun(8).
π§ REPORTING BUGS π§
Report bugs to <stgt@vger.kernel.org> π
and that's the whole page, bestie! π this one came from [FIXME: source] and it's dated 11/01/2026 β so if you're reading it some other time, hi from the past, hope your LUNs are numbered correctly πβ¨π¦
π¦ where this page comes from
- alpine 3.24: scsi-tgt-doc 1.0.98-r0 Β· GPL-2.0-only
- arch rolling: tgt 1.0.98-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms