this is obsolete doc -- see http://doc.nethence.com/ instead

Configuring an iSCSI target on RHEL5/6 

 

Introduction 

The IET iSCSI target software is available with Redhat since RHEL release 5 update 3. 

 

Installation 

Make sure those packages are installed, 

rpm -q scsi-target-utils sg3_utils

Note. 'sg3-utils' is needed in case you want to share a whole disk with 'direct-store'. 

 

Start and enable the daemon at boot time, 

service tgtd start
chkconfig tgtd on

 

Configuration 

Make sure you've got a LV or an disk to share, 

fdisk -cul | grep ^Disk

and configure a target against it and apply, 

  cd /etc/tgt/
  mv targets.conf targets.conf.dist
sed -e '
/^[[:space:]]*$/d;
/^[[:space:]]*#/d;
' targets.conf.dist > targets.conf
cat >> targets.conf <<EOF9
<target iqn.2012-12.local.example:SERVER_NAME.target1>
        #direct-store /dev/sdb
        backing-store /dev/sdb
        write-cache on
</target>
EOF9
service tgtd restart

Note. Change the month and year accordingly (optional). 

Note the reverse domaine name (optional). 

Note. Eventually change the comment after the colon (:). 

Note. Only lowercase characters (MS Windows iSCSI initiator won't accept uppercase characters). 

Note. Write cache is enabled by default. 

 

References 

24.2.2. iSCSI Target Setup (https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/iscsi-target-setup.html) 

Bug#565168: tgt should recommend sg3-utils (http://lists.debian.org/debian-kernel/2010/01/msg00305.html)