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

swap not enabled if raid devices not in sync when booting



Hello,

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.


/etc/init.d/checkroot.sh:

#
# 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 ]
then
  mount -n /proc
  if ! grep -qs resync /proc/mdstat
  then
        [ "$VERBOSE" != no ] && echo "Activating swap..."
        swapon -a 2> /dev/null
  fi
  umount -n /proc
fi


/etc/init.d/mountall.sh:

#
# 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.)

Comments?
-- 
Brian May <bam@snoopy.apana.org.au>



Reply to: