When you run some AIX Logical Volume Manager (LVM) commands, the volume group you’re working on gets locked. Don’t worry. The data is still accessible and users can work away merrily (or grumpily). The lock is put in place to stop other LVM commands which might try to update the same LVM metadata.
For example, if you run migratepv to move your data to a new, fast-performing LUN (you hope), you might like to check the state of the volume group (VG). If you try to view the VG while it is locked, you’ll get a message such as this:
0516-1201 lsvg: Warning: Volume group datavg is locked. This command will continue retries until lock is free. If lock is inadvertent and needs to be removed, execute ‘chvg -u datavg’.
Advice for the impatient
You just want to look at the state of your VG, without changing it and you’re getting a “come back later” sign. What can you do about it? Actually, you have a few options:
- run the chvg -u command to remove the lock. Actually, it looks to me as if this command is only meant if the vg is locked because of an abnormal termination of another, legit LVM command. So chvg -u is probably not your first choice of action.
- Wait until the original command finishes successfully and then check. Go get a coffee while instead of staring at a screen. A watched pot never boils (which might mean you’ll have cold coffee)
- Use the -L flag to ignore the lock.
The big -L lock breaker
On LVM list commands, the -L flag lets you view the information without waiting to obtain a lock on the volume group. So, if you come across the message which tells you the volume group is locked, and you really can’t wait, you could use:
The first -L doesn’t wait for a lock on the volume group. The second one is to list logical volumes.
To list a single logical volume, such as lv00, use
And to list PVs (physical volumes, although these days they’re almost always virtual)