AIX LVM Protects me from my own stupidity
AnthonyEnglish 270000RKFN Comments (2) Visits (13418)
One of the great strengths of AIX is the Logical Volume Manager (LVM). It may not be completely foolproof, but it does provide quite a lot of protection from administrator errors.
Here are a few common LVM tasks that I've deliberately attempted to make a mess of. See how the LVM reacts
(Don't Try This at Home)
Let's start with three Physical Volumes. rootvg has one PV (booting from SAN) and datavg has two PVs.
hdisk0 00c5a47ecf9edd3e rootvg active
hdisk1 00c5a47ed021ea7d datavg active
hdisk2 00c5a47ef172e84d datavg active
So, let's try to do some damage:
import a volume group that is already active:
# importvg -y datavg hdisk1
0516-360 getvgname: The device name is already used; choose a
0516-776 importvg: Cannot import hdisk1 as datavg.
"Just a moment, please!"
If you try to remove a disk from the operating system Object Data Manager (ODM) while it's still in an active volume
group, you'll get this warning:
rmdev -dl hdisk1
0514-062 Cannot perform the requested function because the
specified device is busy.
What about trying to remove an active disk from a volume group?
reducevg datavg hdisk2
0516-016 ldeletepv: Cannot delete physical volume with allocated
partitions. Use either migratepv to move the partitions or
reducevg with the -d option to delete the partitions.
0516-884 reducevg: Unable to remove physical volume hdisk2.
"Sorry, I'm busy!"
Not getting very far, are we? Alright, let's try to export a volume group that's in use:
0516-764 exportvg: The volume group must be varied off
OK, I'll vary it off then:
0516-012 lvaryoffvg: Logical volume must be closed. If the logical volume contains a filesystem, the umount command will close the LV device.
So I have to unmount the file systems in the volume group first. But if they're in use, I'm also protected from doing damage:
umount: 0506-349 Cannot unmount /dev/lvmksysb: The requested resource is busy.
The order of exporting a volume group is:
I can think of many other instances where the LVM protects me from my own stupidity. I don't have to remember to increase a logical volume first before expanding a file system. If I do try to overallocate beyond the MAX Logical Partitions (shown as MAX LPs in the output of the lslv command), I get an error.
Relax - this is AIX!
Good software should protect you (at least a little) from glaringly dumb mistakes. The AIX Logical Volume Manager does that. This can give you a little more confidence when you're breaking the mirror of a logical volume or adding the wrong PV to a volume group. You can still do damage (like running rm /dev/* - but don't say you saw it here), and there are in some cases flags which allow you to force the action, but the very existence of those flags are part of the checks and balances. That means you can be a bit more relaxed than you might have to be on other platforms.
The LVM is another reason why AIX is a true enterprise operating system.