Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 11-17-2003, 05:30 AM   #1
LQ Newbie
Registered: Nov 2003
Posts: 27

Rep: Reputation: 15
A swap partition so be how big?

Two times your RAM? In my case:

swap = 2 * 512
swap = 1024

I currently have my swap set to 1024... Too much? Too less? Just right?
Old 11-17-2003, 06:02 AM   #2
a slacker
Registered: Aug 2003
Distribution: Arch
Posts: 44

Rep: Reputation: 15
Thats exactly correct. It should be 2x your physical RAM
Old 11-17-2003, 06:22 AM   #3
LQ Newbie
Registered: Nov 2003
Posts: 27

Original Poster
Rep: Reputation: 15
Whoops, I didn't notice the post a couple down asking nearly the same question! Sorry!
Old 11-17-2003, 06:55 AM   #4
Registered: Apr 2003
Location: Sweden
Distribution: Slackware
Posts: 242

Rep: Reputation: 30
The idea of the recommended swap size being about 2 - 2.5 times the RAM is not appropriate unless you're using a very old computer with not very much RAM. Also, that recommendation is very Windows-ish...unless you're doing, say, heavy video or audio editing, it's just a waste to set the swap that big in Linux. If you did...check the percentage of the swap file being used. You might be surprised. In my case (1024 MB RAM), I have yet to see swap utilization which exceeds 0.0%.
Old 11-17-2003, 07:26 AM   #5
Registered: Apr 2003
Location: Tampa, Florida
Distribution: Mint 17.2 ,OpenSuse, Kali and Pepermint OS 6
Posts: 276

Rep: Reputation: 30
I agree with nvn if you have 1024 ram you need very minimal swap ie: none or at the most 256. I have 1024 RAM and I have my Swap set at 128MB and I have never once touched my swap space.
Old 11-17-2003, 07:39 AM   #6
Registered: Jun 2003
Distribution: Slackware 9.1
Posts: 41

Rep: Reputation: 15
512MB RAM 256 MB swap here , using at most 5% of the swap space.

However, if you do programming using dynamic memory allocations and tend to forget freeing stuff (like I do ) you really wish you had much more swap space

In the other side, using memory profilers save the day
Old 11-17-2003, 05:01 PM   #7
Senior Member
Registered: Sep 2003
Location: Indiana
Distribution: Slackware-current
Posts: 1,257

Rep: Reputation: 48
I think one needs to be cautious in just saying you don't need swap anymore. At the time of Slack 8, Linus T himself was still saying you needed 2x Ram. The kernel underwent some changes that may have changed that need, where less was needed. In reading some of the notes on 2.6, there is discussion of what is in RAM during a crash being saved to swap. In that case swap would need to be at least as big as RAM.
Old 11-17-2003, 06:14 PM   #8
LQ Newbie
Registered: Nov 2003
Location: Maryland, US
Distribution: Slackware/Knoppix
Posts: 10

Rep: Reputation: 0
Noticed this discussion and im wondering, for my instal of slack 9.1 on my computer with 786MB of DDR how big i should actually make my swap, i was gonna make a partition for it but i dont know if i want to if it'll go to waste (i hate being wasteful with space and not planning properly) So if i were to just not make a partition would it make any sort of difference? i doubt i'd notice that much because i dont plan on using slack as a primary OS, Im still in highschool and of course my web design teacher cant make a page work in anything but IE.
Anyways if i just make one partition for slack and just keep the swap with the root and home and everything in a single partition would that be ok? or is that just a no no?
Old 11-17-2003, 09:01 PM   #9
Registered: Jan 2003
Location: USA
Distribution: Slackware
Posts: 498

Rep: Reputation: 30
Hmmm...I use 1024MB of RAM, and have no real need for swap. I have to agree with nvn here.
Now if you have 512 or less, a little swap partition wouldn't hurt...say 256-512MB???
My 2cents...
Old 11-17-2003, 09:28 PM   #10
Registered: Oct 2003
Location: California
Distribution: Ubuntu
Posts: 582

Rep: Reputation: 30
I only have 192 megs of ram, after trying bloated redhat and seting my swap at 400mb and still using very little swap, i installed slackware with only 100mb swap, and I'm keeping the WM light (fluxbox).

I have yet to see over 1% being used, anyways, I can always back up and resize my "/home" partition if I ever think i need more swap; for say, apache or something. but I guess thats the benefit of using many partitions on an install (although realistically I only have /, /home, and swap)
Old 11-17-2003, 10:57 PM   #11
Registered: Nov 2003
Posts: 111

Rep: Reputation: 15
Did a google search on the subject and came up with an old but very interesting page. It goes into the history of the 2x rule.

That RAM to swap ratio thing, was an old Berkley-ism.
The older Berkley-based kernels (like SunOS 4.x and
before) would actually load the application into
memory and swap. The 2X+10% rule was to ensure that
the kernel had enough room to work with.
and although it doesn't mention Linux, I think the following applies:

