ISCSI Initiator Tagret on Ubuntu GNU Linux 8 04 LTS
id : yittal7q1o
category : computer
blog : unixlinux
created : 02/12/10 - 20:24:30

Target :

Installation :


  • First of all install target (server) binaries on the server :
root@target# apt-get install iscsitarget


  • And verify if service is currently running :
root@target# ps -edf | grep ietd | grep -v grep
root      4269     1  0 16:40 ?       00:00:00 /usr/sbin/ietd
root@target# netstat -antp | grep LISTEN | grep 3260
tcp    0    0 0.0.0.0:3260    0.0.0.0:*   LISTEN    4269/ietd


  • You're done with installation !

Configuration :


We want to add 3 SCSI target :
    • One on /dev/sda2 (for a ftp, on ext3)
    • One on /dev/sda3 (for an apache, on ext3)
    • One on /dev/sda4 (for a IIS, on NTF)

  • Edit /etc/ietd.conf and add :
#Our configuration :
#Target for ftp => ext3; /dev/sda2
Target iqn.2010-02.fr.test:ftp
        Lun 0 Path=/dev/sda2,Type=fileio

#Target for apache => ext3, /dev/sda3
Target iqn.2010-02.fr.test:apache
        Lun 0 Path=/dev/sda3,Type=fileio

#Target for IIS => ntfs, /dev/sda4
Target iqn.2010-02.fr.test:iis
        Lun 0 Path=/dev/sda4,Type=fileio



  • Restart ietd service :
root@target# /etc/init.d/ietd restart


  • And verify your configuration :
root@target# cat /proc/net/iet/volume
tid:3 name:iqn.2010-02.fr.test:ftp
        lun:0 state:0 iotype:fileio iomode:wt path:/dev/sda4
tid:2 name:iqn.2010-02.fr.test:apache
        lun:0 state:0 iotype:fileio iomode:wt path:/dev/sda3
tid:1 name:iqn.2010-02.fr.test:iis
        lun:0 state:0 iotype:fileio iomode:wt path:/dev/sda2


Initiator :

  • You now need to configure your initiator (client) on each machine (ftp, apache, iis) :

On Linux (ftp, apache) :


Installation :


  • First of all install open-scsi initiator (client) :
root@client# apt-get install open-iscsi


  • And discovery targets (mode discovery, just listen available targets on iscsi server) :
root@client# iscsiadm --mode discovey --type sendtargets --portal 195.7.102.210
195.7.102.210:3260,1 iqn.2010-02.fr.test:ftp
195.7.102.210:3260,1 iqn.2010-02.fr.test:apache
195.7.102.210:3260,1 iqn.2010-02.fr.test:iis


Configuration :


  • Now establish a session with wanted target (mode node, in this exemple : iqn.2010-02.fr.test:ftp)
root@client# iscsiadm --mode node --targetname iqn.2010-02.fr.test:ftp --portal 195.7.102.210 --login
Login session [iface: default, target: iqn.2010-02.fr.test:ftm, portal: 195.7.102.210,3260]


  • To enable your session at server reboot just modifiy your /etc/iscsi/iscsid.conf and replace the line :
    • node.startup = manual
by
    • node.startup = automatic

  • You can enable a setup by session :
root@client# iscsiadm --mode node --targetname iqn.2010-02.fr.test:ftp --op update --name node.startup
--value automatic


  • To remove a session just use iscsi command with --logout parameter :
root@client# iscsiadm --mode node --targetname iqn.2010-02.fr.test:ftp --portal 195.7.102.210 --logout
Logout session [sid: 1, target: iqn.2010-02.fr.test:ftp, portal: 195.7.102.210,3260]


  • Be sure youre initiator name is uniq on the network :
root@client# cat /etc/iscsi/initiatorname.isci
InitiatorName=iqn.1993-08.org.debian:01:5fe15fde5665


On Windows (IIS)


Installation

Configuration


  • You're done