[linux-lvm] UPS shutdown on system with lvm volume for root

Stuart D. Gathman stuart at bmsi.com
Tue Jul 15 20:36:25 UTC 2008


On Tue, 15 Jul 2008, David Mathog wrote:

> Is a similar command necessary for lvm? Or will the lvm volume have been
> remounted readonly "automagically" by this section of the halt script,
> which precedes the above changes by a couple of lines?
> 
> # Remount read only anything that's left mounted.
> # echo $"Remounting remaining filesystems readonly"
> mount | awk '{ print $3 }' | while read line; do
> fstab-decode mount -n -o ro,remount $line
> done

The above makes all mounted filesystems readonly, including those on logical
volumes.  There is no "mounting" for LVM itself.  Under normal operations, the
metadata does not change.  If the system is in the middle of a pvmove - well -
making the metadata suddenly readonly won't exactly help matters.  Ideally, LVM
should update metadata in a manner that leaves it consistent should the system
crash in the middle.  The current LVM strives toward that goal.  But there
shouldn't be any LVM updating going on during a shutdown.  There is no
LVM metadata updated in normal operations.

Snapshots will update the COW table.  Mounting the filesystems read-only 
should freeze that.  And again, COW updates are designed to be interruptable.

> It is important that the logical volume is shut down nicely on a power
> failure event, since it takes a very long time to fsck it, and that

Even if you lose power before the mount readonly, you don't need a full fsck
for journalled filesystems.

If you are using Xen, then virtual machines may be updating their filesystems.
The standard shutdown for Xen will either shutdown each VM or suspend each
VM to disk.  Suspending to disk is actually the fastest approach.

You don't need to worry about swap.

-- 
	      Stuart D. Gathman <stuart at bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.




More information about the linux-lvm mailing list