1833568 Members
3508 Online
110061 Solutions
New Discussion

lvm_lock and lvextend

 
J. Michael Hildebrandt
Occasional Advisor

lvm_lock and lvextend

I am currently mirroring the root disk, I have pvcreate -B -f and the device file.
I have vgextended the disk to /dev/vg00
I have mkbooted the disk and added the command ("hpux -lq").
I am now lvextending -m 1 the logical volumes. In the past I have been able to (I am pretty sure I have) do mulitple lvextend's at the same time BUT this time it came up with the error message:
Cannot lock "/etc/lvmconf//lvm_lock" still trying ...#

So why is this happening?
Second thing is this, when I check the file lvm_lock it was an file that is at least 20 days old.
I checked for running lvm processes and also checked to if any processes where acessing the file using lsof but there were none.
I deleted the file, ran another lvextend and found the lvm_conf file back again ran another lvextend with the same error message. But once the first lvextend process finished I was able to run another one even though the lvm_lock file was still present. How is this possible?
I could try using my other login to see if it relates to the shell but......

From what I have read the lvm_lock file is only present when changes are being made to the lvmtab file, but access should be very quick not the length of time it takes to mirror the logical volume - not to mention the file being left after the command has finished.
I would also add that the machine has been re-booted in the last week so the first lvm_lock file was present before but did not stop me running the lvextend command the very first time.
What is going on?
Many thanks
5 REPLIES 5
Patrick Wallek
Honored Contributor

Re: lvm_lock and lvextend

I don't think I have ever been able to run multiple lvextends at the same time. I personally wouldn't.

I prefer scripting the lvextend commands like:

for i in 1 2 3 4 5 6 7 8 9
do
echo "Mirroring /dev/vg00/lvol${i}"
lvextend -m 1 /dev/vg00/lvol${i} /dev/dsk/c?t?d?
done

That way no manual intervention is required and as soon as 1 finishes the next will start.
Uday_S_Ankolekar
Honored Contributor

Re: lvm_lock and lvextend

Are you sure there is no other lvm related command running?
Good Luck..
Sandman!
Honored Contributor

Re: lvm_lock and lvextend

Michael,

Purpose of the lvm_lock files is that when lvm commands run and need to access the lvmtab file there needs to be a way so that they do not update/access the file when it is being updated/accessed by other lvm commands.

By deleting the lvm_lock file you could have one lvm command update or access the lvmtab file while another command is already doing this. This could cause the system to behave incorrectly or even corrupt the lvmtab file or worst case cause it to be lost completely.

Sometimes it might be necessary to delete the lvm_lock file to release the lvmtab file for lvm commands. If the process holding the lvm_lock can be killed gracefully it should remove the lock. A reboot may be needed afterward to free the lvmtab file. Afterward the lvm command should work fine.

cheers!
J. Michael Hildebrandt
Occasional Advisor

Re: lvm_lock and lvextend

Thanks for your suggestions.

I can assure you that no other processes are accessing either the lvmtab or the lvm_lock.

As someone said, maybe I cannot run the lvextend command twice (I must be thinking of Solaris and mirroring that root disk because it can run mulitple mirrors on the slices at the same time).

Anyway I have just checked on two other machines and the file is present there so maybe it is simply suppose to be there.

Thanks for all your help am closing this now.
J. Michael Hildebrandt
Occasional Advisor

Re: lvm_lock and lvextend

Closing this thread now.