Installation d’une target

root@target:~# apt-get install iscsitarget iscsitarget-source
root@target:~# module-assistant
root@target:~# cat /etc/iet/ietd.conf
Target iqn.2012-10.domain.my.target:data
    Lun 0 Path=/dev/storage/data,Type=blockio
    Alias data
    IncomingUser test blablablaaa
root@target:~# /etc/init.d/iscsitarget start
root@target:~# cat /proc/net/iet/volume
tid:1 name:iqn.2012-10.domain.my.target:data

Installation d’un initiator

root@init:~# apt-get install open-iscsi
root@init:~# /etc/init.d/open-iscsi start
root@init:~# iscsiadm -m discovery -t sendtargets -p 192.168.1.223
192.168.1.223:3260,1 iqn.2012-10.domain.my.target:data
root@init:~# iscsiadm -m node -T iqn.2012-10.domain.my.target:data -p 192.168.1.223 -o update -n node.session.auth.username -v test
root@init:~# iscsiadm -m node -T iqn.2012-10.domain.my.target:data -p 192.168.1.223 -o update -n node.session.auth.password -v blablablaaa
root@init:~# iscsiadm -m node -T iqn.2012-10.domain.my.target:data -p 192.168.1.223 -l
Logging in to [iface: default, target: iqn.2012-10.domain.my.target:data, portal: 192.168.1.223,3260]
Login to [iface: default, target: iqn.2012-10.domain.my.target:data, portal: 192.168.1.223,3260]: successful
root@init:~# tail -n 10 /var/log/messages
Oct 12 13:58:28 init kernel: [    9.742667] iscsi: registered transport (tcp)
Oct 12 14:03:47 init kernel: [  329.271809] iscsi: registered transport (iser)
Oct 12 14:07:21 init kernel: [  544.033813] scsi3 : iSCSI Initiator over TCP/IP
Oct 12 14:07:23 init kernel: [  545.116336] scsi 3:0:0:0: Direct-Access     IET      VIRTUAL-DISK     0    PQ: 0 ANSI: 4
Oct 12 14:07:23 init kernel: [  545.119073] sd 3:0:0:0: Attached scsi generic sg2 type 0
Oct 12 14:07:23 init kernel: [  545.130552] sd 3:0:0:0: [sdb] 2097152 512-byte logical blocks: (1.07 GB/1.00 GiB)
Oct 12 14:07:23 init kernel: [  545.130985] sd 3:0:0:0: [sdb] Write Protect is off
Oct 12 14:07:23 init kernel: [  545.131804] sd 3:0:0:0: [sdb] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA
Oct 12 14:07:23 init kernel: [  545.134005]  sdb: unknown partition table
Oct 12 14:07:23 init kernel: [  545.145458] sd 3:0:0:0: [sdb] Attached SCSI disk
root@init:~# ls -l /dev/disk/by-path/ | grep sdb
lrwxrwxrwx 1 root root  9 Oct 12 14:07 ip-192.168.1.223:3260-iscsi-iqn.2012-10.domain.my.target:data-lun-0 -> ../../sdb
root@init:~# iscsiadm -m node -T iqn.2012-10.domain.my.target:data -p 192.168.1.223 -o update -n node.conn[0].startup -v automatic
root@init:~# /etc/init.d/open-iscsi
root@target:~# cat /proc/net/iet/session
tid:1 name:iqn.2012-10.domain.my.target:data
sid:281474997486080 initiator:iqn.1993-08.org.debian:01:9cfd28ac883
cid:0 ip:192.168.1.221 state:active hd:none dd:none
root@target:~# fdisk -l
root@target:~# fdisk /dev/sdb
root@target:~# mkfs.ext3 /dev/sdb1
root@target:~# echo "/dev/sdb1 /mnt ext3 defaults,_netdev 0 0" >> /etc/fstab