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.

server17.example.com        [192.168.0.117] – iSCSI Target

desktop17.example.com        [192.168.0.17] – 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 ]

<target iqn.2011-12.com.example:server.bipin>

# provided devicce as a iSCSI target

    backing-store /dev/iscsi/lv-target

# iSCSI Initiator’s IP address you allow to connect

    initiator-address 192.168.0.17

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

incominguser bipin redhat

</target>

[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 192.168.0.117

Starting iscsid:                                           [  OK  ]

192.168.0.117:3260,1 iqn.2011-12.com.example:server.bipin

# make sure status after discovery

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

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

Logging in to [iface: default, target: iqn.2011-12.com.example:server.bipin, portal: 192.168.0.117,3260]

Login to [iface: default, target: iqn.2011-12.com.example:server.bipin, portal: 192.168.0.117,3260] successful.

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

tcp: [2] 192.168.0.117:3260,1 iqn.2011-12.com.example:server.bipin

[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

Advertisements

About bpn4it

Feel Free in Linux. Bipin Patel bpn4it@gmail.com 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:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s