QUESTION:
How can I increase the size of the Primary Swap, and ‘/’ file systems (VG00 LVOLs 2 and 3) on an HP-UX 11.11 server?
ANSWER:
The usual answer to this question is for you to take an Ignite/UX make_tape_recovery or make_net_recovery backup of your systems root volume group (VG00) and then restore your system from that backup. During the restoration process you can manipulate the sizes for the LVOL1 (‘/stand’), LVOL2 (Pri. Swap) and LVOL3 (‘/’) logical volumes. An issue that this solution presents though is that it requires the system to be down for the period of time it takes to restore from the Ignite/UX backup.
However, there is another way.
There are 2 requirements that must be met before we go any further.
1) Your VG00 LVOLs must be mirrored.
2) You must have the Online JFS product installed so that file systems can be extended on the fly without being unmounted.
If both of these requirements are met, then you can proceed.
The gist of the process I outline below is: We will use mirroring to move logical volumes around between 2 disks on the system. This has to be done because the first 3 LVs in VG00, which are LVOL1 (/stand), LVOL2 (Primary Swap) and LVOL3 (/) must have all of their extents allocated contiguously.
The procedure I use was tested on an HP-UX 11.11 server but it should work on any version of HP-UX for LVOL2 (Pri. Swap) and LOVL3 (/).
LVOL1 (/stand) cannot be extended with this procedure as long as it is an HFS file system. This will work with primary swap because it has no file system on it and ‘/’ because it is a VxFS file system. If you have a system that has /stand set up as a VxFS file system then this procedure could be easily modified to extend it as well.
Today we want to extend our primary swap LV to 4,120 MB and our ‘/’ file system to 450 MB.
We are starting with the following configuration of VG00 and the 2 disk drives that are part of the VG00 volume group. On our test system the disks in use by VG00 are c1t6d0 & c2t6d0.
— Physical volumes —
PV Name /dev/dsk/c1t6d0
PV Status available
Total PE 4340
Free PE 554
Autoswitch On
Proactive Polling On
PV Name /dev/dsk/c2t6d0
PV Status available
Total PE 4340
Free PE 554
Autoswitch On
Proactive Polling On
The current file systems sizes for VG00, including the primary swap LVOL are:
# bdfmegs -V vg00
File-System Mbytes Used Avail %Used Mounted on
/dev/vg00/lvol3 409 139 268 34% /
/dev/vg00/lvol1 295 43 222 16% /stand
/dev/vg00/lvol8 5120 1032 4057 20% /var
/dev/vg00/lvol7 2097 1419 672 68% /usr
/dev/vg00/lvol6 204 95 108 47% /tmp
/dev/vg00/lvol5 3072 2844 225 93% /opt
/dev/vg00/lvol4 102 2 98 3% /home
# swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4096 0 4096 0% 0 – 1 /dev/vg00/lvol2
reserve – 141 -141
memory 3261 1062 2199 33%
total 7357 1203 6154 16% – 0 –
We will extend primary swap and ‘/’ (LVOLs 2 and 3) on c1t6d0 first and then remirror back to c2t6d0.
Since all space has to be contiguous for LVOLs 2 and 3 we must first make space available at the end of LVOL2 so it can be successfully extended.
To do this we will reduce the mirrors for LVOLs 3 – 8 on c1t6d0.
# for i in 3 4 5 6 7 8
> do
> lvreduce -m 0 /dev/vg00/lvol${i} /dev/dsk/c1t6d0
> done
Logical volume “/dev/vg00/lvol3” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume “/dev/vg00/lvol4” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume “/dev/vg00/lvol5” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume “/dev/vg00/lvol6” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume “/dev/vg00/lvol7” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume “/dev/vg00/lvol8” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
We will now reduce the mirrors for LVOLs 1 and 2 from /dev/dsk/c2t6d0. We need to do this because trying to extend LVOL2 while a mirror copy exists on both disks will result in an error because there is no space available at the end of LVOL2 on disk c2t6d0.
# for i in 1 2
> do
> lvreduce -m 0 /dev/vg00/lvol${i} /dev/dsk/c2t6d0
> done
Logical volume “/dev/vg00/lvol1” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume “/dev/vg00/lvol2” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
We now have the following:
— Physical volumes —
PV Name /dev/dsk/c1t6d0
VG Name /dev/vg00
PV Status available
Allocatable yes
VGDA 2
Cur LV 2
PE Size (Mbytes) 4
Total PE 4340
Free PE 3241
Allocated PE 1099
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On
— Distribution of physical volume —
LV Name LE of LV PE for LV
/dev/vg00/lvol1 75 75
/dev/vg00/lvol2 1024 1024
— Physical volumes —
PV Name /dev/dsk/c2t6d0
VG Name /dev/vg00
PV Status available
Allocatable yes
VGDA 2
Cur LV 8
PE Size (Mbytes) 4
Total PE 4340
Free PE 554
Allocated PE 3786
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On
— Distribution of physical volume —
LV Name LE of LV PE for LV
/dev/vg00/lvol3 100 100
/dev/vg00/lvol4 25 25
/dev/vg00/lvol5 750 750
/dev/vg00/lvol6 50 50
/dev/vg00/lvol7 512 512
/dev/vg00/lvol8 1250 1250
Now we will extend LVOL2 on disk c1t6d0 to 4124 MB:
# lvextend -L 4124 /dev/vg00/lvol2
Logical volume “/dev/vg00/lvol2” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
In order for the extra primary swap space to be usable, the system must be rebooted.
We now see that vg00/lvol2 is occupying 1031 extents on /dev/dsk/c1t6d0 rather than the 1024 it was occupying previously:
— Physical volumes —
PV Name /dev/dsk/c1t6d0
VG Name /dev/vg00
PV Status available
Allocatable yes
VGDA 2
Cur LV 2
PE Size (Mbytes) 4
Total PE 4340
Free PE 3234
Allocated PE 1106kl
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On
— Distribution of physical volume —
LV Name LE of LV PE for LV
/dev/vg00/lvol1 75 75
/dev/vg00/lvol2 1031 1031
We will now move /dev/vg00/lvol3 from /dev/dsk/c2t6d0 to /dev/dsk/c1t6d0 so it starts at the end of lvol2, as required by HP-UX.
We will do this by mirroring lvol3 back to c1t6d0 and then removing it from c2t6d0. This could be done via the ‘pvmove’ command, but if pvmove were to be interrupted, it could render the lvol unusable.
# lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c1t6d0
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol3” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
# lvreduce -m 0 /dev/vg00/lvol3 /dev/dsk/c2t6d0
Logical volume “/dev/vg00/lvol3” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
We will now extend lvol3 to 450 MB in size. We must extend both the LV and the underlying file system.
# lvextend -L 450 /dev/vg00/lvol3
Warning: rounding up logical volume size to extent boundary at size “452” MB.
Logical volume “/dev/vg00/lvol3” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
You will notice that ‘lvextend’ rounded up to 452 MB since that is evenly divisible by 4, which is the PE size defined for VG00.
We will now extend the filesystem for ‘/’:
# fsadm -F vxfs -b 452m /
vxfs fsadm: /dev/vg00/rlvol3 is currently 409600 sectors – size will be increased
Now our ‘/’ file system is 452 MB in size:
# bdf /
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 462848 139808 320560 30% /
At this point we now have LVOLs 1, 2 and 3 on disk c1t6d0 and LVOLs 4, 5, 6, 7 and 8 on disk c2t6d0.
— Physical volumes —
PV Name /dev/dsk/c1t6d0
VG Name /dev/vg00
PV Status available
Allocatable yes
VGDA 2
Cur LV 3
PE Size (Mbytes) 4
Total PE 4340
Free PE 3121
Allocated PE 1219
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On
— Distribution of physical volume —
LV Name LE of LV PE for LV
/dev/vg00/lvol1 75 75
/dev/vg00/lvol2 1031 1031
/dev/vg00/lvol3 113 113
— Physical volumes —
PV Name /dev/dsk/c2t6d0
VG Name /dev/vg00
PV Status available
Allocatable yes
VGDA 2
Cur LV 5
PE Size (Mbytes) 4
Total PE 4340
Free PE 1753
Allocated PE 2587
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On
— Distribution of physical volume —
LV Name LE of LV PE for LV
/dev/vg00/lvol4 25 25
/dev/vg00/lvol5 750 750
/dev/vg00/lvol6 50 50
/dev/vg00/lvol7 512 512
/dev/vg00/lvol8 1250 1250
We now need to move LVOLs 4-8 back to disk c1t6d0 and then remirror that disk back to c2t6d0 so that all LVOLs are in the proper order on the disk.
We will do this be extending the mirrors for LVOLs 4-8 back to c1t6d0, then reducing them off of c2t6d0. If we do not reduce the mirrors off of c2t6d0, then LVOLs 1, 2 and 3 will not fit at the beginning of the disk due to their new sizes and their required contiguous allocation policy.
# for i in 4 5 6 7 8
> do
> lvextend -m 1 /dev/vg00/lvol${i} /dev/dsk/c1t6d0
> done
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol4” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol5” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol6” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol7” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol8” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
— Physical volumes —
PV Name /dev/dsk/c1t6d0
VG Name /dev/vg00
PV Status available
Allocatable yes
VGDA 2
Cur LV 8
PE Size (Mbytes) 4
Total PE 4340
Free PE 534
Allocated PE 3806
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On
— Distribution of physical volume —
LV Name LE of LV PE for LV
/dev/vg00/lvol1 75 75
/dev/vg00/lvol2 1031 1031
/dev/vg00/lvol3 113 113
/dev/vg00/lvol4 25 25
/dev/vg00/lvol5 750 750
/dev/vg00/lvol6 50 50
/dev/vg00/lvol7 512 512
/dev/vg00/lvol8 1250 1250
— Physical volumes —
PV Name /dev/dsk/c2t6d0
VG Name /dev/vg00
PV Status available
Allocatable yes
VGDA 2
Cur LV 5
PE Size (Mbytes) 4
Total PE 4340
Free PE 1753
Allocated PE 2587
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On
— Distribution of physical volume —
LV Name LE of LV PE for LV
/dev/vg00/lvol4 25 25
/dev/vg00/lvol5 750 750
/dev/vg00/lvol6 50 50
/dev/vg00/lvol7 512 512
/dev/vg00/lvol8 1250 1250
The mirrors have been re-established to disk c1t6d0 so now we will remove the all LVs still residing on disk c2t6d0.
# for i in 4 5 6 7 8
> do
> lvreduce -m 0 /dev/vg00/lvol${i} /dev/dsk/c2t6d0
> done
Logical volume “/dev/vg00/lvol4” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume “/dev/vg00/lvol5” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume “/dev/vg00/lvol6” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume “/dev/vg00/lvol7” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume “/dev/vg00/lvol8” has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Now disk c2t6d0 is an empty disk.
— Physical volumes —
PV Name /dev/dsk/c2t6d0
VG Name /dev/vg00
PV Status available
Allocatable yes
VGDA 2
Cur LV 0
PE Size (Mbytes) 4
Total PE 4340
Free PE 4340
Allocated PE 0
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On
We will now re-mirror all LVs from c1t6d0 to c2t6d0.
# for i in 1 2 3 4 5 6 7 8
> do
> lvextend -m 1 /dev/vg00/lvol${i} /dev/dsk/c2t6d0
> done
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol1” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol2” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol3” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol4” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol5” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol6” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol7” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ….
Logical volume “/dev/vg00/lvol8” has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The mirrors have now been extended and our resize operation is complete.
— Physical volumes —
PV Name /dev/dsk/c1t6d0
VG Name /dev/vg00
PV Status available
Allocatable yes
VGDA 2
Cur LV 8
PE Size (Mbytes) 4
Total PE 4340
Free PE 534
Allocated PE 3806
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On
— Distribution of physical volume —
LV Name LE of LV PE for LV
/dev/vg00/lvol1 75 75
/dev/vg00/lvol2 1031 1031
/dev/vg00/lvol3 113 113
/dev/vg00/lvol4 25 25
/dev/vg00/lvol5 750 750
/dev/vg00/lvol6 50 50
/dev/vg00/lvol7 512 512
/dev/vg00/lvol8 1250 1250
— Physical volumes —
PV Name /dev/dsk/c2t6d0
VG Name /dev/vg00
PV Status available
Allocatable yes
VGDA 2
Cur LV 8
PE Size (Mbytes) 4
Total PE 4340
Free PE 534
Allocated PE 3806
Stale PE 0
IO Timeout (Seconds) default
Autoswitch On
Proactive Polling On
— Distribution of physical volume —
LV Name LE of LV PE for LV
/dev/vg00/lvol1 75 75
/dev/vg00/lvol2 1031 1031
/dev/vg00/lvol3 113 113
/dev/vg00/lvol4 25 25
/dev/vg00/lvol5 750 750
/dev/vg00/lvol6 50 50
/dev/vg00/lvol7 512 512
/dev/vg00/lvol8 1250 1250
File-System Mbytes Used Avail %Used Mounted on
/dev/vg00/lvol3 462 139 320 30% /
/dev/vg00/lvol1 295 43 222 16% /stand
/dev/vg00/lvol8 5120 1032 4057 20% /var
/dev/vg00/lvol7 2097 1419 672 68% /usr
/dev/vg00/lvol6 204 95 108 47% /tmp
/dev/vg00/lvol5 3072 2844 225 93% /opt
/dev/vg00/lvol4 102 2 98 3% /home
— Physical volumes —
PV Name /dev/dsk/c1t6d0
PV Status available
Total PE 4340
Free PE 534
Autoswitch On
Proactive Polling On
PV Name /dev/dsk/c2t6d0
PV Status available
Total PE 4340
Free PE 534
Autoswitch On
Proactive Polling On
If you look at our “before” snapshot, you will see that the “Free PE” values for the 2 disks in VG00 have decreased and the overall size of the ‘/’ file system has increased.
If you resized your primary swap LVOL, the a system reboot is required so that the additional space we allocated to LVOL2 will be available and usable. After a reboot our primary swap looks like this:
# swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4124 0 4096 0% 0 – 1 /dev/vg00/lvol2
reserve – 100 -100
memory 3338 244 3094 7%
total 7462 344 7090 5% – 0 –
Notice that we now have 4,124 MB of swap space available.
We are now done. Your primary swap and ‘/’ file systems are now larger.
If you have a system in which /stand is a VxFS type file system rather than HFS, then you could use this procedure to increase it, if needed, as well. You would need to start with only LVOL1 on the first disk and increase its size. Then start adding back the other logical volumes one at a time and increase their size if required.
– See more at: http://serviceitdirect.com/blog/how-can-i-increase-size-primary-swap-and-file-systems-vg00-lvols-2-and-3-hp-ux-1111-server#sthash.Ia5BPQmm.dpuf
Tags: HP-UX