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

David Mathog mathog at caltech.edu
Tue Jul 15 19:00:43 UTC 2008


I am trying to use nut on a Centos 5.0 system. On this system "/" is a
1.4 Tb LVM volume composed of two 700Gb partitions (striped). Nut is set
up completely except for the final modification to the /etc/init.d/halt
script. So far I have made this change:

< command=/sbin/halt
< if [ -f /var/run/killpower -a -r /etc/ups/upsmon.conf -a -f
/etc/sysconfig/ups ] ; then
< /usr/local/ups/sbin/upsdrvctl shutdown
---
> if [ "$command" = /sbin/halt -a -r /etc/ups/upsmon.conf -a -f
/etc/killpower -a -f /etc/sysconfig/ups ] ; then
> . /etc/sysconfig/ups
> if [ "$SERVER" = "yes" -a "$MODEL" = "upsdrvctl" ] ; then
> /sbin/upsdrvctl shutdown
> elif [ "$SERVER" = "yes" -a "$MODEL" != "NONE" -a -n "$MODEL" -a -n
"$DEVICE" ] ; then
> $MODEL $OPTIONS_HALT -k $DEVICE
> fi

However, I'm worried that this might corrupt the LVM metadata.  The
"upsdrvctl shutdown" is equivalent to pulling the server's power cord
out. Because of this, elsewhere in the nut documentation it suggested doing

mdadm --readonly <device>

before the upsdrvctl shutdown. However, I do not believe that the
present system is using mdadm. 

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

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
should not be needed when power is restored from a controlled UPS
initiated shutdown. Additionally, swap is also a logical volume, so it
might need special attention too. 

In a normal shutdown the upsdrvctl is never called and the halt proceeds to:
--------------------

# First, try kexec. If that fails, fall back to rebooting the old way.
[ -n "$kexec_command" ] && $kexec_command -e >& /dev/null

HALTARGS="-d"
[ -f /poweroff -o ! -f /halt ] && HALTARGS="$HALTARGS -p"

exec $command $HALTARGS

---------------------------

Is anything in there required for the lvm to be seen as clean on the
next boot???

Thanks,

David Mathog
mathog at caltech.edu
Manager, Sequence Analysis Facility, Biology Division, Caltech




More information about the linux-lvm mailing list