Convert to Scalable Volume Groups
Convert to Scalable Volume Groups
You may need to add extra disks to a volume group (VG) due to pure business data growth or because you require additional testing environments. You might face a situation where you’ve exceeded the permitted allowed maximum physical volume (PV) for that VG. This is true for small and big VGs. To determine which type of VG you have, use the readvgda command. Just read an active disk within the VG to discover the type. For example:
# readvgda hdisk5 | grep type ..... readvgda_type: smallvg readvgda hdisk1 | grep type ..... readvgda_type: bigvg # readvgda hdisk4 |grep type ..... readvgda_type: svg.
AIX has three types of VGs:
- Small VG (smallvg) with a Max PV of 32
- Big VG (bigvg) with a Max PV of 128
- Scalable VG (svg) with a Max PV of 1024
The Max PV values aren’t set in stone and exclude the scalable type as factoring has no effect on this type of VG. If you’ve used factoring to alter your small or big VG, this will bring the Max PV count down. However, this also increases your physical partitions per PV, so it’s a case of swings and roundabouts; in the end, one offsets the other.
So let’s assume you’ve reached the Max PV count in the VG and factoring is no longer an option as it has reduced your actual Max PV count. You need to add additional disks into the VG. The only real option is to convert to a scalable VG. In fact, whenever you need to create a new VG, future-proof it and create a scalable VG.
To convert to a scalable VG, here are the basic rules:
- No stale partitions within the VG
- There must be a free logical partition (LP) at the end (edge) of each disk in the VG to hold the new volume group descriptor area (VGDA). Note: Go for at least two free LPs as a best practice
- VG must be varied off for the conversion
Find Space at the End of Each Disk
For each PV in the VG, ensure you have at least one free LP. I always go for two. It may be more depending on the current VG attributes set, but AIX will tell you if it doesn’t have enough when converting to scalable. You can mess around with reducing filesystems sizes to try to free up LPs at the end of the disk but generally this won’t work.
Let’s review the full disk (hdisk3). In the following output, hdisk3 is full:
# lspv -M hdisk3|tail -4 hdisk3:543 fslv01:510 hdisk3:544 fslv01:511 hdisk3:545 fslv01:512 hdisk3:546 fslv01:513
Let’s free disk space by migrating the last two LPs from the edge of hdisk3 to hdisk2. We can tell we have free LPs on hdisk2 from the end output of command: 128-135, which tells us we have seven free LPs:
# lspv -M hdisk2|tail -4 hdisk2:125 fslv01:638 hdisk2:126 fslv01:639 hdisk2:127 fslv01:640 hdisk2:128-135
Let’s move the following LPs across to hdisk2, fslv01/512, fslv01/513 using the migratelp command in this format:
migratelp <logical volume>/<LP_number> <destination_disk>
To move the two LPs from the end of hdisk3 to hdisk2 (which is also contained in the VG), use the following commands:
#migratelp fslv01/513 hdisk2 migratelp: Mirror copy 1 of logical partition 513 of logical volume fslv01 migrated to physical partition 128 of hdisk2. # migratelp fslv01/512 hdisk2 migratelp: Mirror copy 1 of logical partition 512 of logical volume fslv01 migrated to physical partition 129 of hdisk2.
Post LP migration, let’s review both disks. We can now see the LPs have been migrated across from hdisk3 to hdisk2 and now hdisk2 has five free LPs.
# lspv -M hdisk3|tail -4 hdisk3:542 fslv01:509 hdisk3:543 fslv01:510 hdisk3:544 fslv01:511 hdisk3:545-546 # lspv -M hdisk2|tail -4 hdisk2:127 fslv01:640 hdisk2:128 fslv01:513 hdisk2:129 fslv01:512 hdisk2:130-135
Now we’re all set to convert the VG (datavg) to scalable. First, let’s confirm the VG type we’re converting is a bigvg:
# readvgda hdisk2 |grep type ..... readvgda_type: bigvg .
Next, unmount the filesystems contained in the VG, then vary off the VG:
# varyoffvg datavg
Confirm it’s offline:
# lsvg -o rootvg # lsvg rootvg datavg
We’re ready to convert to scalable using the following command format:
chvg –G <vg_name>
When you convert to scalable, you’ll be prompted to confirm that once converted you can’t import into AIX 5.2 or earlier. So let’s convert:
# chvg -G datavg 0516-1224 chvg: WARNING, once this operation is completed, volume group datavg cannot be imported into AIX 5.2 or lower versions. Continue (y/n) ? Y 0516-1216 chvg: Physical partitions are being migrated for volume group descriptor area expansion. Please wait. 0516-1712 chvg: Volume group datavg changed. datavg can include up to 1024 physical volumes with 2097152 total physical partitions in the volume group.
Now vary on the VG, mount the filesystems and check conversation was successful. No errors were output during the conversion so we can be pretty confident all is well, but let’s check anyway by querying the VG type and the MAX PVs, which should now be 1024:
# varyonvg datavg # mount -a # readvgda hdisk2 |grep type ..... readvgda_type: svg # lsvg datavg | grep "MAX PV" MAX PPs per VG: 131072 MAX PVs: 1024
Successful Disk Growth
You’re done. The VG has been converted to scalable and you can now add more disks to the VG and experience disk growth without problems.