TARGETS.CONF(5)

NAME
targets.conf - Linux SCSI Target Configuration File

DESCRIPTION

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.

CONFIGURATION FILE SYNTAX

Global directives configure options that are global to tgtd's configuration, as well as defining exported targets, via target sections.

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.

LUN directives ("backing-store" and "direct-store") may contain options specific to a single exported logical unit.

GLOBAL DIRECTIVES

With the exception of target directives, each of these should occur at most once.

<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>"

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.

include <path>
    Include the configuration from another configuration file. Wildcards are allowed, so an example like "include /etc/tgt/xen/*.conf" is allowed.

ignore-errors yes
    Errors from tgtadm will be ignored. Default is no.

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.

iSNSServerIP <addr>
    Define the address of the iSNS server in IPv4 dotted-quad address format. Required when using iSNS, otherwise ignored.

iSNSAccessControl <value>
    Set iSNS access control. Valid values are "On" or "Off". Required when using iSNS, otherwise ignored.

iSNSServerPort <port>
    Set a different iSNS server port. Default is 3205. Optional when using iSNS, otherwise ignored.

iSNS On
    Enable iSNS. Only valid value is "On". Default is off.

incomingdiscoveryuser <user> <userpassword>
    Define iscsi incoming discovery authentication setting. If no value is given, no authentication is performed.

outgoingdiscoveryuser <user> <userpassword>
    Define iscsi outgoing discovery authentication setting. If no value is given, no authentication is performed.

TARGET-LEVEL DIRECTIVES

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.

backing-store <path>
    Defines a logical unit (LUN) exported by the target. This may specify either 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 (such as VENDOR_ID, SERIAL_NUM, etc.)

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.

initiator-address <addr>
    Allows connections only from the specified IP address. Defaults to ALL if no initiator-address directive is specified.

initiator-name <addr>
    Allows connections only from the specified initiator name.

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.

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.

controller_tid <val>
    Define the tid of the controller. Default is next available integer.

LUN-LEVEL DIRECTIVES

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>

It is recommended to use either single-line or container-style LUN definitions within a target. Mixing styles can cause parser errors.

write-cache <val>
    "on" or "off", default on.

scsi_id <val>

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 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.

la_lba <val>
    Specify the lowest aligned logical block address. This is 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. This is an internal option that should not be set directly.

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.

params <vals>
    Pass additional parameters to tgtadm.

    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 for tgt-admin.

/usr/share/doc/tgt/targets.conf.example
    Example configuration file for tgt-admin.

SEE ALSO

tgtd(8), tgtadm(8), tgtimg(8), tgt-setup-lun(8). https://github.com/fujita/tgt

REPORTING BUGS

Report bugs to <stgt@vger.kernel.org>