Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Must I use swap?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Duplicate Threads
View previous topic :: View next topic  
Author Message
h4rm0ny
n00b
n00b


Joined: 23 May 2009
Posts: 10

PostPosted: Sat May 23, 2009 11:34 am    Post subject: Must I use swap? Reply with quote

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
View user's profile Send private message
pdw_hu
Apprentice
Apprentice


Joined: 02 Jun 2008
Posts: 200
Location: Budapest, Hungary

PostPosted: Sat May 23, 2009 11:46 am    Post subject: Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 33101
Location: 56N 3W

PostPosted: Sat May 23, 2009 11:50 am    Post subject: Reply with quote

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
View user's profile Send private message
h4rm0ny
n00b
n00b


Joined: 23 May 2009
Posts: 10

PostPosted: Sat May 23, 2009 12:20 pm    Post subject: Reply with quote

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
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 5802
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Sat May 23, 2009 1:28 pm    Post subject: Reply with quote

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 ;)
_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.3.0-r3
2.6.37.2_plus_v1: BFS, CFS,THP,compaction, zcache or TOI
Hardcore Linux user since 2004 :D
Back to top
View user's profile Send private message
h4rm0ny
n00b
n00b


Joined: 23 May 2009
Posts: 10

PostPosted: Sat May 23, 2009 2:19 pm    Post subject: Reply with quote

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

:D
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 33101
Location: 56N 3W

PostPosted: Sat May 23, 2009 2:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
h4rm0ny
n00b
n00b


Joined: 23 May 2009
Posts: 10

PostPosted: Sat May 23, 2009 6:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
d2_racing
Moderator
Moderator


Joined: 25 Apr 2005
Posts: 13046
Location: Ste-Foy,Canada

PostPosted: Sat May 23, 2009 8:04 pm    Post subject: Reply with quote

I use a swap partition just in case.
_________________
Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec
Back to top
View user's profile Send private message
forkbomb
Tux's lil' helper
Tux's lil' helper


Joined: 22 Apr 2009
Posts: 115

PostPosted: Sun May 24, 2009 8:09 am    Post subject: Reply with quote

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 :roll: ). I agree with the suggestion to skip a partition and make a swapfile later if you need.
Back to top
View user's profile Send private message
d2_racing
Moderator
Moderator


Joined: 25 Apr 2005
Posts: 13046
Location: Ste-Foy,Canada

PostPosted: Sun May 24, 2009 3:07 pm    Post subject: Reply with quote

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 :roll: ). 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 ?
_________________
Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec
Back to top
View user's profile Send private message
forkbomb
Tux's lil' helper
Tux's lil' helper


Joined: 22 Apr 2009
Posts: 115

PostPosted: Sun May 24, 2009 5:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
madchaz
l33t
l33t


Joined: 01 Jul 2003
Posts: 989
Location: Quebec, Canada

PostPosted: Sun May 24, 2009 6:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
forkbomb
Tux's lil' helper
Tux's lil' helper


Joined: 22 Apr 2009
Posts: 115

PostPosted: Sun May 24, 2009 6:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
d2_racing
Moderator
Moderator


Joined: 25 Apr 2005
Posts: 13046
Location: Ste-Foy,Canada

PostPosted: Mon May 25, 2009 12:19 am    Post subject: Reply with quote

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 ?
_________________
Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec
Back to top
View user's profile Send private message
Nerevar
l33t
l33t


Joined: 31 May 2008
Posts: 712

PostPosted: Mon May 25, 2009 12:35 am    Post subject: Reply with quote

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
View user's profile Send private message
d2_racing
Moderator
Moderator


Joined: 25 Apr 2005
Posts: 13046
Location: Ste-Foy,Canada

PostPosted: Mon May 25, 2009 10:45 am    Post subject: Reply with quote

So, it will be a major crash :P
_________________
Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec
Back to top
View user's profile Send private message
i92guboj
Moderator
Moderator


Joined: 30 Nov 2004
Posts: 10207
Location: Córdoba (Spain)

PostPosted: Mon May 25, 2009 11:02 am    Post subject: Reply with quote

That has been disused a number of times, for example here:

https://forums.gentoo.org/viewtopic-t-758144-highlight-swap+needed.html

Also look this:

http://www.linuxforums.org/forum/linux-newbie/144664-increase-swap-space.html#post686033

Moving this to duplicates (anyway, it's not about installing Gentoo either, nor even about Gentoo).
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Duplicate Threads All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum