Difference between revisions of "ISCSI/tgt"

From ArchWiki
Jump to: navigation, search
(Start)
(Start)
Line 61: Line 61:
  
 
  systemctl start tgtd
 
  systemctl start tgtd
 +
 +
systemctl status tgtd
 +
● tgtd.service - iSCSI server for Arch Linux
 +
  Loaded: loaded (/usr/lib/systemd/system/tgtd.service; disabled; vendor preset: disabled)
 +
  Active: active (running) since Wed 2015-09-02 09:05:30 EDT; 43min ago
 +
Main PID: 1516 (tgtd)
 +
  CGroup: /system.slice/tgtd.service
 +
          ├─1516 /usr/sbin/tgtd
 +
          └─1518 /usr/sbin/tgtd
 +
  
 
You can check if everything works like expected:
 
You can check if everything works like expected:

Revision as of 17:49, 2 September 2015

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: Dutch article is the original, English is not my native language. (Discuss in Talk:ISCSI/tgt#)

The TGT SCSI framework can be used for several storage protocols. This document describes the usage of TGT as iSCSI target.

Why TGT

There are several different iSCSI targets for Linux available, with more or less the same performance. TGT has the following advantages:

  • active development
  • the only iSCSI target that can be used for vSphere environments

Installation

Install the tgtAUR package. If you want to use the direct store, then sg3_utils must also be installed.

Using direct-store, the properties of the physical device will be available for the initiator and target.

Please notice, if you're using a Firewall, tcp port 3260 should be open.

Configuration

The configuration can be done:

  • using the tgtadm utility, afterwards you can use tgt-admin --dump to save the configuration.
    You can find this method in the Scsi-target-utils Quickstart Guide, as linked from the TGT website. Unfortunately the bad thing about this method is that not all parameters will be stored in the configuration file.
  • editing the /etc/tgt/targets.conf file.

Example configuration

<target iqn.2004-01.nl.xtg:iscsi-server1>
 direct-store /dev/sdb
 write-cache on
 initiator-address ALL
 incominguser user password
 scsi_id 00010001
 vendor_id XTG
 lun 12
</target>
MaxRecvDataSegmentLength 131072
MaxXmitDataSegmentLength 131072
MaxBurstLength 262144
FirstBurstLength 262144
TargetRecvDataSegmentLength=262144
InitiatorRecvDataSegmentLength=262144
MaxOutstandingUnexpectedPDUs=0
MaxOutstandingR2T=1
MaxCommands=128

In the first part of this example, /dev/sdb will be offered as lun 12 and chap authentication is configured. In the second part are some iSCSI advanced parameters

Start

If the configuration is well done, TGT can be started/enabled with the tgtd.service unit.

systemctl start tgtd
systemctl status tgtd

● tgtd.service - iSCSI server for Arch Linux

  Loaded: loaded (/usr/lib/systemd/system/tgtd.service; disabled; vendor preset: disabled)
  Active: active (running) since Wed 2015-09-02 09:05:30 EDT; 43min ago
Main PID: 1516 (tgtd)
  CGroup: /system.slice/tgtd.service
          ├─1516 /usr/sbin/tgtd
          └─1518 /usr/sbin/tgtd


You can check if everything works like expected:

tgt-admin -s

See also