[lug] Convert swap from raid0 to raid1

Dan Ferris dan at usrsbin.com
Wed Jul 25 23:35:03 MDT 2007


You can have two completely seperate swap partitions that aren't 
mirrored.  In fstab, ass prio=1 to both of them and presto, you have 
swap partition load balancing without mirroring.  But I digress...

Since it's swap and not data it should be easy to convert.

Turn off swap with swapoff (might want to be in single user mode).
Nuke the metadevice with mdadm
Create a new metadevice with mdadm and specify --level=1
Change around fstab if you have to.
swapon

Then think to yourself, wow Linux software RAID is really lame, I wish 
this was Solaris.  But that's another threat too heh heh heh.

Dan

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.
> 
> well according to some documentation i've read, it actually can be
> beneficial.
> 
> 1) although your writes are slower, your reads are faster and apparently
> there are less writes than reads (don't know if i buy that but that's what
> was written)
> 
> 2) if your system is mirrored and one drive fails, your system will stay
> up because your swap is mirrored.  otherwise your system goes down,
> somewhat nullifying the use of mirroring.  of course you can reboot and be
> up and running but unless someone is ready and waiting to reboot, your
> system is down until that someone gets alerted and reboots.  and that
> someone is going to be me :-)
> 
> if others can chime in on this i'm more than willing to hear their
> thoughts.  i worried about the performance hit when i decided to go that
> route but everything is a tradeoff.  availability versus performance in
> this case.  if it's really going to degrade performance i imagine i'd just
> can the mirroring on swap.
> 
> 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.
> 
> 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.
> 
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
> 
> 

-- 
No one expects the Spanish Inquisition.



More information about the LUG mailing list