Link to home
Start Free TrialLog in
Avatar of Mark
Mark

asked on

swapfile on RAID, or not?

I've just set up my Linux boot device as a RAID-1. Seems to work OK. I've not been sure about what to do with swap space. Googling turned up this interesting statement http://tldp.org/HOWTO/Software-RAID-HOWTO-2.html

There's no reason to use RAID for swap performance reasons. The kernel itself can stripe swapping on several devices, if you just give them the same priority in the /etc/fstab file.

A nice /etc/fstab looks like:
/dev/sda2       swap           swap    defaults,pri=1   0 0
/dev/sdb2       swap           swap    defaults,pri=1   0 0
:
/dev/sdg2       swap           swap    defaults,pri=1   0 0

This setup lets the machine swap in parallel on seven SCSI devices. No need for RAID, since this has been a kernel feature for a long time.
Sounds like I don't need my swap partitions inside a RAID. But then in the very next paragraph he says,
Another reason to use RAID for swap is high availability. If you set up a system to boot on eg. a RAID-1 device, the system should be able to survive a disk crash. But if the system has been swapping on the now faulty device, you will for sure be going down. Swapping on a RAID-1 device would solve this problem.
Is this contradicting he immediate preceding statement or am I just not reading something right? Which way is he recommending? Are non-RAID swap partitions a good thing or a bad thing?

Confused!
ASKER CERTIFIED SOLUTION
Avatar of Frosty555
Frosty555
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mark
Mark

ASKER

OK, I was suspecting that was the idea, but not sure. So, if I have the non-RAID method of multiple swap partitions on the RAID drives and one of the drives fails, I'm down, right? Which is totally NOT what I want. That's the point of the RAID (at least my point). I can create minutely backups of the main drive to a 2nd drive with rsync, so simply backing up data is not really why I want a RAID setup.

Therefore, I supposed I need to RAIDify my swap partitions.
Yep, you got it.
Avatar of Mark

ASKER

Did it. It works just fine!