How to increase the size of a filesystem in HP-UX LVM

root's picture

In this example, we will increase the /opt size from 8160M to 9024M

Check the initial size with bdf command:

gz@hpux:/opt#bdf .
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol6    8355840 6828584 1515352   82% /opt

As you can see, the filesystem is part of lvol6 logical volume and vg00 volume group. Let's see if we have free physical extends free on the volume:

--- Volume groups ---
VG Name                     /dev/vg00
VG Write Access             read/write
VG Status                   available
Max LV                      255
Cur LV                      14
Open LV                     14
Max PV                      16
Cur PV                      1
Act PV                      1
Max PE per PV               4384
VGDA                        2
PE Size (Mbytes)            32
Total PE                    4343
Alloc PE                    3295
[color=green]Free PE                     1048[/color]
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0
VG Version                  1.0
VG Max Size                 2192g
VG Max Extents              70144

So, we have enough for our operation and we proceed.
We increase first the logical volume with lvextend command:

gz@hpux:/opt#lvextend -L 9000 /dev/vg00/lvol6
Warning: rounding up logical volume size to extent boundary at size [color=red]"9024" MB[/color].
Logical volume "/dev/vg00/lvol6" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

Now we resize the filesystem to the logical volume's size with fsadm command:

gz@hpux:/opt#fsadm -F vxfs -b 9024M /opt
vxfs fsadm: V-3-23585: /dev/vg00/rlvol6 is currently 9216000 sectors - size will be increased

And this is the final result:

gz@hpux:/opt#bdf .
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol6    9240576 6828624 2393136   74% /opt

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.