[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

swap not enabled if raid devices not in sync when booting


I was rather surprised when I found my system was running slowly that
none of my swap partitions were enabled. I found this was because of
the following code, which prevents enabling *any* swap partitions if
any RAID partitions are out of sync.


# Activate the swap device(s) in /etc/fstab. This needs to be done
# before fsck, since fsck can be quite memory-hungry.
if [ -x /sbin/swapon ]
  mount -n /proc
  if ! grep -qs resync /proc/mdstat
        [ "$VERBOSE" != no ] && echo "Activating swap..."
        swapon -a 2> /dev/null
  umount -n /proc


# Execute swapon command again, in case we want to swap to
# a file on a now mounted filesystem.
grep -qs resync /proc/mdstat || swapon -a 2> /dev/null

This is most likely to occur when the power fails, and I don't want to
have to be around just so I can manually enable the swap partitions.

(side-note: none of my swap partitions use RAID.)

Brian May <bam@snoopy.apana.org.au>

Reply to: