[lug] Convert swap from raid0 to raid1

Sean Reifschneider jafo at tummy.com
Wed Jul 25 23:35:25 MDT 2007


On Wed, Jul 25, 2007 at 11:03:20PM -0600, dio2002 at indra.com wrote:
>> Why would you want to mirror swap space?  I can think of a few things
>> that will help to make a box slow and that is one of them.  If your
>> computer swaps it will have to make twice as many writes as it does now.

Yes, but those writes can happen in parallel, so it's really not any worse
than having just a single swap device.  On the other hand, if one of the
drives in the RAID array goes out, and you need it for swap, your system
*WILL* be unhappy...  So, just what exactly are you trying to optimize for?

Besides, if your system is swapping you're already trading off 3 orders of
magnitude performance, so who really cares if even if swap were 2000x
slower than RAM rather than just 1000x.

>thoughts.  i worried about the performance hit when i decided to go that
>route but everything is a tradeoff.  availability versus performance in

If you are worried about performance, disable swap or make it very small.
Unless your application really just *HAS* to complete, no matter what, it's
probably better off to have the system kill processes, than for it to start
thrashing and become unresponsive.  A system that is unresponsive because
of thrashing for 15 minutes might as well be down...

>which brings up a question. as it stands now, swap is raid 0.  which means
>that if one drive goes south when the system is booted, i believe that
>would prevent the system from coming up.  i'll pull my drive and check
>that in a second.

It depends on the failure mode of the drive.  If it is just some blocks
that are bad, then it will probably come up unless the swap signature block
is one of the bad ones.  In that case it may or may not come up.  If the
drive is entirely dead, it may or may not come up, depending on whether the
kernel decides it's bad and gives up and continues booting, or keeps trying
to read it...  The same old discussion...

>but before this thread gets completely hijacked, i want to try to solve my
>original problem.  so if anybody has input on that. i'm game.

swapoff, re-create the swap drive as a RAID-1, mkswap, swapon.

Sean
-- 
 Do one thing every day that scares you.
                 -- Mary Schmich
Sean Reifschneider, Member of Technical Staff <jafo at tummy.com>
tummy.com, ltd. - Linux Consulting since 1995: Ask me about High Availability




More information about the LUG mailing list