Thursday, July 27, 2017

# extend FS hpux tutorial # work

UNIX: Extend FS with new disks on HPUX

The request was to add 250G of space to a n existing FS, so we need a Change Request raised; SAN team requested to add disks to the server and the rest is now up to you. I trust you have an ignite backup, health checks done prior to adding the new disks to the VG/extending the FS

Personally I am inclined towards AIX because of the how ancient command line results can get in HPUX, especially in file sytem size output. In AIX there is a flexibility to view FS in Gigabytes but the older versions of HPUX I was working with showed everything in bytes so I always kept a handy calculator to do my math. Yes, you still need to do a minimal amount of math to divide the kbs into Gbs. Ok, enough rant

The said file system is about 49 GB in size. It needs to be 250 GB in total size

spitfire:/root# bdf /p9500
Filesystem          kbytes    used   avail %used Mounted on
/dev/vgp9500/lvol1 52297728 40079375 11454767   78% /p9500
spitfire:/root# 

And it's VG and PV display output

--- Volume groups ---
VG Name                     /dev/vgp9500
VG Write Access             read/write     
VG Status                   available                 
Max LV                      255    
Cur LV                      1      
Open LV                     1      
Max PV                      48     
Cur PV                      4      
Act PV                      4      
Max PE per PV               16000        
VGDA                        8   
PE Size (Mbytes)            32              
Total PE                    1596    
Alloc PE                    1596    
Free PE                     0       
Total PVG                   1        
Total Spare PVs             0              
Total Spare PVs in use      0                     

   --- Logical volumes ---
   LV Name                     /dev/vgp9500/lvol1
   LV Status                   available/syncd           
   LV Size (Mbytes)            51072           
   Current LE                  1596      
   Allocated PE                1596        
   Used PV                     4       


   --- Physical volumes ---
   PV Name                     /dev/dsk/c58t4d4
   PV Name                     /dev/dsk/c59t4d4 Alternate Link
   PV Status                   available                
   Total PE                    399     
   Free PE                     0       
   Autoswitch                  On        

   PV Name                     /dev/dsk/c58t4d5
   PV Name                     /dev/dsk/c59t4d5 Alternate Link
   PV Status                   available                
   Total PE                    399     
   Free PE                     0       
   Autoswitch                  On        

   PV Name                     /dev/dsk/c58t4d6
   PV Name                     /dev/dsk/c59t4d6 Alternate Link
   PV Status                   available                
   Total PE                    399     
   Free PE                     0       
   Autoswitch                  On        

   PV Name                     /dev/dsk/c58t4d7
   PV Name                     /dev/dsk/c59t4d7 Alternate Link
   PV Status                   available                
   Total PE                    399     
   Free PE                     0       
   Autoswitch                  On        


   --- Physical volume groups ---
   PVG Name                    PVG0                       
   PV Name                     /dev/dsk/c58t4d4           
   PV Name                     /dev/dsk/c59t4d4           
   PV Name                     /dev/dsk/c58t4d5           
   PV Name                     /dev/dsk/c59t4d5           
   PV Name                     /dev/dsk/c58t4d6           
   PV Name                     /dev/dsk/c59t4d6           
   PV Name                     /dev/dsk/c58t4d7           
   PV Name                     /dev/dsk/c59t4d7  


--- Logical volumes ---
LV Name                     /dev/vgp9500/lvol1
VG Name                     /dev/vgp9500
LV Permission               read/write   
LV Status                   available/syncd           
Mirror copies               0            
Consistency Recovery        MWC                 
Schedule                    parallel     
LV Size (Mbytes)            51072           
Current LE                  1596      
Allocated PE                1596        
Stripes                     0       
Stripe Size (Kbytes)        0                   
Bad block                   NONE         
Allocation                  PVG-strict/distributed
IO Timeout (Seconds)        default             

   --- Distribution of logical volume ---
   PV Name            LE on PV  PE on PV  
   /dev/dsk/c58t4d4   399       399       
   /dev/dsk/c58t4d5   399       399       
   /dev/dsk/c58t4d6   399       399       

   /dev/dsk/c58t4d7   399       399 

1. You first check the syslog or dmesg to detect new disks. I have already done that and what's left is to scan those new disks and then run ioscan commad on the server

spitfire:/root# ioscan -fknH /1/0/12/1/0/4/1.112.32.0.2.2.3
Class     I  H/W Path        Driver   S/W State   H/W Type     Description
===========================================================================
disk    781  1/0/12/1/0/4/1.112.32.0.2.2.3  sdisk    CLAIMED     DEVICE       HP      OPEN-V
                            /dev/dsk/c81t2d3   /dev/rdsk/c81t2d3


