Storage Server with iSCSI

Configure iSCSI Target

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        [] – iSCSI Initiator

This example configures to create LVM partition on iSCSI Target, so it need to have enough areas to use.

[root@server17 ~]# fdisk -cu /dev/vda   //make a LVM partition

[root@server17 ~]# pvcreate /dev/vda6

[root@server17 ~]# vgcreate iscsi /dev/vda6

[root@server17 ~]# lvcreate -L 100M  -n lv-target iscsi

[root@server17 ~]# yum install -y scsi-target-utils

[root@server17 ~]# vim /etc/tgt/targets.conf

# add at the last line

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


# provided devicce as a iSCSI target

    backing-store /dev/iscsi/lv-target

# iSCSI Initiator’s IP address you allow to connect


# authentication info ( set anyone you like for “username”, “password” )

incominguser bipin redhat


[root@server17 ~]# /etc/init.d/tgtd restart

[root@server17 ~]# tgtadm –mode target –op show     //# make sure status

Configure iSCSI Initiator

[root@desktop17~]#yum -y install iscsi-initiator-utils

[root@desktop17 ~]# vim /etc/iscsi/iscsid.conf

# line 49: uncomment

node.session.auth.authmethod = CHAP

# line 53,54: uncomment and set username and password which set on iSCSI Target

node.session.auth.username = bipin (username)

node.session.auth.password = redhat (password)

[root@desktop17 ~]# iscsiadm -m discovery -t st -p

Starting iscsid:                                           [  OK  ],1

# make sure status after discovery

[root@desktop17 ~]# iscsiadm -m node -o show

[root@desktop17 ~]# iscsiadm -m node –login

Logging in to [iface: default, target:, portal:,3260]

Login to [iface: default, target:, portal:,3260] successful.

[root@desktop17 ~]# iscsiadm -m session -o show

tcp: [2],1

[root@desktop17 ~]# cat /proc/partitions

major minor  #blocks  name

  8        0  156290904 sda

  8        1     102400 sda1

  8        2   28672000 sda2

  8        3     524288 sda3

253        0    8388608 dm-0

253        1     524288 dm-1

253        2    6291456 dm-2

  8       16     102400 sdb

  8       17      51200 sdb1        # added new device provided from target


About bpn4it

Feel Free in Linux. Bipin Patel Ahmadabad, Gujarat, India
This entry was posted in Bipin hands-on. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s