CentOS 6
Configure iSCSI Target
2014/08/05
 
Configure Storage Server with iSCSI.
A storage on a network is called iSCSI Target, a Client which connects to iSCSI Target is called iSCSI Initiator.
This example is based on the environment below.
+----------------------+          |          +----------------------+
| [   iSCSI Target   ] |10.0.0.30 | 10.0.0.31| [ iSCSI Initiator  ] |
|   dlp.server.world   +----------+----------+   www.server.world   |
|                      |                     |                      |
+----------------------+                     +----------------------+

[1] Install administration tools.
[root@dlp ~]#
yum -y install scsi-target-utils
[2] Configure iSCSI Target .
For example, create a disk image under the [/iscsi_disks] directory and set it as a shared disk.
# create a disk image

[root@dlp ~]#
mkdir /iscsi_disks

[root@dlp ~]#
dd if=/dev/zero of=/iscsi_disks/disk01.img count=0 bs=1 seek=80G
[root@dlp ~]#
vi /etc/tgt/targets.conf
# add follows to the end

# if you set some devices, add <target>-</target> and set the same way with follows

# naming rule : [ iqn.yaer-month.domain:any name ]

<target iqn.2014-08.world.server:target00>
   
# provided devicce as a iSCSI target

    backing-store /iscsi_disks/disk01.img
   
# iSCSI Initiator's IP address you allow to connect

    initiator-address 10.0.0.31
   
# authentication info ( set anyone you like for "username", "password" )

    incominguser username password
</target>
[root@dlp ~]#
/etc/rc.d/init.d/tgtd start

Starting SCSI target daemon:                   [  OK  ]
[root@dlp ~]#
chkconfig tgtd on

# confirm status

[root@dlp ~]#
tgtadm --mode target --op show

Target 1: iqn.2014-08.world.server:target00
    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, Block size: 1
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            Backing store type: null
            Backing store path: None
            Backing store flags:
        LUN: 1
            Type: disk
            SCSI ID: IET     00010001
            SCSI SN: beaf11
            Size: 85899 MB, Block size: 512
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            Backing store type: rdwr
            Backing store path: /iscsi_disks/disk01.img
            Backing store flags:
    Account information:
        username
    ACL information:
        10.0.0.31
 
Tweet