LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
Search this Thread
Old 02-23-2007, 01:51 PM   #1
Aleksandersen
Member
 
Registered: Feb 2007
Location: Lillehammer, Norway
Distribution: Ubuntu
Posts: 36

Rep: Reputation: 15
Need for SWAP with 1 GB RAM?


Hi,

I have read that there is no need for a SWAP partition on a computer with 1 GB RAM? Is this correct? What is the advantages/disadvantages with having such a partition? And how large should it be, if any?

Hardware: 1.83 GHz Intel Core 2 Duo (64-bits), 100 GB hard drive space, and 1 GB RAM.
 
Old 02-23-2007, 01:54 PM   #2
Electro
Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Yes and no. Yes, you could get by with out swap. You will not last long with out swap. You can make 256 MB of swap and if you need more look up fly swapping.
 
Old 02-23-2007, 01:58 PM   #3
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
SWAP is not (at least much) used as long as there is free RAM available; the moment RAM starts to get filled, SWAP is used. SWAP can be used, though, even if your RAM isn't full. But anyway if you ever do any tasks with your pc that consume memory resources, you probably want SWAP; it's a place on the harddisk where the kernel can -- without any actual defined filesystem -- store files temporarily, and that may (or may not, it depends) boost up the speed of your tasks.

With a 100GB harddrive you won't even notice having a SWAP partition as big as 1GB, and since it doesn't hurt you, I'd say it's good to have it there -- in case you find it useful one day. Another option would be to use a SWAP file instead of a partition, but I'd still pick up the partition way; 1G swap space should be big enough for you, and it's still only one percent of your whole HD space.
 
Old 02-23-2007, 02:15 PM   #4
bskrakes
Member
 
Registered: Sep 2006
Location: Canada, Alberta
Distribution: RHEL 4 and up, CentOS 5.x, Fedora Core 5 and up, Ubuntu 8 and up
Posts: 251

Rep: Reputation: 32
Lightbulb SWAP partition - is always a good thing to have

I would always have a SWAP partition, no questions asked! Like previous post, if you run out of ram then the system can use the SWAP file. If you are not hard up for space like having a 100GB HD then make a 1GB swap. The general rule has always been to double ram in the system. So if you have 1 GB I would make the system have a 2GB SWAP partition. Now this rule was probably meant more for the older systems and hardware but it would probably still be a very good idea to include in systems today!
 
Old 02-23-2007, 02:28 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
There *is* no fixed rule as to whether you will or will not
need swap (to begin with or at some stage later in your linux
life). I've seen machines w/ 256MB never swap, and I've seen
machines w/ 2GB using lots of swap space. The only thing that's
always valid is that once your swap fills twice the amount of
your RAM you should go and buy more RAM :}

My current notebook has 1GB RAM and I have a 1GB swap-partition
(of which it currently only uses 0 MB).
My server has 256MB RAM and 756MB swap (of which it currently
only uses 90MB).

If I were to edit a video on my notebook things would change
dramatically, and so they would if I ran a complex query against
my PostgreSQL database on the server.




Cheers,
Tink
 
Old 02-23-2007, 02:35 PM   #6
bskrakes
Member
 
Registered: Sep 2006
Location: Canada, Alberta
Distribution: RHEL 4 and up, CentOS 5.x, Fedora Core 5 and up, Ubuntu 8 and up
Posts: 251

Rep: Reputation: 32
Sure you should probably buy more ram, but what is the point if you have a 100GB HD and can spare 2GB? It is not like this guy is running a huge database, unless I read something wrong and he has a Database that would require like 8GB of ram and two dual core processors.... just makes sense to double the swap size, especially if you have the space.... I think anyone who has worked with a Linux system professionally doubles there SWAP size.

See this link for some more GOOD info: http://www.hccfl.edu/pollock/AUnix1/Partitioning.htm

See this link for more info: http://forums.vnunet.com/thread.jspa?messageID=735750

YOU SHOULD DOUBLE YOUR SWAP SIZE, especially if you have a large database. At work we have a server that has 8GB of ram and we did double the SWAP size, mind we also have 1500 GB of space to work with. We have a large Database that requires POWER and MEMORY.

Ciao,
B
 
Old 02-23-2007, 03:17 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Quote:
Originally Posted by bskrakes
Sure you should probably buy more ram, but what is the point if you have a 100GB HD and can spare 2GB? It is not like this guy is running a huge database, unless I read something wrong and he has a Database that would require like 8GB of ram and two dual core processors.... just makes sense to double the swap size, especially if you have the space.... I think anyone who has worked with a Linux system professionally doubles there SWAP size.
If that's a response to my post you either didn't
read it or didn't understand what I am saying.