spitfire:/root# ioscan -fknH 1/0/12/1/0/4/1.112.32.0.2.2.2
Class     I  H/W Path        Driver   S/W State   H/W Type     Description
===========================================================================
disk    780  1/0/12/1/0/4/1.112.32.0.2.2.2  sdisk    CLAIMED     DEVICE       HP      OPEN-V
    
                        /dev/dsk/c81t2d2   /dev/rdsk/c81t2d2

spitfire:/root# ioscan -fknH /1/0/12/1/0/4/1.112.32.0.2.2.1
Class     I  H/W Path        Driver   S/W State   H/W Type     Description
===========================================================================
disk    779  1/0/12/1/0/4/1.112.32.0.2.2.1  sdisk    CLAIMED     DEVICE       HP      OPEN-V
                            /dev/dsk/c81t2d1   /dev/rdsk/c81t2d1


spitfire:/root# ioscan -fnkH /0/0/12/1/0/4/1.111.32.0.2.2.3
Class     I  H/W Path        Driver   S/W State   H/W Type     Description
===========================================================================
disk    778  0/0/12/1/0/4/1.111.32.0.2.2.3  sdisk    CLAIMED     DEVICE       HP      OPEN-V
                            /dev/dsk/c80t2d3   /dev/rdsk/c80t2d3

spitfire:/root# ioscan -fnkH 0/0/12/1/0/4/1.111.32.0.2.2.0
Class     I  H/W Path        Driver   S/W State   H/W Type     Description
===========================================================================
disk    648  0/0/12/1/0/4/1.111.32.0.2.2.0  sdisk    CLAIMED     DEVICE       HP      OPEN-V
                            /dev/dsk/c80t2d0   /dev/rdsk/c80t2d0

2. Check to see if the disks are in use or available

Ensure disks does not belong to any VG:

spitfire:/root# pvdisplay /dev/dsk/c80t2d0
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/dsk/c80t2d0" belongs.
pvdisplay: Cannot display physical volume "/dev/dsk/c80t2d0".
spitfire:/root# pvdisplay /dev/dsk/c81t2d3
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/dsk/c81t2d3" belongs.
pvdisplay: Cannot display physical volume "/dev/dsk/c81t2d3".
spitfire:/root# pvdisplay /dev/dsk/c81t2d2
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/dsk/c81t2d2" belongs.
pvdisplay: Cannot display physical volume "/dev/dsk/c81t2d2".
spitfire:/root# pvdisplay /dev/dsk/c81t2d1
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/dsk/c81t2d1" belongs.
pvdisplay: Cannot display physical volume "/dev/dsk/c81t2d1".
spitfire:/root# pvdisplay /dev/dsk/c80t2d3
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/dsk/c80t2d3" belongs.

pvdisplay: Cannot display physical volume "/dev/dsk/c80t2d3".

3. They're not, so we make them available now for VG vgp9500

spitfire:/root# pvcreate /dev/rdsk/c81t2d3
Physical volume "/dev/rdsk/c81t2d3" has been successfully created.
spitfire:/root# pvcreate /dev/rdsk/c81t2d2
Physical volume "/dev/rdsk/c81t2d2" has been successfully created.
spitfire:/root# pvcreate /dev/rdsk/c81t2d1
Physical volume "/dev/rdsk/c81t2d1" has been successfully created.
spitfire:/root# pvcreate /dev/rdsk/c80t2d3
Physical volume "/dev/rdsk/c80t2d3" has been successfully created.
spitfire:/root# pvcreate /dev/rdsk/c80t2d0
Physical volume "/dev/rdsk/c80t2d0" has been successfully created.

spitfire:/root# 

4. The next thing to do is to add the PV to VG vgp9500

spitfire:/root# vgextend -g PVG0 vgp9500 /dev/dsk/c81t2d3 /dev/dsk/c81t2d2 /dev/dsk/c81t2d1 /dev/dsk/c80t2d3
Current path "/dev/dsk/c59t4d4" is an alternate link, skip.
Current path "/dev/dsk/c59t4d5" is an alternate link, skip.
Current path "/dev/dsk/c59t4d6" is an alternate link, skip.
Current path "/dev/dsk/c59t4d7" is an alternate link, skip.
Volume group "vgp9500" has been successfully extended.
Physical volume group "PVG0" has been successfully extended.
Volume Group configuration for /dev/vgp9500 has been saved in /etc/lvmconf/vgp9500.conf
spitfire:/root# 

spitfire:/root# vgextend -g PVG0 vgp9500 /dev/dsk/c80t2d0
Current path "/dev/dsk/c59t4d4" is an alternate link, skip.
Current path "/dev/dsk/c59t4d5" is an alternate link, skip.
Current path "/dev/dsk/c59t4d6" is an alternate link, skip.
Current path "/dev/dsk/c59t4d7" is an alternate link, skip.
Current path "/dev/dsk/c80t2d3" is an alternate link, skip.
Volume group "vgp9500" has been successfully extended.
Physical volume group "PVG0" has been successfully extended.
Volume Group configuration for /dev/vgp9500 has been saved in /etc/lvmconf/vgp9500.conf
spitfire:/root# 