The total amount of virtual memory (physical memory
and swap) required for a machine is dependent upon
the cumulative memory requirements of all processes.
When you run out of virtual memory, new processes can
not be started and running processes that execute
'mallocs' will fail.

Obviously, it is necessary to size the machine with
sufficient virtual memory capacity to avoid this
condition; however, the ratio of physical memory to
swap space required for reasonable performance is
completely dependent upon the characteristics of the
applications. If the processes use large amounts of
memory that is 'active' (i.e. frequently updated or
referenced), then a high ratio of physical memory to
swap will be required to deliver consistent
performance. If, however, the applications use large
amounts of memory, most of which is inactive,
then reasonable performance can be achieved with a
smaller physical memory to swap ratio. 'Rule of
thumb' guidelines for memory/swap sizing are useless
because the system requirements are completely
application dependent.
A bit technical, but an interesting read none the less.

Personally I have a half GB of RAM and a swap partition of the same size even though the only times it has come close to being full was when I ran a program that probably had a memory leak, and when I wrote a perl script that deliberately tried to fill it.

I read an account of a gentoo user's attempt to install kde and how he succeeded when he used 400MB swap to supplement his 64 MB of RAM, so there are circumstances when big swap is useful, though I forget what his original swap was. If he was using the 2x rule then I guess it would have been 128MB. Perhaps he could have been successful with something less than 400MB but more than 128MB.

The real question is 'how much memory do you need, preferably allowing for a margin of safety?'. Ultimately that can only be answered by experience, since people have different usage patterns. There's no 'one size fits all' rule. That said, if you have a GB of RAM you probably don't need a 2GB swap.
Old 11-18-2003, 12:02 AM   #12
LQ Newbie
Registered: Nov 2003
Location: Maryland, US
Distribution: Slackware/Knoppix
Posts: 10

Rep: Reputation: 0
Well my question is, how does windows actually determine its swap size apart from nessicity? it's worked for me so far, before now i never had to worry so im not gonna. occasionally when im not on my awe inspiring computer i've gotten that message about windows increasing the paging file size, if thats the only time it makes changes then how does it figure the page size? does windows use x*2=10%?
Old 11-18-2003, 07:37 PM   #13
LQ Veteran
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 85
Personally, my experience has been that if you've got 256Mg or more of RAM, it's unlikely that you would be using swap to any significant degree. As others have stated, the "twice RAM" guideline is a legacy of the days when having (for example) 64Mg of RAM was considered a totally bitchin rig. Obviously it doesn't hurt to create a big swap space, but unless your usage actually warrants it, you probably are just wasting disk space.

My recommendation would be to allocate a max of 256Mg for swap, regardless of how much memory you have. -- J.W.
Old 11-19-2003, 10:38 AM   #14
LQ Newbie
Registered: Feb 2003
Location: Los Angeles, CA
Distribution: RH 8.0
Posts: 17

Rep: Reputation: 0
Limitation on RedHat 8.0 swap?

Hi all - I have a box with 4 GB of RAM. I understand there is a limitation to the size of a swap partition on RedHat 8.0 of 2 GB, but it appears as though I cannot add more swap partitions to create more than 4 GB of swap. I know this may seem insane per your discussion, but the apps that my co-worker ASIC engineers are running on this box actually have failed with 4 GB of ram and 2 gb of swap, claiming a lack of memory (this could be the tool version's fault, not the OS)

I added a 2 GB swap partition and that bumped up the total swap space to 4 GB, but when I add another 2 GB swap partition, it bumps down to 2 GB of total swap - why?

I might be missing something obvious, so I thought I would ask. Any info is greatly appreciated.

Old 11-19-2003, 10:56 AM   #15
Registered: Mar 2003
Location: Berlin
Distribution: Slackware current
Posts: 310

Rep: Reputation: 31
256MB Ram and 128MB swap here - never had a problem while using this laptop for coding (C and Websites) or usual office stuff and a little GIMP.

As for your problem, discostu. I couldn't really follow how much swap you know actually have but you do know that 4GB Ram is the upper limit for 32bit processors unless you enabled PAE in your kernel. Look in the kernel config in the "Processor features" under "High memory support" whether your kernel can handle up to 960MB, 4GB or 64GB of RAM.


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
Big partition problem... CountZero16 Linux - General 6 11-18-2004 03:15 PM
Can a swap or boot partition be too big? gadams33 Linux - Newbie 4 08-22-2004 05:48 PM
How big to make swap file? Mandrake92 Linux - Newbie 11 05-26-2004 03:19 PM
How big should a boot partition be? snatale1 Linux - Newbie 4 08-16-2003 02:00 PM
Newbie Installing Debian3 on m68k w/250M Partition Needs help creating swap partition AppleMac Linux - Newbie 2 11-01-2002 08:45 AM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:13 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