Showing posts with label SAN. Show all posts
Showing posts with label SAN. Show all posts

Thursday, 12 April 2012

iscsi client side configuration in rhel6

[root@station2 /]# yum install -y iscsi*
[root@station2 /]# service iscsid start
[root@station2 /]# service iscsi start
[root@station2 /]# iscsiadm --mode discovery --type sendtargets --portal 10.65.62.30
10.65.62.30:3260,1 iqn.2012-26.com.example:ranji.lun0
[root@station2 /]# cat /proc/partitions
major minor  #blocks  name

   8     0    8388608 sda
   8     1     104391 sda1
   8     2    8281507 sda2
 253     0    7208960 dm-0
 253     1    1048576 dm-1
[root@station2 /]# iscsiadm --mode node --targetname iqn.2012-26.com.example:ranji.lun0 --portal 10.65.62.30 --login
Login session [iface: default, target: iqn.2012-26.com.example:ranji.lun0, portal: 10.65.62.30,3260]
[root@station2 /]# cat /proc/partitions
major minor  #blocks  name

   8     0    8388608 sda
   8     1     104391 sda1
   8     2    8281507 sda2
 253     0    7208960 dm-0
 253     1    1048576 dm-1
   8    16   41943040 sdb   ---> this is the device from server
[root@station2 /]# iscsiadm --mode node --targetname iqn.2012-26.com.example:ranji.lun0 --portal 10.65.62.30 --logout
Logout session [sid: 2, target: iqn.2012-26.com.example:ranji.lun0, portal: 10.65.62.30,3260]
[root@station2 /]# cat /proc/partitions
major minor  #blocks  name

   8     0    8388608 sda
   8     1     104391 sda1
   8     2    8281507 sda2
 253     0    7208960 dm-0
 253     1    1048576 dm-1

iscsi server side configuration in rhel6

[root@station1 Desktop]# yum install -y scsi*
[root@station1 Desktop]# yum install -y libibver*
[root@station1 Desktop]# yum install -y libml*
[root@station1 Desktop]# yum install -y librdmacm*
[root@station1 Desktop]# yum install -y perl-Config-General

create an empty partition (in my practise its sda4). dont convert it to linuxlvm system. just create a partition write and save it and follow the steps

[root@station1 Desktop]# pvcreate /dev/sda4
  Writing physical volume data to disk "/dev/sda4"
  Physical volume "/dev/sda4" successfully created
[root@station1 Desktop]# vgcreate vg_ranji /dev/sda4
  Volume group "vg_ranji" successfully created
[root@station1 Desktop]# vgdisplay
  --- Volume group ---
  VG Name               vg_ranji
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               40.50 GiB
  PE Size               4.00 MiB
  Total PE              10369
  Alloc PE / Size       0 / 0  
  Free  PE / Size       10369 / 40.50 GiB
  VG UUID               D8N5om-uk36-XPRR-elwS-PVNk-VmcM-IrGPYH
  
[root@station1 Desktop]# lvcreate -n lv_lun0 -L 40G vg_ranji
  Logical volume "lv_lun0" created
[root@station1 Desktop]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/vg_ranji/lv_lun0
  VG Name                vg_ranji
  LV UUID                JuJdn2-pRTl-FURv-HlBD-n3KA-wUQZ-KcHCWD
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                40.00 GiB
  Current LE             10240
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

[root@station1 Desktop]# vim /etc/tgt/targets.conf

 37
 38 <target iqn.2012-26.com.example:ranji.lun0>           ----------> remove # add edit these lines
 39     backing-store /dev/vg_ranji/lv_lun0
 40     initiator-address 10.65.62.30
 41 </target>
 42
[root@station1 Desktop]# chkconfig tgtd on
[root@station1 Desktop]# service tgtd restart
Stopping SCSI target daemon: not running                   [FAILED]
Starting SCSI target daemon:                               [  OK  ]