Sometimes we need to extend the size of a logical volume (LV) to increase the free space when running out of space. My one HP-UX server having logical volume /dev/vg00/lvol5 mounted on /opt becomes 79% full and I need to increase the size of this logical volume online from 16GB to 32GB i.e. without any downtime for my server.
# bdf /opt
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol5 16777216 13333024 3444192 79% /opt
Extend Filesystem Online on HP-UX 11.31
I have some free PF in /dev/vg00, so there is no need to extend the size of the volume group (VG) /dev/vg00. I can directly increase the size of LV using the free PE of VG. To extend the filesystem online on HP-UX 11.31 server, you have to follow the below steps:
- First, check for Online JFS software, it should be installed on your server to extend the volume size online. Here it is installed on my server.
# swlist -l product | grep -i jfs AONLINEJFS B.05.10.01 OnlineJFS 5.1SP1 Integration Product JFS B.11.31 Base VxFS File System 4.1 for HP-UX OnlineJFS01 5.1.200.000 Online features of the VxFS File System
- Check the details of the LV using the lvdisplay command, it will display the LV Name, VG Name, LV Size, Allocated PE etc.
# lvdisplay /dev/vg00/lvol5 --- Logical volumes --- LV Name /dev/vg00/lvol5 VG Name /dev/vg00 LV Permission read/write LV Status available/syncd Mirror copies 0 Consistency Recovery MWC Schedule parallel LV Size (Mbytes) 16384 Current LE 512 Allocated PE 512 Stripes 0 Stripe Size (Kbytes) 0 Bad block on Allocation strict IO Timeout (Seconds) default
- Check the details of the VG using the vgdisplay command, it will display the VG Name, PE Size, Total PE, Allocated PE, Free PE etc. Volume Group (VG) /dev/vg00 has a total of 4451 PE in which 1213 PEs are free and PE size is 32 MB. We can allocate the free PEs to any logical volume under this VG.
# vgdisplay /dev/vg00 --- Volume groups --- VG Name /dev/vg00 VG Write Access read/write VG Status available Max LV 255 Cur LV 8 Open LV 8 Max PV 16 Cur PV 1 Act PV 1 Max PE per PV 4461 VGDA 2 PE Size (Mbytes) 32 Total PE 4451 Alloc PE 3238 Free PE 1213 Total PVG 0 Total Spare PVs 0 Total Spare PVs in use 0 VG Version 1.0 VG Max Size 2284032m VG Max Extents 71376
- Extend the size of LV: Current size of LV is 16GB having 512 LE and we need to extend it to 32GB. So we have to extend the LEs from 512 to 1024 which can be done by using the command lvextend as shown below.
# lvextend -l 1024 /dev/vg00/lvol5 Logical volume "/dev/vg00/lvol5" has been successfully extended. Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
- Verify the details of the logical volume, it’s showing that the number of PE and LE has been increased to 1024.
# lvdisplay /dev/vg00/lvol5 --- Logical volumes --- LV Name /dev/vg00/lvol5 VG Name /dev/vg00 LV Permission read/write LV Status available/syncd Mirror copies 0 Consistency Recovery MWC Schedule parallel LV Size (Mbytes) 32768 Current LE 1024 Allocated PE 1024 Stripes 0 Stripe Size (Kbytes) 0 Bad block on Allocation strict IO Timeout (Seconds) default
- In the final step, extend the filesystem by using the fsadm command.
# fsadm -b 33554432 /opt fsadm: /etc/default/fs is used for determining the file system type UX:vxfs fsadm: INFO: V-3-25942: /dev/vg00/rlvol5 size increased from 16777216 sectors to 33554432 sectors
Here number is given with option -b is the size of filesystem in KB i.e. 32GB=32*1024*1024KB=33554432KB
- Verify the extended filesystem by using the command bdf
# bdf /opt Filesystem kbytes used avail %used Mounted on /dev/vg00/lvol5 33554432 13333536 20096192 40% /opt
Last Updated: August 28, 2020