[Nut-upsuser] RAID handling in UPS Shutdown script

Richard Chapman rchapman at aardvark.com.au
Wed May 20 15:38:23 UTC 2009


I have read the NUT document /usr/share/doc/nut-2.2.0/docs/shutdown.txt 
And in particular the section called "RAID Warning".
In response to this section I have added the two lnes, but haven't yet 
tested it:

mdadm --readonly /dev/md0
mdadm --readonly /dev/md1

into /etc/rc.d/init.d/halt

Thus:
-----------
# 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


# Added by R Chapman 18/5/2009 as suggesteted in:
# /usr/share/doc/nut-2.2.0/docs/shutdown.txt

mdadm --readonly /dev/md0
mdadm --readonly /dev/md1

# Now halt or reboot.

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

Does this look like the right thing to do - and the right place to do it?

This is obviously fairly specific to my system (or systems with md0 and 
md1). Has anyone written smarter code which determines how many md 
devices are present and sets them readonly?

Thanks

Richard.




More information about the Nut-upsuser mailing list