LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 07-25-2005, 02:21 PM   #1
Murdock1979
Member
 
Registered: Oct 2003
Distribution: Slackware Debian VectorLinux
Posts: 429
Blog Entries: 2

Rep: Reputation: 30
Swap Partition Size


Hello Fellow Linuxens!

I know this must be a popular question, but what is a good size for a swap partition.

Here are my computer specs:
PIII 600 MHz
hda1 20 Gigs
hda2 20 Gigs
256 MB RAM

I hardly use any of this space, so I can resource a lot to a swap partition.

They say one should give at least the amount of memory, so 512 MB is a minimum, but does the policy of "more the marrier" apply?

And just to add to the story, I am using UMDOS, so it's located on a FAT filesystem (kinda slows things down anyways) and are using a swapfile for the swap partition.

Any suggestions would be great!

Cheers,
Mords

Last edited by Murdock1979; 07-25-2005 at 02:56 PM.
 
Old 07-25-2005, 02:31 PM   #2
J_K9
Member
 
Registered: Nov 2004
Distribution: Slackware 11, Ubuntu 6.06 LTS
Posts: 700

Rep: Reputation: 30
You won't be needing TOO much, so I generally go by the rule of either having a swap partition either the same size as your RAM, or double. I usually go for double my RAM, so in your case your swap would be 512MB, but I tend to go slightly over the top!

J_K9
 
Old 07-26-2005, 01:44 AM   #3
xushi
Senior Member
 
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288

Rep: Reputation: 45
Quote:
They say one should give at least the amount of memory, so 512 MB is a minimum, but does the policy of "more the marrier" apply?
Not as long as you have more than ~400Mb of ram... I don't know the reasons for that rule, and i certainly don't know why its still being used nowadays.

RAM is cheap.. if you have more than 512 then you shouldn't worry about your swap. I had 1G of ram on my old laptop, with a swap of 128Mb, and it never used that swap space, to my knowledge...

As for this laptop, it has 512Mb, with swap of 256, and the only time it ever uses it is when i get memory leaks.. (i stress test alot)

Ofcourse it all depends on what you're doing on the system.. If its running X (ram hogger), apache, mysql, samba, etc... Then make sure you have 512 RAM and above (with a low swap of ... 256M max). The swap will be just for failsafe purposes.
 
Old 07-26-2005, 01:56 PM   #4
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
Yes, the old:

RAM x 2 = Swap

Rule is becoming quickly outdated with modern computers. With most machines shipping with 512 MB now, and the price of RAM so low, it is becoming less and less likely that a modern desktop machine will ever swap out.

Personally, the most I do anymore (assuming the machines has enough RAM) is swap=RAM. Even then, this is usually overkill, and I don't know of any time my current desktop machine has ever accessed the swap.

But, as habits tend to do, this one is dieing hard. Many people still stick to the RAMx2 rule simply out of habit.
 
Old 07-26-2005, 02:09 PM   #5
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 110Reputation: 110
I usually say Swap=RAM*2, Swap <=256MB
 
Old 07-26-2005, 02:14 PM   #6
xushi
Senior Member
 
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288

Rep: Reputation: 45
I usually say
Swap = 256 | RAM >=256
Swap = 256 | RAM <= 256

For the reason of swap not being that important anymore.. (to a normal user)
 
Old 07-26-2005, 02:17 PM   #7
brokenflea
Member
 
Registered: Nov 2003
Distribution: Slackware 11.0, FreeBSD
Posts: 284

Rep: Reputation: 30
what about notebook's when they hibernate, isn't swap used when you hibernate your notebook or am i completely off track here ?
 
Old 07-26-2005, 02:23 PM   #8
xushi
Senior Member
 
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288

Rep: Reputation: 45
Quote:
Originally posted by brokenflea
what about notebook's when they hibernate, isn't swap used when you hibernate your notebook or am i completely off track here ?
Hmm, the contents of RAM is copied onto your HD to hibernate, and is copied back into RAM when waking up.. But i don't think the destination is your swap.

Swap is usually used in systems with low RAM for paging information that isn't instantly needed by the system, to leave the RAM free for more critical data that is currently needed.
 
Old 07-26-2005, 02:29 PM   #9
Murdock1979
Member
 
Registered: Oct 2003
Distribution: Slackware Debian VectorLinux
Posts: 429
Blog Entries: 2

Original Poster
Rep: Reputation: 30
Hello!

Wel, just for a quick swap piece of info. I loaded linux with UMDOS and with only 512K swapfile, and it was snailslow. I figured I'd test it out gave it a 1 Gig swapfile. It speeded up by more than three times (thereabouts).

With all the mess it's doing with the VFAT filesystem, I'm sure there is a whole bunch of swapping going around.

Well, just letting you guys know,
Mords
 
Old 07-26-2005, 02:46 PM   #10
xushi
Senior Member
 
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288

Rep: Reputation: 45
Setting it to 512k is a bit of an underkill

Either set it to something low as 128/256, or just disable it.
 
Old 07-26-2005, 08:13 PM   #11
ibmercurial
Member
 
Registered: Sep 2004
Location: Rhode Island (not new york)
Distribution: Slackware 10.2
Posts: 51

Rep: Reputation: 15
From what I read swap can be =ram if ram is ddr and= or > 512Mb
I have ddr but still make swap partiton ram*2
 
Old 07-27-2005, 01:09 AM   #12
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Milwaukee, WI
Distribution: Mint
Posts: 6,642

Rep: Reputation: 69
Swap is only used when the load placed on RAM pushes it past capacity, and the system is forced to write memory pages out to disk. Back in the days where 32Mg or 64Mg of RAM was considered hot stuff, it was not difficult to overload RAM, but these days, where 512Mg is the standard for a new PC, the chances that you'd consume >100% of RAM are increasingly remote. In the old days, it was recommended that "Swap = 2xRAM', but these days, if you follow that rule pretty much the only thing you'd be doing would be to waste disk space by allocating a huge swap partition. Personally, I'd recommend setting up a 256 Mg swap space, regardless of how much RAM you have.

While we're on the topic, let's not overlook the fact that the more your system uses swap, the worse your overall performance will be. Why? Because accessing data that's already in RAM is measured in nanoseconds, while accessing data that's been written out to disk is measured in milliseconds -- that's several orders of magnitude slower. Not good - it's far better to keep your swap usage as close to zero as possible. Again, if you've got a 256Mg swap space, I'd say you'll be good no matter how much RAM you've got -- J.W.
 
  


Reply


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
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
change swap partition size? jamaso Linux - General 4 07-03-2002 09:46 AM


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