Configure Shared Storage for Redhat Linux Servers using iSCSI Technology

Networking between Target and Initiator Nodes:

Edit '/etc/hosts':

Edit '/etc/hosts' of both the iSCSI Target(SAN) and iSCSI Initiator(RACNODE1) and add the following entries:

192.168.15.101    racnode1.sense.com    racnode1

192.168.15.110    san.sense.com   san

As shown below:

 

Ping Target and Initiator:

Ping initiator node from target node and vice-versa.

[root@san ~]# ping -c2 racnode1

[root@racnode1 ~]# ping -c2 san

 

 

Configure the Shared Storage on SAN (iSCSI Target):

 Install scsi-target-utils package:

[root@san ~]# rpm -qa | grep scsi-target-utils*

 If the package is not installed then install the above mentioned package.

 Prepare shared storage:

 For demonstration purposes, /dev/sdb1 is created and will be shared via iSCSI.

fdisk:

[root@san ~]#  fdisk -l

Use fdisk to prepare the partition (/dev/sdb1). Create a new primary partition and save changes.

Don't make any filesystem on this partition.

[root@san ~]#  fdisk /dev/sdb

[root@san ~]#  fdisk -l

Volumegroup Creation:

[root@san ~]#  pvcreate /dev/sdb1

[root@san ~]#  vgcreate vg_racdb /dev/sdb1

 [root@san ~]#  vgdisplay

 

 For the demonstration purpose, we shall create three logical volumes ( 3GB , 21GB , 20GB ). These partitions will be shared to the initiator node(s).

[root@san ~]#  lvcreate -n lv_crs -L 3G vg_racdb

[root@san ~]#  lvcreate -n lv_data -L 21G vg_racdb

[root@san ~]#  lvcreate -n lv_fra -L 20G vg_racdb

 [root@san ~]#  lvdisplay

 

 

Edit the iSCSI target configuration file:

Edit the iSCSI target configuration file, '/etc/tgt/targets.conf'. Add the target and define the initiators for the target.

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

 

 Add entries for the three volumegroups created above in the 'targets.conf' file.

#Added for Shared SAN Storage

 <target iqn.2012-12.com.sense.com:san.lun0>
                         backing-store /dev/mapper/vg_racdb-lv_crs
                         initiator-address 192.168.15.101


</target>

<target iqn.2012-12.com.sense.com:san.lun1>
                        backing-store /dev/mapper/vg_racdb-lv_data
                        initiator-address 192.168.15.101
</target>

<target iqn.2012-12.com.sense.com:san.lun2>
                         backing-store /dev/mapper/vg_racdb-lv_fra
                         initiator-address 192.168.15.101
</target>

 

Start tgtd Service:

[root@san ~]#  chkconfig tgtd on

 This enables the tgtd service to start at the system boot.

[root@san ~]#  service tgtd restart

[root@san ~]#  service tgtd status

 

 [root@san ~]#  tgtadm --lld iscsi --mode target --op show

 

 

Configure the Shared Storage (iSCSI Initiator):

Install scsi-target-utils package:

Install iscsi-initiator-utils package, on the initiator node(s).

[root@racnode1 ~]# rpm -qa | grep scsi-target-utils*

chkconfig and start iscsid and iscsi services:

[root@racnode1 ~]#  chkconfig iscsid on

[root@racnode1 ~]#  chkconfig iscsi on

 [root@racnode1 ~]#  service iscsi stop

 [root@racnode1 ~]#  service iscsid stop

[root@racnode1 ~]#  service iscsid start

[root@racnode1 ~]#  servie isci start

 

 Use iscsiadm to query the target:

 Use iscsiadm to query the target ( use the ip address ).

[root@racnode1 ~]# iscsiadm --mode discovery --type sendtargets --portal192.168.15.110

 

Connect to shared storage from client Node (iSCSI Initiator):

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

[root@racnode1 ~]# iscsiadm --mode node --targetname iqn.2012-12.com.sense.com:san.lun0 --portal 192.168.15.110 --login

[root@racnode1 ~]# iscsiadm --mode node --targetname iqn.2012-12.com.sense.com:san.lun1 --portal 192.168.15.110 --login

[root@racnode1 ~]# iscsiadm --mode node --targetname iqn.2012-12.com.sense.com:san.lun2 --portal 192.168.15.110 --login

Verify that there is  new block devices available on the client node (initiator).

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

 This finishes the task of shared disk configuration for RHEL Servers using iSCSI Technology. Now we can create filesystem on these devices(sdb,sdc,sdd) as per our requirement. If we have more than one iSCSI Initiators(Clients) then we should repeat the above steps for all the Initiator nodes.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值