These steps are for Debian Squeeze.
apt-get install tgt
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/
Load the module and have the daemon listen on default port 3260
tgtd
tgtadm --lld iscsi --op new --mode target --tid 1 \
-T iqn.2010-08.com.example:san1.disk
Allow access from segment 192.168.0.0/24 :
tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.0.0/24
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
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