Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-27-2005, 08:29 AM   #1
Registered: Sep 2004
Distribution: Slackware 10.2
Posts: 276

Rep: Reputation: 30
lots of ram, do you need swapspace?

All the desktop systems I manage and play with never use the disk swap space i partitioned for it. My home computer has 1024mb ram...and again never uses its swap space. I use disk space and would like to have that 2 gigs i have under swap. How much swap do I really need, if any?
Old 06-27-2005, 08:41 AM   #2
Senior Member
Registered: Aug 2003
Location: New Delhi, India
Distribution: Fedora 7
Posts: 1,305

Rep: Reputation: 45
With all that RAM you don't need to apply the "Swap should be 2X" ram formula. I gues you could work with 256MB easily.
Old 06-27-2005, 08:41 AM   #3
Senior Member
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,544
Blog Entries: 4

Rep: Reputation: 57
I have plenty of RAM also but I still have 768MB for swap. You probably don't need it but it's nice to have. Should you run out of RAM for some reason, having swap for the kernel to page to saves it dumping other stuff which it will then need to read later and slow things down. I also have 520GB of disk space so having a little bit for swap doesn't hurt at all. You certainly don't need 2GB though if you have 1GB of RAM. If you're that desperate for the space, cut it down to 512MB or even 256MB, but if it were me I'd still keep it.

Last edited by cs-cam; 06-27-2005 at 08:42 AM.
Old 06-27-2005, 10:21 AM   #4
Senior Member
Registered: Mar 2003
Location: Following the white rabbit
Distribution: Slackware64 -current
Posts: 2,299

Rep: Reputation: 89
As the others have said, 2G is far more than you need. The 2X RAM is up to 1G RAM. A 1G or smaller swap will be more than enough. Something around 500M should be plenty.
Old 06-27-2005, 10:51 AM   #5
Registered: Sep 2004
Distribution: Slackware 10.2
Posts: 276

Original Poster
Rep: Reputation: 30
Thanks for the help. Say for example, I used up all ram space and didn't have any swap...what's the worst that can happen? Or, in other words, what would happen if your kernel needed to use swap but you didn't have it? Just disk swaps taking more time, but no real harm?
Old 06-27-2005, 04:04 PM   #6
Senior Member
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
swap is not really just extra RAM the way people think of it or like it was in 1980's
the kernel uses swap to hold application data that is not already on disk
stuff like libraries and the applications themselves are already on disk and can just get reread
but unique data that is generated on the fly goes in the swap que imediatly when it is created so it can be swap out in a hurry if needed. This includes stack and heap data for running proccesses and these pages are called anonymouse mappings because they don't corespond to things that can be read from disk. Is there still a swap que when there is no swap ? certainly the kernel will be confused because it is designed at it's core to use swap.
the kernel can just eject clean pages that are backed be disk no problem. The kernel generally does a pretty good job of flushing these pages when they get dirty so they stay clean and ejection can be real fast. annonymouse pages on the other hand can oly be clean and ejected when they have been flushes to swap cause no other disk file exists for them. Swap is their disk files by design.
If you don't have swap the kernel vm page allocation system is unballanced and cannot function properly.
the kernel will constantly be doing more work possibly thrashing pages or doing extra disk writes to figure out how to get clean memory.
in my opinion this will cause you machine to run slower as the kernel struggles to keep more pages clean even if swap is not ever used but i'm not sure.
and i think without swap if an app gets out of controll alocating memory your system might freeze rather than be able to recover
Old 06-27-2005, 04:27 PM   #7
Registered: Sep 2004
Distribution: Slackware 10.2
Posts: 276

Original Poster
Rep: Reputation: 30
cool. thanks for the thought-out post. I guess I will use 256-512mb of swap then.
Old 06-27-2005, 05:21 PM   #8
Registered: Feb 2005
Location: Sunnyvale, CA
Distribution: Ubuntu
Posts: 205

Rep: Reputation: 38
What about systems that use Linux in an "embedded" application where there is no real disc, just a flash drive to boot from/get things started and plenty of RAM to hold evrything once the embedded app is up and running?
Old 06-27-2005, 06:24 PM   #9
Registered: Feb 2004
Location: Southern Maine, United States
Distribution: Slackware Ubuntu Debian FreeBSD
Posts: 418

Rep: Reputation: 31
having swap is good. without it your system is likely to start killing processes or thrash indefinitely, meaning make the disk go insane and freeze.
Old 03-19-2006, 03:01 AM   #10
Registered: Aug 2004
Distribution: Debian sarge 2.6.8-2-k7
Posts: 60

Rep: Reputation: 15
Well, I have just that: a mini itx system with a card flash. I'm disabling my swap, I'll post back if I have problems. (1Gb RAM is surely enough?)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
RAM + swapspace Gins Linux - General 11 11-01-2005 06:04 AM
lots of Ram, 2100 DDR ECC sopiaz57 General 3 06-24-2005 05:37 PM
new kernel, lots of RAM use marlor Slackware 1 10-28-2004 04:17 PM
suse 9.1 can't create swapspace david.stuart Linux - Newbie 7 08-24-2004 10:00 PM
SwapSpace skate Linux - Newbie 5 09-26-2003 06:16 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:08 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration