LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 12-04-2007, 04:42 AM   #1
Nitram
LQ Newbie
 
Registered: Jul 2007
Posts: 21

Rep: Reputation: 15
Size of the swap partition


ok, so... what size should my swap partition be?
I was talking to a friend and asked him if it should be 1.5 times my ram
he just told me 1.5* was a windows thing
That's fine with me
but then I came across a page saying it should be at least equal to my ram.... so which one is it?
 
Old 12-04-2007, 04:51 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
How long is a piece of string ??? ...
This comes up all the time - search here on LQ.

On desktop systems I use 2 Gig - disk is cheap, and on x86 that is the limit for a single extent (R/H has patched to increase this limit).
 
Old 12-04-2007, 04:54 AM   #3
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
You will get varied answers for this type of question because it can't be answered precisely. In the past it used to be 2x the ram on your machine, but these days this rule does not necessarily apply because some machines have a lot of ram and will barely touch the swap space. Look at how much ram you have on your system and what you use your system for and then come up with your own scheme for the swap.
 
Old 12-04-2007, 04:57 AM   #4
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
It depends on what you need. This thing has already been asked and answered here, so you could have searched..

swap is used when RAM isn't enough, or for things that don't need to be in RAM necessarily (but do need to be "available"). Often when you're not doing anything massive, you notice that your swap space is almost (or completely) unused. On the other hand, if and when your RAM gets full, swap is used to extend it. Windows doesn't use a swap partition like Linux operating systems usually do, but a swap file (also possible on Linux). Need of swap depends on what you do - what you need to store there, and why.

If you have a lot of RAM (depends on the tasks done again, but for a normal desktop 1G or less works) you can leave swap off, and the machine still works. Problems won't occur as long as you have RAM free, that is, as long as swap isn't needed. If you then do get your ram filled up, and there's no swap space to extend to, things may get pretty slow..and I think your system then starts (or it should) killing processes in order to keep the system responding.

So..on older machines (with less RAM, say 32-256) the thumb rule was to have at least as much swap as there was RAM, or if there was little RAM, then 1,5*RAM. That was because small RAM is easily filled with intensive tasks, when ran, and therefore swap was the answer. Now if you had 1G or 2G RAM, there was no sense in taking 2-4G of RAM if you only do usual desktop things, surf the web and so on. On the other hand, if you're dealing with something heavy like video or (big) photo things, it's handy having swap available when needed - but in that case you would also get much RAM too, because it works way faster than swap does.

With modern harddisk sizes considered (around 100-500G), using a gigabyte of disk space for swap means nothing. It's like a droplet in the ocean. So even if you didn't use your swap most of the time, it's better to have it there (even if unused most of the time) than not have it there when you need it - so I'd say take as much swap as you have RAM, but if you've got 1G or more RAM, then don't bother reserving that much - 512M-1G should be sufficient even if you occationally did something that consumes memory. If you feel you don't do memory-consuming things, 512 is ok.

The "thumb rule" of 1x or 1,5xRAM used to be a handy way of telling a new user not to panic when asked how much swap s/he wants, because it was usually sufficient amount, and the user didn't have to think about what swap really is, how much s/he needs it, or what is little and what is much. Nowadays RAM sizes are both so big (compared to what they used to be) and vary a lot that it's difficult to throw in a thumb rule that works both for those who have "little" RAM and those who have "a lot of" it (compare 512M vs. 4G - pick any thumb rule, and it causes trouble at either end).

So, shortly: if you aren't short of harddisk space, pick 1G for swap, or if you worry about losing precious space, try 512M. Though I'm fairly sure it really isn't up to that 512 megabytes, so 1G would be the choice - you're probably never going to use it (at least fully), but on the other hand hopefully you're never going to run out of it.
 
Old 12-04-2007, 04:59 AM   #5
Nitram
LQ Newbie
 
Registered: Jul 2007
Posts: 21

Original Poster
Rep: Reputation: 15
well I have 2 gigs of ram... and while I was running windows it was never used 100% barely even passed 60%
so I should be fine with about 500mb then right?
 
Old 12-04-2007, 05:05 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
In Linux it'll all get used - do a search before asking why ...
 
  


Reply



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
Swap Partition Size Murdock1979 Slackware 11 07-27-2005 01:09 AM
What size should I make my swap partition? bobotoes Linux - Newbie 7 09-30-2004 10:36 PM
swap partition size alaios Linux - General 4 09-27-2004 01:21 PM
Max swap partition size mindcry Linux - Software 7 11-17-2003 01:53 PM
swap partition size? Toker Linux - Newbie 16 10-12-2003 11:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:29 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration