Hi,

As far as I understand, it is not possible to swap to a RAID1 device

This is because the ll_rw_swap_file function in ll_rw_block.c of the kernel
source only uses the md_map function and not the md_map and md_make_request
functions like the ll_rw_block function. Therefore, only md personalities
which use the md_map not md_make_request can be used for swap. The RAID1 md
personality uses the md_make_request function, so it can't work for swap.

It seems that it would not be too hard to modify the ll_rw_swal_file
function so that it calls md_make_request, but I have a feeling that those
who know more did not do this for a reason. Perhaps it is because the raid1
driver makes memory allocation calls - having to allocate memory just to
swap out a block could lock up the system.

If anyone really knows why this is, I'd like to know.

----

I recently ran into this swapping problem and thought up a solution which
goes like this:

My system has two 9gig drives, call them A and B, and they are SCSI ID 0 and
1, respectively. When both drives are running, the system boots off of drive
A and swaps off of drive B. Note that if drive A fails and the system
reboots, it will not be able to boot because the master boot record will be
dead. So, we don't want to crash if drive A fails.

At this point there are two failure modes: (1) A fails, (2) B fails. If A
fails the swap is not corrupted, and the system keeps on running. No need to
reboot. I get paged that drive B failed and fix it as soon as possible. If
drive B fails the system will lock up. This will be detected by a watchdog
system which will reboot the first system. When the system reboots it will
detect that drive B has failed and swap off of A.

The smarts to change where the swapping is done is quite simple. Just find
in the /etc/rc.sysinit file where it calls swapon and replace it with the
following: (but change the device names to meet your system)

-----
dd if=/dev/sdb1 of=/dev/null 2> /dev/null
if $?
then
    swapon /dev/sdb1
else
    swapon /dev/sda1
fi
-----

Make sure that this swapon syntax is correct for your system and that it is
no reading lines from the /etc/fstab file. Refer to the swapon man page.



 - David Harris
   Principal Engineer, DRH Internet Services


--- original message ---
To: [EMAIL PROTECTED]
Subject: Swapping onto raid1 device?
From: Louis Mandelstam <[EMAIL PROTECTED]>
Date: Mon, 16 Nov 1998 11:41:18 +0200 (SAST)

Good day -

Is using a raid1 partition pair for swap space supported?

I've tried creating a raid1 pair, running mkswap on it (no problem) and
then swapon (no problem once again), but when I force swapping to occur,
the system crashed with 'in swapper task - not syncing'.

There may have been more text at the time of the crash, but I can't
re-create the crash at this point in order to get the full text, since the
box is in use.

Anyone else running swapspace over RAID1?

The reason why I'd like to do this in the first place, is that the box
involved needs serious uptime/HA, and I don't want to go to all the
trouble of RAIDing the system and data disks, just so a physical disk
failure hosting swap space can crash the box.

Any ideas?

Thanks

Regards


Reply via email to