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

Re: multiple swap areas and RAID 1



On Wed, Aug 08, 2012 at 04:25:01PM +0300, Georgi Naplatanov wrote:
> Hi.
> 
> I'm going to configure Debian GNU/Linux with software RAID 1 and I
> think to put swap area on RAID 1 (/dev/mdX), but someone told me
> that if the computer have multiple swap partition (e.g. /dev/sda2,
> /dev/sdb2) with equal priorities, linux kernel will mirror swap area
> between different devices. Is that true ? I mean kernel 2.6.32 and
> 3.2.x.
> 
I suggest you consider whether you need redundancy for your swap
parition.  What protection are you getting by putting it on RAID?  
Basically, if a hard drive fails while the system is using swap, then 
the swapped data is safe.  If you didn't use RAID and that scenario 
occurred, what would happen?  Would a program crash?  Is that acceptable
to you?

I've set up drives like this before:

/dev/sda1 - swap
/dev/sdb1 - swap
/dev/sda2 - RAID1 --> /dev/md0
/dev/sdb2 - RAID1 --> /dev/md0

I'm not claiming it's the best way.  I save a little bit of hard drive
space (which is very cheap anyway), and I accept the risk of crashing a
program *if* the system is swapping while a hard drive dies (a pretty
low probability).  Basically low risk and low payoff unless you're using
very expensive disks or have mission-critical applications running.

-Rob


Reply to: