Pages

Thursday, May 28, 2015

Extend a VXFS filesystem in HP-UX with LVM

Today I needed to extend a VXFS filesystem in HP-UX with LVM. The first thing I did was to figure out the logical volume, the volume group and the size of the volume:

# mount
...
/u04 on /dev/vg02/u04 ioerror=mwdisable,largefiles,delaylog,nodatainlog,dev=40020003 on Thu May 28 11:11:30 2015


...
# df -k /u04
/u04                   (/dev/vg02/u04    ) : 467543436 total allocated Kb
                                              1823354 free allocated Kb
                                             465720082 used allocated Kb
                                                  100 % allocation used


vg02 is the volumegroup, u04 is the logical volume, /dev/vg02/u04 is the device mounted on /u04. Next things I needed to know were the attributes for the volume group:

# vgdisplay -v vg02
--- Volume groups ---
VG Name                     /dev/vg02
VG Write Access             read/write
VG Status                   available
Max LV                      3
Cur LV                      2
Open LV                     2
Max PV                      2
Cur PV                      2
Act PV                      2
Max PE per PV               65535
VGDA                        4
PE Size (Mbytes)            256
Total PE                    2226
Alloc PE                    2184
Free PE                     42
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0
VG Version                  1.0
VG Max Size                 33553920m
VG Max Extents              131070

   --- Logical volumes ---
   LV Name                     /dev/vg02/u02
   LV Status                   available/syncd
   LV Size (Mbytes)            102400
   Current LE                  400
   Allocated PE                400
   Used PV                     1

   LV Name                     /dev/vg02/u04
   LV Status                   available/syncd
   LV Size (Mbytes)            456704
   Current LE                  1784
   Allocated PE                1784
   Used PV                     2


   --- Physical volumes ---
   PV Name                     /dev/dsk/c1t8d0
   PV Status                   available
   Total PE                    1113
   Free PE                     40
   Autoswitch                  On
   Proactive Polling           On

   PV Name                     /dev/dsk/c1t9d0
   PV Status                   available
   Total PE                    1113
   Free PE                     2
   Autoswitch                  On
   Proactive Polling           On


The physical extents have a size of 256MB and there were 42 free physical extents. These values needed to be multiplied to continue:

# echo 42*256 | bc -l
10752


Which means the volume u04 can be extended by 10752MB. Next I needed to know the current size of the volume u04:

# echo 1784*256 | bc -l
456704


456704MB is the current size of the volume u04. The correct value to extend the volume u04 is the sum of the current used MB and free MB:

# echo 456704+10752 | bc -l
467456


The value 467456MB is the value we can work with. First the volume itself must be extended:

# lvextend -L 467456 /dev/vg02/u04
Logical volume "/dev/vg02/u04" has been successfully extended.
Volume Group configuration for /dev/vg02 has been saved in /etc/lvmconf/vg02.conf


Then the filesystem must be extended. You can extend the filesystem online with fsadm:

# fsadm -F vxfs -b 467456M /u04
UX:vxfs fsadm: ERROR: V-3-25255: fsadm: You don't have a license to run this program


If you encounter the above error like me then you don't have the license to extend the filesystem online. In this case you need to extend the filesystem offline:

# umount /u04
# extendfs -F vxfs /dev/vg02/u04
# mount /u04


Next recheck the size of the volume:

# df -k /u04
/u04                   (/dev/vg02/u04    ) : 476376623 total allocated Kb
                                             34476272 free allocated Kb
                                             441900351 used allocated Kb
                                                   93 % allocation used


And the volume group (output truncated):

# vgdisplay -v vg02
...
PE Size (Mbytes)            256
Total PE                    2226
Alloc PE                    2226
Free PE                     0
...
   LV Name                     /dev/vg02/u04
   LV Status                   available/syncd
   LV Size (Mbytes)            467456
   Current LE                  1826
   Allocated PE                1826
   Used PV                     2
...

No comments:

Post a Comment