Monday, November 2, 2015

Extend logical drive of HP Smart Array P410i using hpacucli by adding a new SAS disk

I have an RAID5 Logical Disk. So, add a new disk of same size of existing disk. ( Note: If disk size is larger than others as in 2I:1:5 - 600 GB - only 300 GB will be used, rest is not usable)


--Add a 300GB hot plug SAS disk into one of emply bay. After few seconds, Smar Array controller -detects a new 'unassigned' disk - 2I:1:6

# hpacucli ctrl all show config

Smart Array P410i in Slot 0          (sn: 5001438013123456)

   array A (SAS, Unused Space: 0 MB)

      logicaldrive 1 (1.1 TB, RAID 5, OK)

      physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 300 GB, OK)
      physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 300 GB, OK)
      physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS, 300 GB, OK)
      physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SAS, 300 GB, OK)
      physicaldrive 2I:1:5 (port 2I:box 1:bay 5, SAS, 600.1 GB, OK)

   unassigned

      physicaldrive 2I:1:6 (port 2I:box 1:bay 6, SAS, 300 GB, OK)



--Add all unassigned disk in Logical Drive 1 ( logicaldrive 1 size is 1.1 TB) by specifying logical drive id

# hpacucli ctrl slot=0 ld 1 add drives=allunassigned



--Extend Smart Array Logical Drive. ( I have tested on RHEL 5.8)

# hpacucli ctrl slot=0 ld 1 modify size=max

Warning: Extension may not be supported on certain operating systems.
         Performing extension on these operating systems can cause data to
         become inaccessible. See ACU documentation for details. Continue?
         (y/n) y



--Is logical drive extended ? Yes, it is extended from 1.1 TB to 1.4 TB.

# hpacucli ctrl all show config

Smart Array P410i in Slot 0          (sn: 5001438013EDECA0)

   array A (SAS, Unused Space: 0 MB)

      logicaldrive 1 (1.4 TB, RAID 5, OK)

      physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 300 GB, OK)
      physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 300 GB, OK)
      physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS, 300 GB, OK)
      physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SAS, 300 GB, OK)
      physicaldrive 2I:1:5 (port 2I:box 1:bay 5, SAS, 600.1 GB, OK)
      physicaldrive 2I:1:6 (port 2I:box 1:bay 6, SAS, 300 GB, OK)



--OS will now recognize new size of disk as 1499.8 GB. Let us extend last partition to use recently added 300GB. Delete second partition and extend it in single session. It will alter partition table in MBR. Change ending secotor to new sector that is bigger than older one.
   [ CAUTION - below delete and extend operation MUST be done in single fdisk session and write operation MUST be only once at the end ]

# fdisk /dev/cciss/c0d0

Disk /dev/cciss/c0d0: 1499.8 GB, 1499830990848 bytes
255 heads, 63 sectors/track, 182344 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1   *           1          33      265041   83  Linux
/dev/cciss/c0d0p2              34      145875  1171475865   83  Linux


Command (m for help): d
Partition number (1-4): 2

Command (m for help): p

Disk /dev/cciss/c0d0: 1499.8 GB, 1499830990848 bytes
255 heads, 63 sectors/track, 182344 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1   *           1          33      265041   83  Linux

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (34-182344, default 34):
Using default value 34
Last cylinder or +size or +sizeM or +sizeK (34-182344, default 182344):
Using default value 182344

Command (m for help): p

Disk /dev/cciss/c0d0: 1499.8 GB, 1499830990848 bytes
255 heads, 63 sectors/track, 182344 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1   *           1          33      265041   83  Linux
/dev/cciss/c0d0p2              34      182344  1464413107+  83  Linux



--New End for partition is now 182344 (older was 145875 ). So partition is extended.

# fdisk -l /dev/cciss/c0d0

Disk /dev/cciss/c0d0: 1499.8 GB, 1499830990848 bytes
255 heads, 63 sectors/track, 182344 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1   *           1          33      265041   83  Linux
/dev/cciss/c0d0p2              34      182344  1464413107+  83  Linux



--Did you mess up anything ? If yes, you are gone ! Filesystems may be gone or corrupt. If file list complete sucessully, you  are out of risk now !

# ls -lR /u01



--Now, resize PV and extend LV, resize filesystem

# df -hP /u01
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/volume_grp-u01vol  783G  452G  291G  61% /u01

# pvs /dev/cciss/c0d0p2
  PV                VG         Fmt  Attr PSize   PFree
  /dev/cciss/c0d0p2 volume_grp lvm2 a-   837.81G    0

# pvresize /dev/cciss/c0d0p2
  Physical volume "/dev/cciss/c0d0p2" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized

# pvs /dev/cciss/c0d0p2
  PV                VG         Fmt  Attr PSize PFree
  /dev/cciss/c0d0p2 volume_grp lvm2 a-   1.09T 279.38G

# pvscan
  PV /dev/cciss/c0d0p2   VG volume_grp   lvm2 [1.09 TB / 279.38 GB free]
  Total: 1 [1.09 TB] / in use: 1 [1.09 TB] / in no VG: 0 [0   ]


# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "volume_grp" using metadata type lvm2

#    vgs volume_grp
  VG         #PV #LV #SN Attr   VSize VFree
  volume_grp   1   5   0 wz--n- 1.09T 279.38G

# lvextend -L +20G /dev/mapper/volume_grp-root_volume
  Extending logical volume root_volume to 21.94 GB
  Logical volume root_volume successfully resized


--Resize filesystems 

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

# df -hP /
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/volume_grp-root_volume   22G  1.6G   19G   8% /
#


Reference: Hpacucli Utility for Linux - All Commands Guide

http://h20565.www2.hpe.com/hpsc/doc/public/display?sp4ts.oid=435422&docId=emr_na-c03493210&docLocale=en_US

1 comment: