View previous topic :: View next topic |
Author |
Message |
h4rm0ny n00b
Joined: 23 May 2009 Posts: 10
|
Posted: Sat May 23, 2009 11:34 am Post subject: Must I use swap? |
|
|
Hi,
I used to know so much about administering Linux. Two years using Ubuntu and I can barely compile my own libraries. So I reckon it's time I tried Gentoo and reminded myself what my machine is capable of. :D
I couldn't find reference to this in the install guide, but I'm still reading it so apologies if this is basic. I see no reason why I need a swap partition. I have 4GB of RAM and would sooner buy more than slow my system down with disk access (not that it would probably use the swap). I don't have a swap partition on my Kubuntu system and have never felt its loss.
I'll be installing Gentoo later today. Will it accept my not assigning a swap partition when I do so? If not, are there any basic ways to amend the install process to do so?
Thanks, and looking forward to seeing what Gentoo is like,
H. |
|
Back to top |
|
|
pdw_hu Apprentice
Joined: 02 Jun 2008 Posts: 200 Location: Budapest, Hungary
|
Posted: Sat May 23, 2009 11:46 am Post subject: |
|
|
I haven't used a swap partition for about 3 years now. Had 1G, 2G and now 4G RAM, and it was never ever needed. So basically, unless you want hibernation support, you don't need it.
Even if you want one, don't waste a partition on it, but create a file which can be used for swap just as well. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54028 Location: 56N 3W
|
Posted: Sat May 23, 2009 11:50 am Post subject: |
|
|
h4rm0ny,
Welcome to Gentoo.
You do not need swap. If you find you do, you can make a swap file later .... However, consider the following.
On Linux, the swap space is only ever used for anonymous memory. Thats areas of memory that have no permanent home on disk.
This means when you disable your swap partition you do not prevent the system swapping, you only deny it one of the things it could do.
The kernel will still free space used by code and data that can be reloaded from disk as needed - it has no need to write this code and data to disk before it releases the RAM it occupied. On that basis, a swap partition is a good thing as the kernel will oftem put rarely used anonymous memory there, like things only used at start up and shut down, which need not be in RAM anyway.
I would recommend you make a 512Mb swap. If you ever find you need more, as you say, you need more real RAM. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
h4rm0ny n00b
Joined: 23 May 2009 Posts: 10
|
Posted: Sat May 23, 2009 12:20 pm Post subject: |
|
|
Okay, thanks for both replies and so quickly.
Where I was coming from, was the view that swap is an anachronism in this day and age. But I am loathe to disregard advice from the great Mr. Secombe himself, without careful consideration. I just know that I would get annoyed if I saw swap space being used when there was RAM available for that purpose.
I'll consider my options. It's nice to know that the install will complete without a swap partition anyway, which was my original question.
Cheers,
H. |
|
Back to top |
|
|
kernelOfTruth Watchman
Joined: 20 Dec 2005 Posts: 6111 Location: Vienna, Austria; Germany; hello world :)
|
|
Back to top |
|
|
h4rm0ny n00b
Joined: 23 May 2009 Posts: 10
|
Posted: Sat May 23, 2009 2:19 pm Post subject: |
|
|
kernelOfTruth wrote: | pdw_hu wrote: | I haven't used a swap partition for about 3 years now. Had 1G, 2G and now 4G RAM, and it was never ever needed. So basically, unless you want hibernation support, you don't need it.
Even if you want one, don't waste a partition on it, but create a file which can be used for swap just as well. |
++
always have a swap file or partition just in case your system needs to swap otherwise it will go heavy OOM and killing apps |
/me makes first ever post on forums.
/me starts flamewar.
/me hides
|
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54028 Location: 56N 3W
|
Posted: Sat May 23, 2009 2:34 pm Post subject: |
|
|
h4rm0ny,
Gentoo is about choice, you won't start a flameware by discussing choices of swap. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
h4rm0ny n00b
Joined: 23 May 2009 Posts: 10
|
Posted: Sat May 23, 2009 6:09 pm Post subject: |
|
|
NeddySeagoon wrote: | h4rm0ny,
Gentoo is about choice, you won't start a flameware by discussing choices of swap. |
I was just making a joke, but I like the Gentoo philosophy. I'm just finishing backing everything up and going to install in a bit. If I don't post again, my computer is busted.
Thanks again,
H. |
|
Back to top |
|
|
d2_racing Bodhisattva
Joined: 25 Apr 2005 Posts: 13047 Location: Ste-Foy,Canada
|
Posted: Sat May 23, 2009 8:04 pm Post subject: |
|
|
I use a swap partition just in case. |
|
Back to top |
|
|
forkbomb Tux's lil' helper
Joined: 22 Apr 2009 Posts: 115
|
Posted: Sun May 24, 2009 8:09 am Post subject: |
|
|
Adding $.005:
I make swap partitions out of pure habit these days.
At the same time, I can't remember the last time I have seen a swap in use (other than times I did moronic things like trying to start up too many VMs at once ). I agree with the suggestion to skip a partition and make a swapfile later if you need. |
|
Back to top |
|
|
d2_racing Bodhisattva
Joined: 25 Apr 2005 Posts: 13047 Location: Ste-Foy,Canada
|
Posted: Sun May 24, 2009 3:07 pm Post subject: |
|
|
forkbomb wrote: | At the same time, I can't remember the last time I have seen a swap in use (other than times I did moronic things like trying to start up too many VMs at once ). I agree with the suggestion to skip a partition and make a swapfile later if you need. |
In fact, but if you ever need one, what happen when the RAM is full ? |
|
Back to top |
|
|
forkbomb Tux's lil' helper
Joined: 22 Apr 2009 Posts: 115
|
Posted: Sun May 24, 2009 5:06 pm Post subject: |
|
|
d2_racing wrote: |
In fact, but if you ever need one, what happen when the RAM is full ? |
True enough, which is why I maintain the habit. |
|
Back to top |
|
|
madchaz l33t
Joined: 01 Jul 2003 Posts: 993 Location: Quebec, Canada
|
Posted: Sun May 24, 2009 6:19 pm Post subject: |
|
|
I've built and admininistered linux machines for a while and I have only really seen swap used under 3 conditions.
1: Ran out of ram because computer is being overloaded by a bad program. Swap is nice then because it can buy you time between the "why is the system so slow" and the "ok, everything froze". This was mostly awesome on huge production machines. (where 32G of swap can buy you 30 minutes)
2: As mentionned above, the kernel will use it as a kind of buffer. It can make some things like using rarely used programs go a litle faster (such as opening openoffice for the first time in a month).
3: when working with huge memory loads that can handle being slow. (mass data processing comes to mind)
Just for kicks, I went and had a look at my server.
Code: |
login as: madchaz
Using keyboard-interactive authentication.
Password:
Last login: Fri May 22 13:10:51 EDT 2009 from goku on pts/0
tomadchaz@boo ~ $ top
top - 14:16:31 up 180 days, 22:04, 1 user, load average: 0.17, 0.21, 0.18
Tasks: 75 total, 1 running, 74 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.3%us, 50.5%sy, 0.0%ni, 47.5%id, 0.0%wa, 0.0%hi, 0.7%si, 0.0%st
Mem: 515204k total, 509052k used, 6152k free, 86000k buffers
Swap: 506036k total, 50820k used, 455216k free, 321848k cached
|
Not a lot of swap used, but this machine only as 512M of ram. (you can look at what it does at www.madchaz.com )
I say keep some swap, it's always handy when you make a mistake or your new app is just dying to eat that 4G of ram _________________ Someone asked me once if I suffered from mental illness. I told him I enjoyed every second of it.
www.madchaz.com A small candle of a website. As my lab specs on it. |
|
Back to top |
|
|
forkbomb Tux's lil' helper
Joined: 22 Apr 2009 Posts: 115
|
Posted: Sun May 24, 2009 6:25 pm Post subject: |
|
|
Two more cents I might add:
Another reason I still make swaps even though I don't see my machines using them very often is that hard drive space is cheap these days. Rather than having the attitude "why make a swap," I've more taken on the attitude of "why not make a swap?" My main machine has 2GB of memory, and frankly I have enough hard drive space that I don't sniff at doing the old "2:1" rule (4GB swap in this case) even though that rule may or may not be an anachronism.
Of course, if one can find an extra hard drive to dedicate solely to being a swap, that's optimal. Head thrashing is no fun. |
|
Back to top |
|
|
d2_racing Bodhisattva
Joined: 25 Apr 2005 Posts: 13047 Location: Ste-Foy,Canada
|
Posted: Mon May 25, 2009 12:19 am Post subject: |
|
|
forkbomb wrote: | d2_racing wrote: |
In fact, but if you ever need one, what happen when the RAM is full ? |
True enough, which is why I maintain the habit. |
What happen actually ? A kernel panic or a general system failure ? |
|
Back to top |
|
|
Nerevar l33t
Joined: 31 May 2008 Posts: 720
|
Posted: Mon May 25, 2009 12:35 am Post subject: |
|
|
d2_racing wrote: | What happen actually ? A kernel panic or a general system failure ? |
As mentioned above, the kernel oom killer kicks in and starts killing off "random" processes (it does try to guess the right ones):
http://linux-mm.org/OOM_Killer |
|
Back to top |
|
|
d2_racing Bodhisattva
Joined: 25 Apr 2005 Posts: 13047 Location: Ste-Foy,Canada
|
Posted: Mon May 25, 2009 10:45 am Post subject: |
|
|
So, it will be a major crash |
|
Back to top |
|
|
i92guboj Bodhisattva
Joined: 30 Nov 2004 Posts: 10315 Location: Córdoba (Spain)
|
|
Back to top |
|
|
|