I never suggested that he use any given size. I
said if his SWAP exceeds double his RAM he should
get more RAM. And I'll stick with that: if you
use more that double your RAM for SWAP the
performance deteriorates DRASTICALLY.

Quote:
YOU SHOULD DOUBLE YOUR SWAP SIZE, especially if you have a large database. At work we have a server that has 8GB of ram and we did double the SWAP size, mind we also have 1500 GB of space to work with. We have a large Database that requires POWER and MEMORY.
And I'll bet it hardly uses half of that. If it
did your DBAs would be jumping up and down because
of the POOR PERFROMANCE.


Cheers,
Tink
 
Old 02-23-2007, 03:25 PM   #8
bskrakes
Member
 
Registered: Sep 2006
Location: Canada, Alberta
Distribution: RHEL 4 and up, CentOS 5.x, Fedora Core 5 and up, Ubuntu 8 and up
Posts: 251

Rep: Reputation: 32
No, may bad, I did not interpret your post the right way... sorry TINK. I couldn't agree more, never do more than double you swap size and 9 times out of 10 you won't use it but there has to be a reason why all linux people suggest it.

As for our work DB your right, it doesn't use the SWAP space or hardly at all. It never usually uses more than a few hundred MB's. I find that the SWAP is good for large HOT/COLD DB backups, thats when the SWAP is used most.
 
Old 02-23-2007, 03:46 PM   #9
Electro
Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
After 14 hours of use and counting, only 168 KB of swap is being used while folding@home and other programs are running. When I play a game like UT2004, swap gets used up to 8 MB even with out folding@home running.

The kernel comes with default parameters so use sysctl to adjust them to suit your setup. I have vm.swappiness set to 30 on my computer with 1 GB of RAM.
 
Old 02-23-2007, 04:00 PM   #10
rshaw
Senior Member
 
Registered: Apr 2001
Location: Perry, Iowa
Distribution: Mepis , Debian
Posts: 2,694

Rep: Reputation: 45
"but there has to be a reason why all linux people suggest it."

folklore. it once made sense years ago when mainboards wouldn't support large amounts of ram. now it gets parroted by some as if it's "the law" .
 
Old 02-23-2007, 04:06 PM   #11
Emerson
Senior Member
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~
Posts: 3,177

Rep: Reputation: Disabled
RAM + swap = 512 MB is OK for a Gentoo desktop.
 
Old 02-23-2007, 04:44 PM   #12
AdaHacker
Member
 
Registered: Oct 2001
Location: Brockport, NY
Distribution: Kubuntu
Posts: 384

Rep: Reputation: 31
Is 1GB enough RAM to do without swap? Maybe, depending on what you do with your system. However, swap helps performance, among other things, so it's generally a good idea to have some, regardless of how much RAM you have.

If you don't want to commit an entire partition to swap, you can always use swap files. That would allow you to play with different sizes and see what works best for you.
 
Old 02-23-2007, 05:13 PM   #13
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,150

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
I've got 1Gb RAM on this laptop, and 2Gb swap. As far as I know, "swap" has never been used, but I saw no harm in allocating a couple Gb from my 80Gb drive. "Just in case."
 
Old 02-23-2007, 05:20 PM   #14
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,935
Blog Entries: 1

Rep: Reputation: 188Reputation: 188
Swap is always good. The rule of thumb is twice your RAM, but you don't HAVE to do this. With 1GB of RAM, I think 1GB or even 512MB swap is good. You don't HAVE to...but I suggest it.
 
Old 02-23-2007, 05:29 PM   #15
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,245

Rep: Reputation: 121Reputation: 121
I read a bit of that thread on swapping. It got old after awhile, and I think the bit that I read must have been out of date as compared to current kernels. I don't buy the full memory theory. Things have simply changed. http://gentoo-wiki.com/FAQ_Linux_Mem...2.6_kernels.29

If you simply MUST have a swap space, then spend another $100 on a 1GB stick, and put your swap space on a RAMdisk. If that doesn't make sense to you, then you understand why the need to have a swapspace on disk makes no sense to me.
 
  


Reply

Tags
gb, partitioning, ram, swap


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
Not using RAM and Swap much ? ruwach Linux - Hardware 2 06-11-2004 07:26 AM
RAM and Swap shiny_spoon Linux - General 5 01-13-2004 02:27 PM
No SWAP but all RAM!! hari_seldon99 Linux - General 3 01-13-2004 10:48 AM
why swap should be twice of RAM? whitefox Slackware 17 04-19-2003 02:51 PM
Swap and RAM ? mikeshn Linux - General 1 09-18-2002 09:33 PM


All times are GMT -5. The time now is 11:46 AM.

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