I have not really done this yet, but 

     if [ ! -e /proc/mdstat ] || \
               [ `grep -ci resync /proc/mdstat` -eq 0 ] ; then
          swapon -a
     fi

seems like a reasonable approach.  Martin Bene posted a slightly different
variant which waits until remirroring is done and then starts swapping,
but my preference is to have swapping disabled until human intervention
turns it back on if something causes a RAID-1 set to require remirroring
at boot time.  Generally, reboots are infrequent enough events to us that
they should, of themselves, warrant human investigation.

I currently have a system where /dev/md0 (built from /dev/hda1 and
/dev/hdc1, both set to type 0xFD) is the root fs, but swapping is done
conventionally on /dev/hda2 and /dev/hdc2.  After reading the various
ideas here, I think it makes more sense to unify /dev/hda2 and /dev/hdc2
into a second RAID-1 set, /dev/md1, just for swapping.  As long as the
script approach I discuss above is used, swapping is not turned on at
reboot if a remirror is in progress and so swapping onto RAID-1 should be
safer than conventional swapping.  Clearly, if conventional swapping is
used, the system is almost certain to crash if there is a drive failure.

-- Mike


On Tue, 28 Mar 2000, Godfrey Livingstone wrote:

> I have raid 1 working and am swapping onto /dev/md1 I am interested to know
> what modifacations you made to the startup scripts. We run redhat 6.1 with a
> patched (for raid and promise ide controller ) 2.14 kernel. Anyway what scripts
> do I need to change and how.  Presumably by altering rc.sysinit and checking
> that the resynchronisation of the swap partation is complete (how?) before
> issusing the command "swapon -a" ?
> 
> Godfrey Livingstone
> 
> Martin Bene wrote:
> 
> > >2. Combine /dev/hda2 and /dev/hdc2 into a RAID-1 array, say /dev/md1, to
> > >be used just for swapping.
> >
> > Also works, but you'll have to modify your startup scripts to delay swapon
> > until resynchronisation of the swap partition is finished. That's the
> > configuration I'm using. using swap on a raid partition during rebuild WILL
> > trash your memory => crash/data corruption.



Reply via email to