Because the disks have alternate links, I sped things up by typing all remaining disks name in a single command line, thus the truncated command below

spitfire:/root# d0 /dev/dsk/c80t2d1 /dev/dsk/c81t2d1 /dev/dsk/c80t2d2 /dev/dsk/c81t2d2 /dev/dsk/c80t2d3 /dev/dsk/c81t2d3       <
Current path "/dev/dsk/c59t4d4" is an alternate link, skip.
Current path "/dev/dsk/c59t4d5" is an alternate link, skip.
Current path "/dev/dsk/c59t4d6" is an alternate link, skip.
Current path "/dev/dsk/c59t4d7" is an alternate link, skip.
Current path "/dev/dsk/c80t2d3" is an alternate link, skip.
vgextend: The physical volume "/dev/dsk/c80t2d0" is already recorded in the "/etc/lvmtab" file.
vgextend: The physical volume "/dev/dsk/c81t2d1" is already recorded in the "/etc/lvmtab" file.
vgextend: The physical volume "/dev/dsk/c81t2d2" is already recorded in the "/etc/lvmtab" file.
vgextend: The physical volume "/dev/dsk/c80t2d3" is already recorded in the "/etc/lvmtab" file.
vgextend: The physical volume "/dev/dsk/c81t2d3" is already recorded in the "/etc/lvmtab" file.
vgextend: The physical volume "/dev/dsk/c80t2d0" is already recorded in the "/etc/lvmpvg" file for "PVG0" of "/dev/vgp9500".
vgextend: The physical volume "/dev/dsk/c81t2d1" is already recorded in the "/etc/lvmpvg" file for "PVG0" of "/dev/vgp9500".
vgextend: The physical volume "/dev/dsk/c81t2d2" is already recorded in the "/etc/lvmpvg" file for "PVG0" of "/dev/vgp9500".
vgextend: The physical volume "/dev/dsk/c80t2d3" is already recorded in the "/etc/lvmpvg" file for "PVG0" of "/dev/vgp9500".
vgextend: The physical volume "/dev/dsk/c81t2d3" is already recorded in the "/etc/lvmpvg" file for "PVG0" of "/dev/vgp9500".
Physical volume group "PVG0" has been successfully extended.

Volume Group configuration for /dev/vgp9500 has been saved in /etc/lvmconf/vgp9500.conf

5. Take a note of the the new VG reading

spitfire:/root# vgdisplay vgp9500
--- Volume groups ---
VG Name                     /dev/vgp9500
VG Write Access             read/write     
VG Status                   available                 
Max LV                      255    
Cur LV                      1      
Open LV                     1      
Max PV                      48     
Cur PV                      8      
Act PV                      8      
Max PE per PV               16000        
VGDA                        16  
PE Size (Mbytes)            32              
Total PE                    9592    
Alloc PE                    1596    
Free PE                     7996    
Total PVG                   1        
Total Spare PVs             0              
Total Spare PVs in use      0                     

because this is where your math skills will come in handy

The new PE size is:

7996 x 32 Mb
255872 / 1024 and you get 249 GB

Our request was to extend the lV with 250G

255872 + 51072
306944 / 1024 and you get 299 GB or about 306944 MB

6. We now extend the file system

spitfire:/root# lvextend -L 306944 /dev/vgp9500/lvol1
Logical volume "/dev/vgp9500/lvol1" has been successfully extended.
Volume Group configuration for /dev/vgp9500 has been saved in /etc/lvmconf/vgp9500.conf


spitfire:/root# lvdisplay /dev/vgp9500/lvol1
--- Logical volumes ---
LV Name                     /dev/vgp9500/lvol1
VG Name                     /dev/vgp9500
LV Permission               read/write   
LV Status                   available/syncd           
Mirror copies               0            
Consistency Recovery        MWC                 
Schedule                    parallel     
LV Size (Mbytes)            306944          
Current LE                  9592      
Allocated PE                9592        
Stripes                     0       
Stripe Size (Kbytes)        0                   
Bad block                   NONE         
Allocation                  PVG-strict/distributed
IO Timeout (Seconds)        default  

7. We now extend the file system

spitfire:/root# fsadm -b 306944m /p9500
fsadm: /etc/default/fs is used for determining the file system type
vxfs fsadm: /dev/vgp9500/rlvol1 is currently 52297728 sectors - size will be increased

spitfire:/root# bdf /p9500
Filesystem          kbytes    used   avail %used Mounted on
/dev/vgp9500/lvol1 314310656 40143595 257031680   14% /p9500

Done!

No comments:

Post a Comment