How to extend root file system using pvmove and OnlineJFS
This article present a method to extend the root (/) file system using the pvmove command.
On HP-UX version 10.20 and higher, the root (/) file system will be a Veritas Journal FileSystem VxFS by default after install Operating Environment.
If the system was upgraded from an earlier revision of the Operating System, this might not be the case.
This allows the use of fsadm command to extend the root (/) file system without having to reinstall it, using Ignite-UX make_net_recovery or make_tape_recovery commands or creating an alternate boot disk.
The criteria that has to be met for this to succeed are:
1. The root filesystem has to be JFS. This can be verified with the fstyp command on the root logical volume.
# bdf / Filesystem kbytes used avail %used Mounted on /dev/vg00/lvol3 86016 38741 44347 47% / # fstyp /dev/vg00/lvol3 vxfs
2. The OnlineJFS software bundle has to be loaded. This can be verified with swlist command or by making sure that the drivers are loaded in the kernel.
11i v1 (11.11):
# swlist -l product|grep -i online OnlineJFS B.11.11 Online features of the VxFS File System
To verify the drivers are, indeed, in the kernel.
# /usr/lbin/sysadm/system_prep -s /tmp/system.out; grep ^vx /tmp/system.out vxdmp_q4 vxfs vxportal vxvm_q4 vxvm vxdmp
The vxfs and vxportal are the required driver modules for OnlineJFS on 11i and should appear in the output. If not, the product is not successfully loaded or not in the kernel that the system is currently booted from.
# swlist|grep -i online B3929BA B.11.00 HP OnLineJFS (Advanced VxFS)
To verify the drivers are, indeed, in the kernel:
# /usr/lbin/sysadm/system_prep -s /tmp/system.out;grep ^vx /tmp/system.out vxfs vxfs33_q4_syms vxportal33
# swlist|grep -i online B3929BA B.10.20 HP OnLineJFS (Advanced VxFS)
To verify the driver is in the kernel:
# /usr/lbin/sysadm/system_prep -s /tmp/system.out;grep ^vx /tmp/system.out vxadv vxbase
3. There must be free space on the disk after the root logical volume because the root logical volume has to be contiguous and it cannot span across multiple disks.
The root logical volume must be contiguous so that the system can be booted into LVM maintenance mode if there are ever any LVM related problems.
There will probably already be another logical volume directly after the root logical volume on the disk so it will have to be moved to another disk in vg00. This can be done with pvmove command.
First find out the disk that the root logical volume is on:
# lvlnboot -v| grep ^Root Root: lvol3 on: /dev/dsk/c1t6d0
Then find the logical volume(s) that has to be moved to accomodate the space that is needed to grow the root logical volume.
# pvdisplay -v /dev/dsk/c1t6d0|more ... 0066 current /dev/vg00/lvol3 0013 0067 current /dev/vg00/lvol3 0014 0068 current /dev/vg00/lvol3 0015 0069 current /dev/vg00/lvol3 0016 0070 current /dev/vg00/lvol3 0017 0071 current /dev/vg00/lvol3 0018 0072 current /dev/vg00/lvol3 0019 0073 current /dev/vg00/lvol3 0020 0074 current /dev/vg00/lvol4 0000 0075 current /dev/vg00/lvol4 0001 0076 current /dev/vg00/lvol4 0002 0077 current /dev/vg00/lvol4 0003 0078 current /dev/vg00/lvol4 0004 0079 current /dev/vg00/lvol4 0005 0080 current /dev/vg00/lvol4 0006 0081 current /dev/vg00/lvol4 0007 0082 current /dev/vg00/lvol7 0000 0083 current /dev/vg00/lvol7 0001 0084 current /dev/vg00/lvol7 0002 0085 current /dev/vg00/lvol7 0003 0086 current /dev/vg00/lvol7 0004 ...
In this case, lvol4 is after lvol3 (/) and it will have to be moved to another disk in vg00 that has the space. This will free up Physical Extent (PE) 74 through 81 so that lvol3 can be extended that much. Each PE, by default, is 4 MB so lvol3 on this system can be extended by another 32Mb. If more space is required, lvol7 would have to be moved also. The vgdisplay command will show the PE size.
The command to move lvol4 is:
# pvmove -n /dev/vg00/lvol4 /dev/dsk/c1t6d0 /dev/dsk/c1t3d0 Transferring logical extents of logical volume "/dev/vg00/lvol4"... Physical volume "/dev/dsk/c1t6d0" has been successfully moved. Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf /dev/dsk/c1t6d0 is the disk that lvol4 is moving from and /dev/dsk/c1t3d0 is the disk that it's moving to since it has free space.
Verify that the lvol has been moved and there are free PEs after the root logical volume:
# pvdisplay -v /dev/dsk/c1t6d0|more ... 0066 current /dev/vg00/lvol3 0013 0067 current /dev/vg00/lvol3 0014 0068 current /dev/vg00/lvol3 0015 0069 current /dev/vg00/lvol3 0016 0070 current /dev/vg00/lvol3 0017 0071 current /dev/vg00/lvol3 0018 0072 current /dev/vg00/lvol3 0019 0073 current /dev/vg00/lvol3 0020 0074 free 0000 0075 free 0000 0076 free 0000 0077 free 0000 0078 free 0000 0079 free 0000 0080 free 0000 0081 free 0000 0082 current /dev/vg00/lvol7 0000 0083 current /dev/vg00/lvol7 0001 0084 current /dev/vg00/lvol7 0002 0085 current /dev/vg00/lvol7 0003 0086 current /dev/vg00/lvol7 0004 ...
There is free space so the root (/) lvol can be extended.
4) On 11.00 PHKL_19202 must be loaded or the system will panic.
To extend the file system, first extend the logical volume to the desired amount. In this case, the full 32Mb that is available will be used. That is 8 physical extents that will be added to the current size. Get the current size:
# lvdisplay /dev/vg00/lvol3|grep "Allocated PE" Allocated PE 21
Extend it by 8 extents:
# lvextend -l 29 /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
Now get the size in sectors, that the root (/) file system will become. The sector size is in Kbytes. The fsadm command requires the size in sectors. In this case, the current size is 84Mb:
# bdf / Filesystem kbytes used avail %used Mounted on /dev/vg00/lvol3 86016 38749 44340 47% /
In this case 8Mbs are being added to root (/) logical volume so the new size in sectors would be:
92 * 1024 = 94208
Now extend the filesystem:
# fsadm -F vxfs -b 94208 / fsadm: /dev/vg00/rlvol3 is currently 86016 sectors - size will be increased
Verify fsadm command extend the file system correctly:
# bdf / Filesystem kbytes used avail %used Mounted on /dev/vg00/lvol3 94208 38749 52020 43% /
- HP-UX System Administration Tasks: HP 9000 - Chapter 3 Managing Disks Using the Logical Volume Manager (LVM) - An Introduction to the Logical Volume Manager