[NTLUG:Discuss] RAID-1 server goes down after disk failure/SWAP -- musings..
Wayne Walker
wwalker at bybent.com
Wed Nov 22 15:48:23 CST 2006
1. Yes, if the swap is not RAID'd and you lose the drive with swap, the
system will likely crash.
a. RAID'ing swap will degrade performance, but hopefully you swap so
seldom that it doesn't matter.
b. Therefore, if your goal with RAID is a machine that never
crashes, RAID the swap.
c. If your RAID goal is only that you don't lose data, and you need
performance when swapping, don't RAID your swap.
d. I personally would go with b.
2. How much swap?
a. ENTIRELY dependent on what you will do with the machine.
1) if the machine should never swap, choose a small amount of
swap (none is never a good option), maybe 256 MB
2) if you run huge apps that may malloc tons of RAM but not use
it all, put enough swap to cover twice what you think might occur (if
you have 1 GB of RAM and think your processes might total 3 GB, then you
want 2 * 2 or 4 GB of swap (must be in two 2 GB chunks)
3) buy more RAM and refer to 1)
b. according to which kernel version and what flags, the maximum
size of the swap partition is 1 GB, 2 GB, or 8 GB (based on my memory).
2GB is the most common. BUT, you may have many swap partitions! So if
you need 8 GB of swap you just have 4 2GB swap partitions (or files).
3. Can I do swap to a file instead of a partition?
a. yes, with a performance penalty for the filesystem overhead (I've
heard about 10%, but can't find a valid reference.
b. How?
dd if=/dev/zero of=/bigswapfile bs=1048576 count=2048
mkswap /bigswapfile
free
swapon /bigswapfile
free
4. tmpfs - sorry, I know nothing about it
5. Is swap useful if all my processes will fit within RAM?
a. Of course not...WRONG, yes, it can be useful, because if unused
process RAM is swapped out to swap, that RAM can be used for disk
caching and drastically improve performance.
Wayne
On Tue, Nov 21, 2006 at 12:14:38PM -0600, Richard Geoffrion wrote:
> Before asking the group 'why', I did my obligatory google search and I
> think I came up with a rather common sense answer!
>
> The situation I have is that servers using software RAID-1 don't seem
> very stable when one of the hard drive fails. When a hard drive does
> crash, the server locks up. I think I have finally identified 'the
> smoking gun'[tm]. See, since the beginning of my using software raid-1
> in linux, I have created a separate swap partition on each drive. My
> thoughts were that there would be a speed increase along with space
> savings if I split my swap partitions across two physical
> drives/controllers. The problem with this setup (as described in the
> Software-Raid-HOWTO FAQ) is that if you swap to a drive then lose the
> drive---well.. you're goin down!
>
> Reference:
> http://www.faqs.org/docs/Linux-HOWTO/Software-RAID-HOWTO.html#ss2.5
>
> As I am currently rebuilding a few servers, I will need to do
> 'something' about my swap partitions. So... What is the current wisdom
> concerning setting up Software Raid-1? What are the prevailing
> recommendations concerning swap files? I've heard everything from
> SWAP=2 times the system's RAM to SWAP= 1/2 the system's RAM. It seems
> that swap will only use up to 2 gigabytes of a swap partition, so a 4gig
> swap partition on a 2gig of RAM server is....wasteful. In today's
> multi-gig RAM climate, I can't seem to agree with the ever climbing SWAP
> space configurations. Back in the days, 128Meg of swap on a 64Meg
> machine was plenty. Now that we have GIGs of RAM it would seem that the
> increase of all this RAM should obsolete the need for swap altogether?
>
> And what about using a FILE for swap space instead of a partition??
>
> And what about using TMPFS? What *IF* you used tmpfs for your /tmp
> partition. That would seem to reduces the amount of RAM available thus
> creating the need for more SWAP space?? Can one configure tmpfs to use
> swap space?? That would seem to be a cool way to have a totally
> temporary file system.
>
> What practical applications and/or pitfalls am I missing?
>
> --
> Richard
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
--
Wayne Walker
www.unwiredbuyer.com - when you just can't be by the computer
wwalker at bybent.com Do you use Linux?!
http://www.bybent.com Get Counted! http://counter.li.org/
Perl - http://www.perl.org/ Perl User Groups - http://www.pm.org/
Jabber: wwalker at jabber.gnumber.com AIM: lwwalkerbybent
IRC: wwalker on freenode.net
More information about the Discuss
mailing list