Sometimes we need to extend the size of a logical volume to increase the free space when running out of space. One of my servers has logical volume /dev/vg00/lvol5 mounted on /opt which becomes 76% full so I have to increase the size of the Logical Volume (LV) /dev/vg00/lvol5. I have to extend it from 16 GB to 18 GB online without any downtime for my server.
# bdf /opt
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol5 16777216 12807008 3950592 76% /opt
Logical Volume details
lvdisplay shows the details of the logical volume like 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
Volume Group Details
vgdisplay shows the details of the Volume group like VG Name, PE Size, Total PE, Allocated PE, Free PE etc. Volume Group vg00 has a total of 4451 PE in which 1411 PEs are free and PE size is 32 MB. We can allocate the free PE to any logical volume.
# vgdisplay 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 3040
Free PE 1411
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
Checking the possibility of resizing the volume online
To resize any volume online we need online JFS. It can be checked by using the command given below which will list the installed online JFS software if installed. In my server, Online JFS is already installed. If online JFS is not installed on your server then you can not resize the volume online, in this case, first, you need to umount the logical volume and the commands are also different.
# 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
#
You can check the users who are accessing any mount point at a particular moment by using the command fuser -cu.
# fuser -cu /opt
/opt: 1113mt(root) 1646mt(sfmdb) 2529mt(sfmdb) 1647mt(sfmdb
Extend the Logical Volume
The current size of the logical volume /dev/vg00/lvol5 is 16 GB and I need to extend it to 18 GB. I have to give the size of the extended logical volume in MB with lvextend command.
# lvextend -L 18432 /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
#
18432 is the size (in MB) of the extended logical volume. 18 GB = 18*1024 MB = 18432 MB
Logical Volume (LV) details after extending
Now it can be seen that allocated PE to /dev/vg00/lvol5 has been increased from 512 to 576.
# 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) 18432
Current LE 576
Allocated PE 576
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation strict
IO Timeout (Seconds) default
Extend the File System
In the final step, we have to extend the file system by using the command fsadm. Here size of the volume given in KB and /opt is the mount point for /dev/vg00/lvol5.
# fsadm -b 18874368 /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 18874368 sectors
#
16 GB = 16*1024 MB = 18432*1024 KB = 18874368 KB
Verify the Extended Volume
Use the bdf command to verify the size of the Logical Volume (LV)
# bdf /opt
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol5 16777216 12807008 3950592 76% /opt
Note: I have done these activities on HP-UX 11.31
Last Updated: Apr 14, 2018
Related Posts
- How to Find NIC (Network Interface Card) Details in HP-UX
- How to Install a .depot Package Using swinstall on HP-UX
- HP-UX: How to restrict NFS share access to a particular server?
- crontab: you are not authorized to use cron. Sorry. in HP-UX
- HP-UX: SSH taking too much time after adding the DNS Servers
- How to add DNS servers on an HP-UX server
- How to login to vPar console in HP-UX
- How to extend the size of Logical Volume (LV) in HP-UX
- How to determine file system type in HP-UX using command
- How to check vPar machines status in HP-UX
- How to find HBA cards/ports and WWN Number details in HP-UX (nPar)
- How to find HBA cards/ports and WWN Number details in HP-UX (vPar)
- HP-UX command to get Physical Memory Information
- HP-UX command to get Processor Information
- HP-UX command to get Hardware Serial Number
- su: Sorry in HP-UX while switching from normal user to root user
- SSH login taking too much time on HP-UX 11.31
- How to Disable Root SHH Login in HP-UX?
- hpvmstatus: HPVM currently not running.
- How to view/print routing table in HP-UX?
- Create a Logical Volume larger than 2TB and format it in HP-UX
- Protect SSH Logins with SSH and MOTD Banner Messages in HP-UX
- Remove welcome message after login in HP-UX 11.31
- Create a Logical Volume and format it in HP-UX
- How to rescan new LUNs added in HP-UX 11.31
- How to reboot a HP-UX machine?
- How to remove File System, LV and VG in HP-UX and Linux?
- How to remove NO_HW devices from ioscan in HP-UX without a reboot?
- Change root user password of vpar machine in HP-UX