Tuesday, March 10, 2015

Extend file system online with dm multipath

Before doing change Keep  few important configuration file as backup:

cat /etc/fstab >/var/fstab-`date +%Y%m%d%H%M`
df -h >/var/df-h-`date +%Y%m%d%H%M`
fdsik -l > /var/fdisk-l-`date +%Y%m%d%H%M`
pvdisplay >/var/pvdisplay-`date +%Y%m%d%H%M`
vgdisplay >/var/vgdisplay-`date +%Y%m%d%H%M`
lvdisplay >/var/lvdisplay-`date +%Y%m%d%H%M`
cat /etc/lvm/lvm.conf >/var/lvmconfig-`date +%Y%m%d%H%M`
mulitpah -ll >/var/lvmconfig-`date +%Y%m%d%H%M`


Check the fc_host port:

[root@beautifulworld]# systool -c fc_host -v
Class = "fc_host"

  Class Device = "host3"
  Class Device path = "/sys/class/fc_host/host3"
    active_fc4s         = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 "
    fabric_name         = "0x100000051e366ffg"
    issue_lip           = <store method only>
    maxframe_size       = "2048 bytes"
    node_name           = "0x200014feb536a245"
    port_id             = "0x02a829"
    port_name           = "0x200114feb536a245"
    port_state          = "Online"
    port_type           = "NPort (fabric via point-to-point)"
    speed               = "8 Gbit"
    supported_classes   = "Class 3"
    supported_fc4s      = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 "
    supported_speeds    = "2 Gbit, 4 Gbit, 8 Gbit"
    tgtid_bind_type     = "wwpn (World Wide Port Name)"
    uevent              = <store method only>

    Device = "host3"
    Device path = "/sys/devices/pci0000:00/0000:00:09.0/0000:05:00.0/host3"
      uevent              = <store method only>


  Class Device = "host4"
  Class Device path = "/sys/class/fc_host/host4"
    active_fc4s         = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 "
    fabric_name         = "0x100000051e367055"
    issue_lip           = <store method only>
    maxframe_size       = "2048 bytes"
    node_name           = "0x200014feb536a245"
    port_id             = "0x02a879"
    port_name           = "0x200214feb536a245"
    port_state          = "Online"
    port_type           = "NPort (fabric via point-to-point)"
    speed               = "8 Gbit"
    supported_classes   = "Class 3"
    supported_fc4s      = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 "
    supported_speeds    = "2 Gbit, 4 Gbit, 8 Gbit"
    tgtid_bind_type     = "wwpn (World Wide Port Name)"
    uevent              = <store method only>

    Device = "host4"
    Device path = "/sys/devices/pci0000:00/0000:00:09.0/0000:05:00.1/host4"
      uevent              = <store method only>


[root@beautifulworld scsi_host]# multipath -ll
dbdisk5 (360060e8006cia1000000cfb100000321) dm-9 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
 \_ 3:0:0:4 sdf 8:80  [active][ready]
 \_ 4:0:0:4 sdk 8:160 [active][ready]
dbdisk4 (360060e8006cia1000000cfb1000012c3) dm-8 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
 \_ 3:0:0:3 sde 8:64  [active][ready]
 \_ 4:0:0:3 sdj 8:144 [active][ready]
dbdisk3 (360060e8006cia1000000cfb1000012c2) dm-7 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
 \_ 3:0:0:2 sdd 8:48  [active][ready]
 \_ 4:0:0:2 sdi 8:128 [active][ready]
dbdisk2 (360060e8006cia1000000cfb1000012c1) dm-6 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
 \_ 3:0:0:1 sdc 8:32  [active][ready]
 \_ 4:0:0:1 sdh 8:112 [active][ready]
dbdisk1 (360060e8006cia1000000cfb100000336) dm-5 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
 \_ 3:0:0:0 sdb 8:16  [active][ready]
 \_ 4:0:0:0 sdg 8:96  [active][ready]


Now scan the New LUN, host3 & host4 (from Systool output):
  
[root@beautifulworld scsi_host]echo "- - -" > /sys/class/scsi_host/host3/scan
[root@beautifulworld scsi_host]echo "- - -" > /sys/class/scsi_host/host4/scan

[root@beautifulworld scsi_host]# multipath -l
mpath1 (360060e8006cia1000000cfb100000382) dm-18 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 3:0:0:5 sdn 8:208 [active][undef]
 \_ 4:0:0:5 sdo 8:224 [active][undef]
dbdisk5 (360060e8006cia1000000cfb100000321) dm-9 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 3:0:0:4 sdf 8:80  [active][undef]
 \_ 4:0:0:4 sdk 8:160 [active][undef]
