1

When setting up a new system, if I am planning on mirroring two hard drives, what should I do with the SWAP area? I can think of three things I can do...

  1. Do a mirror of the SWAP partition
  2. Stripe it for speed
  3. Create two separate SWAP partitions

I can see number 1 just seeming "normal" compared to the rest of the partitions, but does it need to be mirrored? Would the system break if the Stripe (option 2) died? Would the system use both SWAP partitions if I created two separate ones? What would be the ideal setup?

3

Swap is memory, so if it died you'd probably get a kernel panic. At the very least, you'd see some binaries crash. That being said, if you don't need / want your system to keep running after a disk up and dies on you, go ahead and stripe because performance is king re:swap.

|improve this answer|||||
  • There'd be no point in having RAID-1 on the other partitions either if he doesn't need/want his system to keep running after a disk dies, seeing as to keep running after a disk dies is the sole point of RAID. – qasdfdsaq Jun 20 '15 at 16:33
  • well, the comparison doesn't make sense. If he put swap on RAID0, then his process/system might crash, but he isn't really losing any data (leaving the one which is in RAM), but if he puts his system on RAID0, he will lose data and have to rebuilt the whole system from scratch. – Napster_X Jul 9 '18 at 5:12
  • raid-1 (mirror) makes sense for swap to get better reliability. yet, raid-0 (striping) for performance is not necessary because you can instead create something much simpler: two swap partitions (one for each drive) and Linux will "stripe" across as if it was raid-0: raid.wiki.kernel.org/index.php/Why_RAID%3F#Swapping_on_RAID – Aleksandr Levchuk Jul 5 '19 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.