Setup STGT iSCSI target

These steps are for Debian Squeeze.

Install required package

Install stock package

apt-get install tgt

Build from source

For example, build version 1.0.8.

cd ./tgt-1.0.8/usr
make ISCSI=1
strip tgtd tgtadm tgtimg
cp -v tgtd tgtadm tgtimg /usr/sbin/

Start tgtd daemon

Load the module and have the daemon listen on default port 3260

tgtd

Create the target

tgtadm --lld iscsi --op new --mode target --tid 1 \
    -T iqn.2010-08.com.example:san1.disk

Setup access control

Allow access from segment 192.168.0.0/24 :

tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.0.0/24

Add disk device (LUN)

For example, add /dev/mapper/vg_san-lv1:

tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/mapper/vg_san-lv1

Check

tgtadm --lld iscsi --op show --mode target

Output:

# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2010-08.com.example:san1.disk
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store type: null
            Backing store path: None
            Backing store flags:
        LUN: 1
            Type: disk
            SCSI ID: IET     00010001
            SCSI SN: beaf11
            Size: 4291 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: /dev/mapper/vg_san-lv1
            Backing store flags:
    Account information:
    ACL information:
        192.168.0.0/24

Connecting the target

Reference

tips/setup_stgt_iscsi_target.txt · Last modified: 2010-08-31 20:03 by admin
Back to top
GNU Free Documentation License 1.3
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0