dbdisk4 (360060e8006cia1000000cfb1000012c3) dm-8 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 3:0:0:3 sde 8:64  [active][undef]
 \_ 4:0:0:3 sdj 8:144 [active][undef]
dbdisk3 (360060e8006cia1000000cfb1000012c2) dm-7 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 3:0:0:2 sdd 8:48  [active][undef]
 \_ 4:0:0:2 sdi 8:128 [active][undef]
dbdisk2 (360060e8006cia1000000cfb1000012c1) dm-6 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 3:0:0:1 sdc 8:32  [active][undef]
 \_ 4:0:0:1 sdh 8:112 [active][undef]
dbdisk1 (360060e8006cia1000000cfb100000336) dm-5 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 3:0:0:0 sdb 8:16  [active][undef]
 \_ 4:0:0:0 sdg 8:96  [active][undef]

[root@beautifulworld scsi_host]#


Here we got  new mpath1  with 360060e8006cia1000000cfb100000382
  
mpath1 (360060e8006cia1000000cfb100000382) dm-18 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
 \_ 3:0:0:5 sdn 8:208 [active][undef]
 \_ 4:0:0:5 sdo 8:224 [active][undef]


Configure the multipath with an alias, Add the following lines in /etc/multipath.conf
  
multipath {
wwid   360060e8006cia1000000cfb100000382
alias  dbdisk6
            }


Flush the dbdisk6 (multipath -f dbdisk6):

[root@beautifulworld scsi_host]multipath -f dbdisk6


Restart the multipath service:

[root@beautifulworld scsi_host]# service multipathd restart
Stopping multipathd daemon:                                [  OK  ]
Starting multipathd daemon:                                [  OK  ]


[root@beautifulworld scsi_host]# multipath -ll
dbdisk6 (360060e8006cia1000000cfb100000382) dm-18 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
 \_ 3:0:0:5 sdn 8:208 [active][ready]
 \_ 4:0:0:5 sdo 8:224 [active][ready]
dbdisk5 (360060e8006cia1000000cfb100000321) dm-9 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
 \_ 3:0:0:4 sdf 8:80  [active][ready]
 \_ 4:0:0:4 sdk 8:160 [active][ready]
dbdisk4 (360060e8006cia1000000cfb1000012c3) dm-8 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
 \_ 3:0:0:3 sde 8:64  [active][ready]
 \_ 4:0:0:3 sdj 8:144 [active][ready]
dbdisk3 (360060e8006cia1000000cfb1000012c2) dm-7 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
 \_ 3:0:0:2 sdd 8:48  [active][ready]
 \_ 4:0:0:2 sdi 8:128 [active][ready]
dbdisk2 (360060e8006cia1000000cfb1000012c1) dm-6 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
 \_ 3:0:0:1 sdc 8:32  [active][ready]
 \_ 4:0:0:1 sdh 8:112 [active][ready]
dbdisk1 (360060e8006cia1000000cfb100000336) dm-5 HITACHI,OPEN-V
[size=100G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
 \_ 3:0:0:0 sdb 8:16  [active][ready]
 \_ 4:0:0:0 sdg 8:96  [active][ready]
[root@beautifulworld scsi_host]#

  
Check the device get created or not
  
[root@beautifulworld scsi_host]# cd /dev/mpath
[root@beautifulworld mpath]ls
dbdisk1  dbdisk2  dbdisk3  dbdisk4  dbdisk5  dbdisk6


Create a physical volume

[root@beautifulworld mpath]# pvcreate /dev/mpath/dbdisk6
  Writing physical volume data to disk "/dev/mpath/dbdisk6"
  Physical volume "/dev/mpath/dbdisk6" successfully created

[root@beautifulworld mpath]# vgdisplay -v datavg


Extend the VG

[root@beautifulworld mpath]# vgextend datavg /dev/mpath/dbdisk6
  Volume group "datavg" successfully extended

[root@beautifulworld mpath]vgdisplay


Extend the LV

[root@beautifulworld mpath]# lvextend -L +100G /dev/mapper/datavg-db
  Extending logical volume dbto 473.00 GB
  Logical volume dbsuccessfully resized


Now resize the file system

[root@beautifulworld mpath]# resize2fs /dev/mapper/datavg-db
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/datavg-db is mounted on /datadb1; on-line resizing required
Performing an on-line resize of /dev/mapper/datavg-db to 123994112 (4k) blocks.
The filesystem on /dev/mapper/datavg-db is now 123994112 blocks long.


Now Check the file system 

[root@beautifulworld mpath]# df -h  /datavg-db
Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/datavg-db
                      466G  338G  105G  77% /datadb1