Search This Blog

Friday, September 12, 2014

Root File System Extension in HP-Unix

This article explains how to extend the root (/) file system using LVM Mirror/UX. OnlineJFS is required to extend the file system without going in LVM maintenance mode. This method allows to extend root (/) file system without re-igniting the server.

It uses a special "reserve" logical volume as stepping stone to free the required PEs between current lvol3 and lvol4 to comply with lvol3 contiguous policy. This method can be used on HP-UX 11.11 / 11.23 with Legacy Addressing (/dev/dsk/c#t#d#) or with the new HP-UX 11.31 Agile Addressing (/dev/disk/disk#) device special files. In this example, we use the new HP-UX 11.31 Agile Addressing.

1.   Create full backup of /dev/vg00 volume group using Ignite, if available.

# make_tape_recovery -v -I -x inc_entire=vg00 -a /dev/rmt/#mn

2.   Check the current status of your volume groups and logical volumes.
boxnet:/root#bdf      
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3    2097152  290496 1792600   14% /
/dev/vg00/lvol1    2097152  199152 1883256   10% /stand
/dev/vg00/lvol10   8388608 2372536 5974544   28% /var
/dev/vg00/lvol12   4194304   20848 4140864    1% /var/adm/crash
/dev/vg00/lvol11   2097152   20776 2060168    1% /var/SAN
/dev/vg00/lvol9    8388608 3253432 5095160   39% /usr
/dev/vg00/lvol8    1048576   22904 1017744    2% /tmp
/dev/vg00/lvol5    9355264 5333416 3990488   57% /opt
/dev/vg00/lvol7    2097152   20776 2060168    1% /opt/networker
/dev/vg00/lvol6    2097152   20776 2060168    1% /opt/SAN
/dev/vg00/lvol4    1048576   21216 1019456    2% /home


boxnet:/root#vgdisplay -v vg00
--- Volume groups ---
VG Name                     /dev/vg00
VG Write Access             read/write    
VG Status                   available                
Max LV                      255   
Cur LV                      12    
Open LV                     12    
Max PV                      16    
Cur PV                      2     
Act PV                      2     
Max PE per PV               4329        
VGDA                        4  
PE Size (Mbytes)            16             
Total PE                    8638   
Alloc PE                    6262   
Free PE                     2376   
Total PVG                   0       
Total Spare PVs             0             
Total Spare PVs in use      0                    
VG Version                  1.0      
VG Max Size                 1108224m  
VG Max Extents              69264        

   --- Logical volumes ---
   LV Name                     /dev/vg00/lvol1
   LV Status                   available/syncd          
   LV Size (Mbytes)            2048           
   Current LE                  128      
   Allocated PE                256        
   Used PV                     2      

   LV Name                     /dev/vg00/lvol2
   LV Status                   available/syncd          
   LV Size (Mbytes)            8192           
   Current LE                  512      
   Allocated PE                1024       
   Used PV                     2      

   LV Name                     /dev/vg00/lvol3
   LV Status                   available/syncd          
   LV Size (Mbytes)            2048            
   Current LE                  128      
   Allocated PE                256        
   Used PV                     2      

   LV Name                     /dev/vg00/lvol4
   LV Status                   available/syncd          
   LV Size (Mbytes)            1024           
   Current LE                  64       
   Allocated PE                128        
   Used PV                     2      

   LV Name                     /dev/vg00/lvol5
   LV Status                   available/syncd           
   LV Size (Mbytes)            9136           
   Current LE                  571      
   Allocated PE                1142       
   Used PV                     2      

   LV Name                     /dev/vg00/lvol6
   LV Status                   available/syncd          
   LV Size (Mbytes)            2048           
   Current LE                  128      
   Allocated PE                256        
   Used PV                     2      

   LV Name                     /dev/vg00/lvol7
   LV Status                   available/syncd          
   LV Size (Mbytes)            2048           
   Current LE                  128      
   Allocated PE                256        
   Used PV                     2      

   LV Name                     /dev/vg00/lvol8
   LV Status                   available/syncd          
   LV Size (Mbytes)            1024           
   Current LE                  64       
   Allocated PE                128        
   Used PV                     2      

   LV Name                     /dev/vg00/lvol9
   LV Status                   available/syncd          
   LV Size (Mbytes)            8192           
   Current LE                  512      
   Allocated PE                1024       
   Used PV                     2      

   LV Name                     /dev/vg00/lvol10
   LV Status                   available/syncd          
   LV Size (Mbytes)            8192           
   Current LE                  512      
   Allocated PE                1024       
   Used PV                     2      

   LV Name                     /dev/vg00/lvol11
   LV Status                   available/syncd          
   LV Size (Mbytes)            2048            
   Current LE                  128      
   Allocated PE                256        
   Used PV                     2      

   LV Name                     /dev/vg00/lvol12
   LV Status                   available/syncd          
   LV Size (Mbytes)            4096           
   Current LE                  256      
   Allocated PE                512        
   Used PV                     2      


   --- Physical volumes ---
   PV Name                     /dev/disk/disk2_p2
   PV Status                   available               
   Total PE                    4319   
   Free PE                     1188   
   Autoswitch                  On       
   Proactive Polling           On              

   PV Name                     /dev/disk/disk3_p2
   PV Status                   available               
   Total PE                    4319   
   Free PE                     1188   
   Autoswitch                  On       
   Proactive Polling           On              



The primary disk is disk2_p2 and the alternate disk is disk3_p2. In this example, the current size of lvol3 is 256 PE or 2048 MB.

CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|   LVOL3   |      |   LVOL3   |
+-----------+      +-----------+
|   LVOL4   |      |   LVOL4   |
+-----------+      +-----------+
|   LVOL5   |      |   LVOL5   |
+-----------+      +-----------+
|   LVOL6   |      |   LVOL6   |
+-----------+      +-----------+
|   LVOL7   |      |   LVOL7   |
+-----------+      +-----------+
|   LVOL8   |      |   LVOL8   |
+-----------+      +-----------+
|   LVOL9   |      |   LVOL9   |
+-----------+      +-----------+
|   LVOL10  |      |   LVOL10  |
+-----------+      +-----------+
|   LVOL11  |      |   LVOL11  |
+-----------+      +-----------+
|   LVOL12  |      |   LVOL12  |
+-----------+      +-----------+

3.   Remove all mirrors from alternate disk down to lvol4.

# lvreduce -m 0 /dev/vg00/lvol12 /dev/disk/disk3_p2
# lvreduce -m 0 /dev/vg00/lvol11 /dev/disk/disk3_p2
# lvreduce -m 0 /dev/vg00/lvol10 /dev/disk/disk3_p2
# lvreduce -m 0 /dev/vg00/lvol9 /dev/disk/disk3_p2
# lvreduce -m 0 /dev/vg00/lvol8 /dev/disk/disk3_p2
# lvreduce -m 0 /dev/vg00/lvol7 /dev/disk/disk3_p2
# lvreduce -m 0 /dev/vg00/lvol6 /dev/disk/disk3_p2
# lvreduce -m 0 /dev/vg00/lvol5 /dev/disk/disk3_p2
# lvreduce -m 0 /dev/vg00/lvol4 /dev/disk/disk3_p2


boxnet:/root#vgdisplay -v vg00
--- Volume groups ---
VG Name                     /dev/vg00
VG Write Access             read/write    
VG Status                   available                
Max LV                      255   
Cur LV                      12    
Open LV                     12    
Max PV                      16    
Cur PV                      2     
Act PV                      2     
Max PE per PV               4329        
VGDA                        4  
PE Size (Mbytes)            16             
Total PE                    8638   
Alloc PE                    3899   
Free PE                     4739   
Total PVG                   0       
Total Spare PVs             0             
Total Spare PVs in use      0                    
VG Version                  1.0      
VG Max Size                 1108224m  
VG Max Extents              69264        

   --- Logical volumes ---
   LV Name                     /dev/vg00/lvol1
   LV Status                   available/syncd          
   LV Size (Mbytes)            2048           
   Current LE                  128      
   Allocated PE                256        
   Used PV                     2      

   LV Name                     /dev/vg00/lvol2
   LV Status                   available/syncd          
   LV Size (Mbytes)            8192           
   Current LE                  512      
   Allocated PE                1024       
   Used PV                     2      

   LV Name                     /dev/vg00/lvol3
   LV Status                   available/syncd          
   LV Size (Mbytes)            2048           
   Current LE                  128      
   Allocated PE                256         
   Used PV                     2      

   LV Name                     /dev/vg00/lvol4
   LV Status                   available/syncd          
   LV Size (Mbytes)            1024           
   Current LE                  64       
   Allocated PE                64         
   Used PV                     1      

   LV Name                     /dev/vg00/lvol5
   LV Status                   available/syncd          
   LV Size (Mbytes)            9136           
   Current LE                  571      
   Allocated PE                571        
   Used PV                     1      

   LV Name                     /dev/vg00/lvol6
   LV Status                   available/syncd          
   LV Size (Mbytes)            2048           
   Current LE                  128      
   Allocated PE                128        
   Used PV                     1      

   LV Name                     /dev/vg00/lvol7
   LV Status                   available/syncd          
   LV Size (Mbytes)            2048           
   Current LE                  128      
   Allocated PE                128        
   Used PV                     1      

   LV Name                     /dev/vg00/lvol8
   LV Status                   available/syncd          
   LV Size (Mbytes)            1024           
   Current LE                  64       
   Allocated PE                64         
   Used PV                     1      

   LV Name                     /dev/vg00/lvol9
   LV Status                   available/syncd          
   LV Size (Mbytes)            8192           
   Current LE                  512      
   Allocated PE                512        
   Used PV                     1      

   LV Name                     /dev/vg00/lvol10
   LV Status                   available/syncd          
   LV Size (Mbytes)            8192           
   Current LE                  512      
   Allocated PE                512        
   Used PV                     1      

   LV Name                     /dev/vg00/lvol11
   LV Status                   available/syncd          
   LV Size (Mbytes)            2048           
   Current LE                  128      
   Allocated PE                128         
   Used PV                     1      

   LV Name                     /dev/vg00/lvol12
   LV Status                   available/syncd          
   LV Size (Mbytes)            4096           
   Current LE                  256      
   Allocated PE                256        
   Used PV                     1      


   --- Physical volumes ---
   PV Name                     /dev/disk/disk2_p2
   PV Status                   available               
   Total PE                    4319   
   Free PE                     1188   
   Autoswitch                  On       
   Proactive Polling           On              

   PV Name                     /dev/disk/disk3_p2
   PV Status                   available               
   Total PE                    4319   
   Free PE                     3551   
   Autoswitch                  On       
   Proactive Polling           On

CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|   LVOL3   |      |   LVOL3   |
+-----------+      +-----------+
|   LVOL4   |     
+-----------+     
|   LVOL5   |     
+-----------+     
|   LVOL6   |     
+-----------+     
|   LVOL7   |     
+-----------+     
|   LVOL8   |     
+-----------+     
|   LVOL9   |     
+-----------+     
|   LVOL10  |     
+-----------+     
|   LVOL11  |     
+-----------+      
|   LVOL12  |     
+-----------+   

4.   At this point, the alternate disk is only mirroring lvol1, lvol2 and lvol3. You can confirm using pvdisplay -v /dev/disk/disk3_p2. Create a "step stone" logical volume in the alternate disk of the size you need to add to lvol3.

# lvcreate -n reserve /dev/vg00
# lvextend -l <PE_size> /dev/vg00/reserve /dev/disk/disk3_p2

boxnet:/root#pvdisplay -v /dev/disk/disk3_p2|more
--- Physical volumes ---
PV Name                     /dev/disk/disk3_p2
VG Name                     /dev/vg00
PV Status                   available               
Allocatable                 yes         
VGDA                        2  
Cur LV                      3     
PE Size (Mbytes)            16             
Total PE                    4319   
Free PE                     3551   
Allocated PE                768        
Stale PE                    0      
IO Timeout (Seconds)        default            
Autoswitch                  On       
Proactive Polling           On              

   --- Distribution of physical volume ---
   LV Name                 LE of LV  PE for LV
   /dev/vg00/lvol1         128       128      
   /dev/vg00/lvol2         512       512      
   /dev/vg00/lvol3         128       128  

boxnet:/root#lvcreate -n reserve /dev/vg00
Logical volume "/dev/vg00/reserve" has been successfully created with
character device "/dev/vg00/rreserve".
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

# lvextend -L 2048 /dev/vg00/reserve /dev/disk/disk3_p2

boxnet:/root#lvextend -L 2048 /dev/vg00/reserve /dev/disk/disk3_p2
Logical volume "/dev/vg00/reserve" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf


CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|   LVOL3   |      |   LVOL3   |
+-----------+      +-----------+
|   LVOL4   |      |   Reserve |
+-----------+      +-----------+
|   LVOL5   |    
+-----------+    
|   LVOL6   |    
+-----------+    
|   LVOL7   |    
+-----------+    
|   LVOL8   |    
+-----------+    
|   LVOL9   |    
+-----------+    
|   LVOL10  |    
+-----------+    
|   LVOL11  |    
+-----------+    
|   LVOL12  |    
+-----------+    

5.   Re-mirror the lvols to the alternate disk

# lvextend -m 1 /dev/vg00/lvol4 /dev/disk/disk3_p2
# lvextend -m 1 /dev/vg00/lvol5 /dev/disk/disk3_p2
# lvextend -m 1 /dev/vg00/lvol6 /dev/disk/disk3_p2
# lvextend -m 1 /dev/vg00/lvol7 /dev/disk/disk3_p2
# lvextend -m 1 /dev/vg00/lvol8 /dev/disk/disk3_p2
# lvextend -m 1 /dev/vg00/lvol9 /dev/disk/disk3_p2
# lvextend -m 1 /dev/vg00/lvol10 /dev/disk/disk3_p2
# lvextend -m 1 /dev/vg00/lvol11 /dev/disk/disk3_p2
# lvextend -m 1 /dev/vg00/lvol12 /dev/disk/disk3_p2

CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|   LVOL3   |      |   LVOL3   |
+-----------+      +-----------+
|   LVOL4   |      |  reserve  |
+-----------+      +-----------+
|   LVOL5   |      |   LVOL4   |
+-----------+      +-----------+
|   LVOL6   |      |   LVOL5   |
+-----------+      +-----------+
|   LVOL7   |      |   LVOL6   |
+-----------+      +-----------+
|   LVOL8   |      |   LVOL7   |
+-----------+      +-----------+
|   LVOL9   |      |   LVOL8   |
+-----------+      +-----------+
|   LVOL10  |      |   LVOL9   |
+-----------+      +-----------+
|   LVOL11  |      |   LVOL10  |
+-----------+      +-----------+
|   LVOL12  |      |   LVOL11  |
+-----------+      +-----------+
                    |   LVOL12  |
                   +-----------+

6.   Reduce the mirrors from the primary disk down to lvol4 included.

# lvreduce -m 0 /dev/vg00/lvol12 /dev/disk/disk2_p2
# lvreduce -m 0 /dev/vg00/lvol11 /dev/disk/disk2_p2
# lvreduce -m 0 /dev/vg00/lvol10 /dev/disk/disk2_p2
# lvreduce -m 0 /dev/vg00/lvol9 /dev/disk/disk2_p2
# lvreduce -m 0 /dev/vg00/lvol8 /dev/disk/disk2_p2
# lvreduce -m 0 /dev/vg00/lvol7 /dev/disk/disk2_p2
# lvreduce -m 0 /dev/vg00/lvol6 /dev/disk/disk2_p2
# lvreduce -m 0 /dev/vg00/lvol5 /dev/disk/disk2_p2
# lvreduce -m 0 /dev/vg00/lvol4 /dev/disk/disk2_p2

CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|   LVOL3   |      |   LVOL3   |
+-----------+      +-----------+
                   |  RESERVE  |
                   |           |
                   +-----------+
                   |   LVOL4   |
                   +-----------+
                   |   LVOL5   |
                   +-----------+
                   |   LVOL6   |
                   +-----------+
                   |   LVOL7   |
                   +-----------+
                   |   LVOL8   |
                   +-----------+
                   |   LVOL9   |
                   +-----------+
                   |   LVOL10  |
                   +-----------+
                   |   LVOL11  |
                   +-----------+
                   |   LVOL12  |
                   +-----------+

7.   Remove the "step stone" lvol in the alternate disk to free its space.

# lvremove /dev/vg00/reserve

boxnet:/tmp#lvremove /dev/vg00/reserve
The logical volume "/dev/vg00/reserve" is not empty;
do you really want to delete the logical volume (y/n) : y
Logical volume "/dev/vg00/reserve" has been successfully removed.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

   CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|   LVOL3   |      |   LVOL3   |
+-----------+      +-----------+
                   |  free...  |
                   |           |
                   +-----------+
                   |   LVOL4   |
                   +-----------+
                   |   LVOL5   |
                   +-----------+
                   |   LVOL6   |
                   +-----------+
                   |   LVOL7   |
                   +-----------+
                   |   LVOL8   |
                   +-----------+
                   |   LVOL9   |
                   +-----------+
                   |   LVOL10  |
                   +-----------+
                   |   LVOL11  |
                   +-----------+
                   |   LVOL12  |
                   +-----------+

8.   Now enough contiguous space is available in both drives to extend the /dev/vg00/lvol3 logical volume.
Extend the logical volume. This will increase lvol3 in both disks since the mirror hasn't been broken.

# lvextend -l <PE_size> /dev/vg00/lvol3

boxnet:/tmp#lvextend -L 4096 /dev/vg00/lvol3
Logical volume "/dev/vg00/lvol3" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|           |      |           |
|   LVOL3   |      |   LVOL3   |
|           |      |           |
|           |      |           |
+-----------+      +-----------+
                   |   LVOL4   |
                   +-----------+
                   |   LVOL5   |
                   +-----------+
                   |   LVOL6   |
                   +-----------+
                   |   LVOL7   |
                   +-----------+
                   |   LVOL8   |
                   +-----------+
                   |   LVOL9   |
                   +-----------+
                   |   LVOL10  |
                   +-----------+
                   |   LVOL11  |
                   +-----------+
                   |   LVOL12  |
                   +-----------+

9.   Re-mirror the lvols from the alternate disk to the primary disk.

# lvextend -m 1 /dev/vg00/lvol12 /dev/disk/disk2_p2
# lvextend -m 1 /dev/vg00/lvol11 /dev/disk/disk2_p2
# lvextend -m 1 /dev/vg00/lvol10 /dev/disk/disk2_p2
# lvextend -m 1 /dev/vg00/lvol9 /dev/disk/disk2_p2
# lvextend -m 1 /dev/vg00/lvol8 /dev/disk/disk2_p2
# lvextend -m 1 /dev/vg00/lvol7 /dev/disk/disk2_p2
# lvextend -m 1 /dev/vg00/lvol6 /dev/disk/disk2_p2
# lvextend -m 1 /dev/vg00/lvol5 /dev/disk/disk2_p2
# lvextend -m 1 /dev/vg00/lvol4 /dev/disk/disk2_p2

  CURRENT DISK CONFIGURATION
PRIMARY DISK       ALTERNATE DISK
+-----------+      +-----------+
|   LVOL1   |      |   LVOL1   |
+-----------+      +-----------+
|   LVOL2   |      |   LVOL2   |
+-----------+      +-----------+
|           |      |           |
|   LVOL3   |      |   LVOL3   |
|           |      |           |
|           |      |           |
+-----------+      +-----------+
|   LVOL4   |      |   LVOL4   |
+-----------+      +-----------+
|   LVOL5   |      |   LVOL5   |
+-----------+      +-----------+
|   LVOL6   |      |   LVOL6   |
+-----------+      +-----------+
|   LVOL7   |      |   LVOL7   |
+-----------+      +-----------+
|   LVOL8   |      |   LVOL8   |
+-----------+      +-----------+
|   LVOL9   |      |   LVOL9   |
+-----------+      +-----------+
|   LVOL10  |      |   LVOL10  |
+-----------+      +-----------+
|   LVOL11  |      |   LVOL11  |
+-----------+      +-----------+
|   LVOL12  |      |   LVOL12  |
+-----------+      +-----------+

10.  Extend the filesystem of lvol3 using OnlineJFS fsadm command.

# fsadm -F vxfs -b <Current PEs * PE_size>M /

boxnet:/tmp#fsadm -F vxfs -b 4096m /
UX:vxfs fsadm: INFO: V-3-25942: /dev/vg00/rlvol3 size increased from 2097152 sectors to 4194304 sectors

11.  Final Size of root File System that is extended by 2 GB.

boxnet:/tmp#bdf /
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol3    4194304  289344 3874512    7% /

12.  Take a Reboot after completing this activity, to re-confirm everything is fine.




No comments:

Post a Comment