LVM2 lockup while snapshotting root
I tried to snapshot LVM2 the root partition and (probably not to the surprise of most of you) hung my system. In thinking about this problem, I think there is a solution. I do not know precisely what causes the problem, but it can only be one of two things.
First, it could be updates to /etc/lvm while the filesystem is suspended. This shouldn't be done at all. First, a journal of what the planned change is should be written to /etc/lvm, the filesystem suspended, the change made, the filesystem unsuspended, then a marker indicating that the change succeeded to /etc/lvm.
Second, it could be the fact that the LVM executable is demand paged. It could be that a page of the executable is read in while the filesystem is suspended. This is trickier to solve, and having the problem is much more excusable than the first.
The second problem can be solved by creating a temporary ramdisk, mounting it off of /tmp, copying lvm.static there, then forking and execing that lvm.static to do what the person asked. When it finishes, the original wakes back up to the new snapshotted reality (it was sitting in a 'waitpid' call the whole time) and removes the ramdisk.
I may implement this (perhaps using a wrapper perl script), as I would like to be able to snapshot my root filesystem. If anybody knows that I'm wrong about something, please tell me before I start.
Thanks,
Signature · 4 lines
"It does me no injury for my neighbor to say there are twenty gods or no God. It neither picks my pocket nor breaks my leg." --- Thomas Jefferson "Go to Heaven for the climate, Hell for the company." -- Mark Twain -- Eric Hopper ([email protected] http://www.omnifarious.org/~hopper) --
Quoted 5 lines · Eric Hopper
First, it could be updates to
/etc/lvmwhile the filesystem is suspended. This shouldn't be done at all. First, a journal of what the planned change is should be written to/etc/lvm, the filesystem suspended, the change made, the filesystem unsuspended, then a marker indicating that the change succeeded to/etc/lvm.
Sounds like a good starting point. Other interesting cases are swap on LVM, and rolling back the root fs to a snapshot.
Quoted 4 lines
Second, it could be the fact that the LVM executable is demand paged. It could be that a page of the executable is read in while the filesystem is suspended. This is trickier to solve, and having the problem is much more excusable than the first.
mlockall(2)?
Regards,
Bill Rugolsky
It's more subtle: firstly, are you using the latest code compiled with O_NOATIME defined correctly, with O_DIRECT configured and without activation=1 in the log section of lvm.conf?
If not, retest.
There is a known out-of-memory issue with snapshots (shows up in kernel messages).
Anything other than that, run some diagnostics to see where things are going wrong.
[It shouldn't write to /etc and it already uses mlockall]
Alasdair
Signature · 1 line
[email protected]