Friday, July 13, 2012

ISCSI Multipathed scan disk and add the disk to VG to extend the file system in Redhat 5.6

How to scan for newly added disks/luns?

- rescan-scsi-bus.sh  [Redhat Genuine utility]
- if hp tools are installed then use command  hp_rescan -h  for scanning new lun

#rescan-scsi-bus.sh
Host adapter 0 (ata_piix) found.
Host adapter 1 (ata_piix) found.
Host adapter 2 (lpfc) found.
Host adapter 3 (lpfc) found.
Scanning SCSI subsystem for new devices
Scanning host 0 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
Scanning for device 0 0 0 0 ...
OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00
      Vendor: TEAC     Model: DV-28S-W         Rev: C.2D
      Type:   CD-ROM                           ANSI SCSI revision: 05
Scanning host 1 channels  0 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
Scanning host 2 for  all SCSI target IDs, all LUNs
Scanning for device 2 0 0 0 ...
OLD: Host: scsi2 Channel: 00 Id: 00 Lun: 00
      Vendor: HP       Model: OPEN-V           Rev: 6006
      Type:   Direct-Access                    ANSI SCSI revision: 03
Scanning for device 2 0 1 0 ...
OLD: Host: scsi2 Channel: 00 Id: 01 Lun: 00
      Vendor: HP       Model: OPEN-V           Rev: 6006
      Type:   Direct-Access                    ANSI SCSI revision: 03
Scanning for device 2 0 2 0 ...
OLD: Host: scsi2 Channel: 00 Id: 02 Lun: 00
      Vendor: HP       Model: OPEN-V           Rev: 6006
      Type:   Direct-Access                    ANSI SCSI revision: 03
Scanning host 3 for  all SCSI target IDs, all LUNs
Scanning for device 3 0 0 0 ...
OLD: Host: scsi3 Channel: 00 Id: 00 Lun: 00
      Vendor: HP       Model: OPEN-V           Rev: 6006
      Type:   Direct-Access                    ANSI SCSI revision: 03
Scanning for device 3 0 1 0 ...
OLD: Host: scsi3 Channel: 00 Id: 01 Lun: 00
      Vendor: HP       Model: OPEN-V           Rev: 6006
      Type:   Direct-Access                    ANSI SCSI revision: 03
Scanning for device 3 0 2 0 ...
OLD: Host: scsi3 Channel: 00 Id: 02 Lun: 00
      Vendor: HP       Model: OPEN-V           Rev: 6006
      Type:   Direct-Access                    ANSI SCSI revision: 03
0 new device(s) found.-----------------------------------> Newly added devices
0 device(s) removed.-------------------------------> newly removed devices.
#

List all supported fibre channel HBAs

#hp_rescan -l
QLogic adapters:

Emulex adapters:
/sys/class/scsi_host/3
/sys/class/scsi_host/2
Brocade adapters:
#

#hp_rescan -a -----> will show what are the host adapters are used for the disks, here host0 & host1
Rescanning /sys/class/scsi_host/host0
Rescanning /sys/class/scsi_host/host1
#

# adapter_info -l
sda    3,0,0,0          HP OPEN-V 6008
sdb    3,0,1,0          HP OPEN-V 6008
sdc    3,0,2,0          HP OPEN-V 6008
sdd    2,0,0,0          HP OPEN-V 6008
sde    2,0,1,0          HP OPEN-V 6008
sdf    2,0,2,0          HP OPEN-V 6008

sg1   3,0,0,0         HP OPEN-V 6008
sg2   3,0,1,0         HP OPEN-V 6008
sg3   3,0,2,0         HP OPEN-V 6008
sg4   2,0,0,0         HP OPEN-V 6008
sg5   2,0,1,0         HP OPEN-V 6008
sg6   2,0,2,0         HP OPEN-V 6008
#
Execute the below command to get the DM disks:

multipath -ll

mpath0 (360060e800571e700000071e700006021) dm-10 HP,OPEN-V
[size=102G][features=1 queue_if_no_path][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
 \_ 3:0:3:0 sdi 8:128 [active][ready]
 \_ 2:0:3:0 sdk 8:160 [active][ready]

-------> here the sdi & sdk are the alternate paths which forms the "mpath0"

Allocate the total disk space to Primary partation 1

#fdisk /dev/mapper/mpath0
select n() to create the new partation
Select Primary partation
select 1
Enter to take the default(total space allocation)
select w(write) to save the created partation

Scan the newly added device and update the modified permission to Kernel

#partprobe

use the kpartx utility creates the device maps from partition tables

#kpartx -a /dev/mapper/mpath0

create the physical volume with lable information

#pvcreate /dev/mapper/mpath0p1
Extend the VG
#lvextend -L +100g /dev/mapper/vg-u01
 Extending logical volume u03 to 200.00 GB
 Logical volume u01 successfully resized
#

resize the file system

# resize2fs /dev/mapper/vg-u01
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/vg-u01 is mounted on /u01; on-line resizing required
Performing an on-line resize of /dev/mapper/vg-u01 to 52428800 (4k) blocks.
The filesystem on /dev/mapper/vg-u01 is now 52428800 blocks long.
#

Wednesday, July 11, 2012

Extend the root file system in Redhat Linux 5.6

Extend the LV(Logical Volume)

root@node ~]# lvextend -L 12g /dev/mapper/rvg-rootlv
  Extending logical volume rootlv to 12.00 GB
  Logical volume rootlv successfully resized
[root@node ~]#


Grow the file system

[root@node ~]# resize4fs -p /dev/mapper/rvg-rootlv
resize4fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/rvg-rootlv is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/mapper/rvg-rootlv to 3145728 (4k) blocks.
The filesystem on /dev/mapper/rvg-rootlv is now 3145728 blocks long.
[root@node ~]#


Check the file system status
[root@node ~]# df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/rvg-rootlv
                       12G  3.1G  7.6G  29% /
[root@node ~]#