| TARGETS.CONF(5) | [FIXME: manual] | TARGETS.CONF(5) |
NAME
targets.conf - Linux SCSI Target Configuration File
.SH "DESCRIPTION"
.PP tgt-admin uses /etc/tgt/targets.conf to initialize tgtd configuration, by
default. Its layout uses a HTML-like structure, with a hierarchy of nested
tags to define targets and LUNs.
.SH "CONFIGURATION FILE SYNTAX"
.PP Global directives configure options that are global to tgtd's
configuration, as well as defining exported targets, via target
sections.
.PP Target sections contain directives specific to one target device. They
define each target's exported LUNs via "backing-store" and
"direct-store" directives, as well as other target-wide
options.
.PP LUN directives ("backing-store" and "direct-store")
may contain options specific to a single exported logical unit.
.SH "GLOBAL DIRECTIVES"
.PP With the exception of target directives, each of these should occur at
most once.
.PP <target <IQN>>
Defines a the start of a target definition. IQN is an ISCSI Qualified Name
such as "iqn.2001-04.com.example:storage1".
Within this block should be target-level directives, as documented below.
The target definition ends with "</target>"
.RE
.PP default-driver <lld>
Instead of specifying a driver type for each target, default-driver defines a
default low-level driver for all exported targets. It may be overriden on a
per-target basis. Valid lld values are "iscsi" or
"iser". Since iscsi is assumed if this directive is not present,
it is only generally needed if iser is the desired default.
.RE
.PP include <path>
Include the configuration from another configuration file. Wildcards are
allowed, so an example like "include /etc/tgt/xen/*.conf" is
allowed.
.RE
.PP ignore-errors yes
Errors from tgtadm will be ignored. Default is no.
.RE
.PP control-port <port>
Define a different local socket key for communicating with tgtd. Defaults to
0. This is only generally useful if multiple instances of tgtd are in
use.
.RE
.PP iSNSServerIP <addr>
Define the address of the iSNS server in IPv4 dotted-quad address format.
Required when using iSNS, otherwise ignored.
.RE
.PP iSNSAccessControl <value>
Set iSNS access control. Valid values are "On" or "Off".
Required when using iSNS, otherwise ignored.
.RE
.PP iSNSServerPort <port>
Set a different iSNS server port. Default is 3205. Optional when using iSNS,
otherwise ignored.
.RE
.PP iSNS On
Enable iSNS. Only valid value is "On". Default is off.
.RE
.PP incomingdiscoveryuser <user> <userpassword>
Define iscsi incoming discovery authentication setting. If no value is given,
no authentication is performed.
.RE
.PP outgoingdiscoveryuser <user> <userpassword>
Define iscsi outgoing discovery authentication setting. If no value is given,
no authentication is performed.
.RE
.SH "TARGET-LEVEL DIRECTIVES"
.PP Each target may export multiple block devices, or logical units (LUNs).
For the purposes of LUN numbering, backing-store directives are processed
before direct-store directives.
.PP backing-store <path>
Defines a logical unit (LUN) exported by the target. This may specify either
a regular file, or a block device.
.RE
.PP direct-store <path>
Defines a direct mapped logical unit (LUN) with the same properties as the
physical device (such as VENDOR_ID, SERIAL_NUM, etc.)
.RE
.PP driver <lld>
Define the low-level driver to use for this target, either "iscsi"
or "iser" (without quotes). This overrides the
"default-driver" global directive.
.RE
.PP initiator-address <addr>
Allows connections only from the specified IP address. Defaults to ALL if no
initiator-address directive is specified.
.RE
.PP initiator-name <addr>
Allows connections only from the specified initiator name.
.RE
.PP incominguser <user> <userpassword>
Define iscsi incoming authentication setting. If no "incominguser"
is specified, it is not used. This directive may be used multiple times per
target.
.RE
.PP outgoinguser <user> <userpassword>
Define iscsi outgoing authentication setting. If no "outgoinguser"
is specified, it is not used. This directive may be used multiple times per
target.
.RE
.PP controller_tid <val>
Define the tid of the controller. Default is next available integer.
.RE
.SH "LUN-LEVEL DIRECTIVES"
.PP All of these may be listed at the target level (and apply to all LUNs) or
within an individual LUN's definition, if it is defined using the
container-style, multi-line definition, rather than single-line definition
format:
<backing-store /dev/sdb1>
# LUN directives go here </backing-store> <direct-store /dev/sdb1>
# LUN directives go here </direct-store>
.PP It is recommended to use either single-line or container-style LUN
definitions within a target. Mixing styles can cause parser errors.
.PP write-cache <val>
"on" or "off", default on.
.RE
.PP scsi_id <val>
.RE
.PP scsi_sn <val>
.RE
.PP vendor_id <val>
.RE
.PP product_id <val>
.RE
.PP product_rev <val>
.RE
.PP sense_format <val>
.RE
.PP removable <val>
.RE
.PP path <val>
.RE
.PP mode_page <val>
.RE
.PP readonly <val>
.RE
.PP device-type <val>
.RE
.PP bs-type <val>
.RE
.PP allow-in-use <val>
.RE
.PP block-size <val>
Specify the block size for this LUN.
.RE
.PP lbppbe <val>
Specify the Logical blocks per physical block exponent. By default TGTD will set the lbppbe to automatically match the underlying filesystem. Use this parameter to override that setting.
This is an internal option that should not be set directly.
.RE
.PP la_lba <val>
Specify the lowest aligned logical block address. This is an internal option that should not be set directly.
.RE
.PP optimal_xfer_gran <val>
Specify the optimal transfer granularity, to be reflected in the Block Limits VPD. This is an internal option that should not be set directly.
.RE
.PP optimal_xfer_len <val>
Specify the optimal transfer length, to be reflected in the Block Limits VPD. This is an internal option that should not be set directly.
.RE
.PP params <vals>
Pass additional parameters to tgtadm.
.RE
.SH "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>
.SH "FILES"
.PP /etc/tgt/targets.conf
Configuration file for tgt-admin.
.RE
.PP /usr/share/doc/tgt/targets.conf.example
Example configuration file for tgt-admin.
.RE
.SH "SEE ALSO"
.PP tgtd(8), tgtadm(8), tgtimg(8), tgt-setup-lun(8).
http://stgt.sourceforge.net/
.SH "REPORTING BUGS"
.PP Report bugs to <stgt@vger.kernel.org>
| 12/12/2025 | [FIXME: source] |