What is the consensus opinion about whether swapping onto RAID is a good
idea? I understand from various people who should know that swapping onto
RAID can be unstable when actually remirroring. Does anyone have personal
experience with this issue?
I am building a dual-IDE system with two identical 30 GB drives. Each
drive is formatted identically, a 0.3 GB swap partition at the beginning
of the drive and the rest of the 30 GB as one of the participants in a
RAID-1 array. In other words:
/dev/hda1 -- 29.7 GB type 0xFD
/dev/hda2 -- 0.3 GB type 0x82
/dev/hdc1 -- 29.7 GB type 0xFD
/dev/hdc2 -- 0.3 GB type 0x82
I see three options:
1. Swap conventionally, declaring /dev/hda2 and /dev/hdc2 each as a swap
area and assigning them equal priority.
2. Combine /dev/hda2 and /dev/hdc2 into a RAID-1 array, say /dev/md1, to
be used just for swapping.
3. Create a swap file on /dev/md0 (which has been combined from /dev/hda1
and /dev/hdc1).
The risk of option 2 is that, if swapping onto a partition while it is
being remirrored is unstable, then a drive failure would not only crash
the system, but could cause corruption of good data. This would be
especially dangerous in the case of a drive which fails intermittently but
which usually works on reboot.
The problem with option 1 is that, if a drive ever does fail, the system
will certianly crash. Nevertheless, the /dev/md0 volume, which is what we
really care about, would likely survive.
As far as I can tell, option 3 combines the risks of both approaches and
seems to have little to recommend it.
I am currently using a 2.2.14 kernel with Ingo Molnar's patches.
-- Mike