17
17
<command>tgtadm [OPTIONS]...</command>
18
18
<arg choice="opt">-C --control-port <port></arg>
19
<arg choice="opt">--lld <driver></arg>
20
<arg choice="opt">--op <operation></arg>
21
<arg choice="opt">--mode <mode></arg>
22
<arg choice="opt">--tid <tid></arg>
19
<arg choice="opt">-L --lld <driver></arg>
20
<arg choice="opt">-o --op <operation></arg>
21
<arg choice="opt">-m --mode <mode></arg>
22
<arg choice="opt">-t --tid <id></arg>
23
23
<arg choice="opt">-T --targetname <targetname></arg>
24
24
<arg choice="opt">-Y --device-type <type></arg>
25
<arg choice="opt">--lun <lun></arg>
26
<arg choice="opt">--backing-store <path></arg>
27
<arg choice="opt">--initiator-address <address></arg>
28
<arg choice="opt">--name <parameter></arg>
29
<arg choice="opt">--value <value></arg>
30
<arg choice="opt">--params <param=value[,param=value...]></arg>
31
<arg choice="opt">--help</arg>
25
<arg choice="opt">-l --lun <lun></arg>
26
<arg choice="opt">-b --backing-store <path></arg>
27
<arg choice="opt">-E --bstype <type></arg>
28
<arg choice="opt">-I --initiator-address <address></arg>
29
<arg choice="opt">-n --name <parameter></arg>
30
<arg choice="opt">-v --value <value></arg>
31
<arg choice="opt">-P --params <param=value[,param=value...]></arg>
32
<arg choice="opt">-h --help</arg>
71
72
cd : emulate a DVD drive
72
73
changer : emulate a media changer device
75
<varlistentry><term><option>--lld [driver] --op new --mode target --tid=[id] --targetname [name]</option></term>
78
Add a new target with [id] and [name].
83
<varlistentry><term><option>--lld [driver] --op delete --mode target --tid=[id]</option></term>
86
Delete specific target with [id]. The target must have no active I_T nexus.
91
<varlistentry><term><option>--lld [driver] --op show --mode target</option></term>
74
pt : passthrough type to export a /dev/sg device
77
<varlistentry><term><option>-E, --bstype <type></option></term>
80
When creating a LUN, this parameter specifies the type of backend storage
85
<screen format="linespecific">
86
Possible backend types are:
87
rdwr : Use normal file I/O. This is the default for disk devices
88
aio : Use Asynchronous I/O
89
mmap : Use memory mapping for the backend file
91
sg : Special backend type for passthrough devices
92
ssc : Special backend type for tape emulation
95
<varlistentry><term><option>--lld <driver> --op new --mode target --tid <id> --targetname <name></option></term>
98
Add a new target with <id> and <name>.
103
<varlistentry><term><option>--lld <driver> --op delete --mode target --tid <id></option></term>
106
Delete specific target with <id>. The target must have no active I_T nexus.
111
<varlistentry><term><option>--lld <driver> --op show --mode target</option></term>
94
114
Show all the targets.
99
<varlistentry><term><option>--lld [driver] --op show --mode target --tid=[id]</option></term>
119
<varlistentry><term><option>--lld <driver> --op show --mode target --tid <id></option></term>
102
Show target parameters of a target with [id].
122
Show target parameters of a target with <id>.
107
<varlistentry><term><option>--lld [driver] --op new --mode=logicalunit --tid=[id] --lun=[lun] --backing-store [path]</option></term>
127
<varlistentry><term><option>--lld <driver> --op new --mode logicalunit --tid <id> --lun <lun> --backing-store <path></option></term>
110
Add a new logical unit with [lun] to specific target with [id]. The
111
logical unit is offered to the initiators. [path] must be block device
130
Add a new logical unit with <lun> to specific target with <id>. The
131
logical unit is offered to the initiators. <path> must be block device
112
132
files (including LVM and RAID devices) or regular files. lun0 is
113
133
reserved for a special device automatically created.
118
<varlistentry><term><option>--lld [driver] --op delete --mode=logicalunit --tid=[id] --lun=[lun]</option></term>
138
<varlistentry><term><option>--lld <driver> --op delete --mode logicalunit --tid <id> --lun <lun></option></term>
121
Delete specific logical unit with [lun] that the target with [id] has.
141
Delete specific logical unit with <lun> that the target with <id> has.
126
<varlistentry><term><option>--lld [driver] --op bind --mode=target --tid=[id] --initiator-address=[address]</option></term>
146
<varlistentry><term><option>--lld <driver> --op bind --mode target --tid <id> --initiator-address <address></option></term>
129
Add the address to the access lists of the target with [id]. Initiators
149
Add the address to the access lists of the target with <id>. Initiators
130
150
with the address can access to the target. 'ALL' is a special address
131
151
to allow all initiators to access to a target.
136
<varlistentry><term><option>--lld [driver] --op unbind --mode=target --tid=[id] --initiator-address=[address]</option></term>
139
Delete the address from the access lists of the target with [id].
144
<varlistentry><term><option>--lld [driver] --op update --mode=target --tid=[id] --name=[parameter] --value=[value]</option></term>
147
Change the value of [parameter] of the target with [id] to [value].
152
<varlistentry><term><option>--lld [driver] --op update --mode=target --tid=[id] --params parameter=value[,...]</option></term>
156
<varlistentry><term><option>--lld <driver> --op unbind --mode target --tid <id> --initiator-address <address></option></term>
159
Delete the address from the access lists of the target with <id>.
164
<varlistentry><term><option>--lld <driver> --op update --mode target --tid <id> --name=<parameter> --value=<value></option></term>
167
Change the value of <parameter> of the target with <id> to <value>.
172
<varlistentry><term><option>--lld <driver> --op update --mode target --tid <id> --params parameter=value<,...></option></term>
155
175
Sets/changes the value of one or more parameters.
288
308
--params mode_page=0x1c:0:10:8:0:0:0:0:0:0:0:0:0
311
<varlistentry><term><option>readonly=<0|1></option></term>
314
This sets the read-only flag of a LUN. A read-only LUN will
315
refuse any attempts to write data to it.
318
This parameter only applies to DISK devices.
323
<screen format="linespecific">
324
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 1 \
374
410
# Create a target
375
tgtadm --lld iscsi --mode target --op new --tid 1 -T iqn.2007-03:virtual-dvd:`hostname`
411
tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2007-03:virtual-dvd:`hostname`
377
413
# Create a DVD drive and give it a nice name
378
414
# The dvd starts out without a backing store file, i.e. no disk loaded
379
tgtadm --op new --mode logicalunit --tid 1 --lun 1 -Y cd
415
tgtadm --op new --mode logicalunit --tid 1 --lun 1 --device-type cd
380
416
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 1 --params vendor_id=STGT_DVD,product_id=DVD101,product_rev=0010,scsi_sn=STGTDVD01,removable=1
382
418
# We need a backend store file for the media changer
387
423
# Create the SMC device and give it a nice name
388
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 -b $HOME/smc --device-type=changer
424
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 --backing-store $HOME/smc --device-type changer
389
425
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params vendor_id=STK,product_id=L700,product_rev=0010,scsi_sn=XYZZY_0,removable=1
391
427
# Add a Data Transfer devices (1 drive)
416
452
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params element_type=2,address=1025,barcode=DISK_002,sides=1
418
454
# Allow ALL initiators to connect to this target
419
tgtadm --lld iscsi --mode target --op bind --tid 1 -I ALL
455
tgtadm --lld iscsi --mode target --op bind --tid 1 --initiator-address ALL
421
457
# Show all our good work.
422
458
tgtadm --lld iscsi --mode target --op show
465
<refsect1><title>Passthrough devices</title>
467
In addition to device emulation TGTD also supports utilizing existing SG devices on the host and exporting these through a special passthrough device type.
469
<varlistentry><term><option>--bstype=sg</option></term>
472
This specifies that an SG devices is used.
476
<varlistentry><term><option>--device-type=pt</option></term>
479
This specifies that passthrough device type is used.
483
<varlistentry><term><option>--backing-store=</dev/sg4></option></term>
486
This specifies which device to export through TGTD.
490
<screen format="linespecific">
492
Make /dev/sg4 available to initiators connecting to TGTD.
494
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 --bstype=sg --device-type=pt --backing-store=/dev/sg4
500
<refsect1><title>Header Digest and Data Digest</title>
502
Header and data digests can be set on a per target parameter.
503
TGTD supports two modes, None and CRC32C.
504
When the digest is set to None, TDTD will negotiate that digests
505
will not be used, and when CRC32C is set, TGTD will force the
506
connection to use digest.
509
<refsect2><title>Viewing the current settings</title>
511
This command is used to view the current settings for header/data
514
<screen format="linespecific">
515
tgtadm --op show --mode target --tid 1
522
<refsect2><title>Setting digest</title>
523
<screen format="linespecific">
524
Set header digest to CRC32C:
525
tgtadm --op update --mode target --tid 1 -n HeaderDigest -v CRC32C
527
Set data digest to None:
528
tgtadm --op update --mode target --tid 1 -n DataDigest -v None
429
536
<refsect1><title>iSNS PARAMETERS</title>
431
538
iSNS configuration for a target is by using the tgtadm command.