LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 05-10-2009, 07:36 AM   #1
vonbiber
Member
 
Registered: Apr 2009
Distribution: slackware 14.1 64-bit, slackware 14.2 64-bit, SystemRescueCD
Posts: 533

Rep: Reputation: 129Reputation: 129
swap partition necessary?


When I first started with linux the rule of thumb
for creating a swap partition was to set it to about
twice the size of the RAM. It made sense when you had
less than 256MB of RAM.
My previous computer had 2GB and I choose 2GB for my swap
and the laptop I'm using now has 4GB and so is the swap
I set up
Whenever I type in:
# free
I notice that the swap is never used as I have still
plenty of RAM available
so I'm just wondering is it really necessary to have
a swap partition (or perhaps, just in case, allow just
1GB swap)?
 
Old 05-10-2009, 07:46 AM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

If you have the space then a small swap partition would be suggested. The small swap would allow paging if/when it should happen. With 4GB of RAM, you probably won't swap but if you happen to need it then a small swap would prevent problems.
 
Old 05-10-2009, 07:55 AM   #3
hitest
Guru
 
Registered: Mar 2004
Location: Canada
Distribution: Void, Debian, Slackware
Posts: 7,342

Rep: Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746
I agree with onebuck. You probably won't use it much, but, a small swap partition will prevent error messages.
 
Old 05-10-2009, 08:11 AM   #4
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
That rule of thumb is for the maximum swap partition value, not the recommended. You don't need a swap partition at all, in fact you can also use swap files if you don't bother creating a swap partition, but decide you need swap later on:
http://www.cyberciti.biz/faq/linux-a...ap-file-howto/
 
Old 05-10-2009, 08:23 AM   #5
hitest
Guru
 
Registered: Mar 2004
Location: Canada
Distribution: Void, Debian, Slackware
Posts: 7,342

Rep: Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746
Quote:
Originally Posted by H_TeXMeX_H View Post
That rule of thumb is for the maximum swap partition value, not the recommended. You don't need a swap partition at all, in fact you can also use swap files if you don't bother creating a swap partition, but decide you need swap later on:
http://www.cyberciti.biz/faq/linux-a...ap-file-howto/
It depends on the hardware. We helped a guy recently who did not set-up a swap partition and he encountered problems. In my opinion a small swap partition won't hurt the system.
 
Old 05-10-2009, 09:17 AM   #6
michael_hodgins
LQ Newbie
 
Registered: Jan 2009
Posts: 4

Rep: Reputation: 0
hibernate

Hi

I was under the impression, though I'm happy to be corrected if I'm wrong, that hibernation (or suspend to disk) uses the swap area too, so you'd need a swap partition at least as large as your RAM to use this feature.


Michael
 
Old 05-10-2009, 09:48 AM   #7
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
That has been my understanding as well, that swap is used for hibernation. Of course, if that is not something you need or your hardware is capable of...

Personally I would put a small swap partition on any machine, no matter what the physical RAM may be. Though you will probably never use it, it is better to have a little something there for an emergency situation than the alternative of actually running out of memory if a process gets out of control. With storage as cheap as it is anymore, 256 - 512 MB isn't going to be missed by anyone with halfway modern drives.

The "RAM x 2" rule is absolutely antiquated now, don't let anyone tell you different. As you said, that was in the early days when people might only have 32 or 64 MB of RAM, and there was a very real possibility (almost a certainty) that at some point you were going to blow through your physical RAM. With 2 GB+ of RAM on modern machines, it just isn't going to happen unless you are doing something insanely intense like CAD or 3D animation, in which case you need to buy more RAM because clearly your application demands it. Keep in mind that swap is basically just there to keep the machine from crashing when it runs out of RAM, system performance when running from swap is going to be terrible.

Last edited by MS3FGX; 05-10-2009 at 09:52 AM.
 
Old 05-10-2009, 12:37 PM   #8
joutlancpa
Member
 
Registered: Apr 2009
Location: Orlando, FL
Distribution: Scientific Linux 6 x64
Posts: 211
Blog Entries: 1

Rep: Reputation: 31
I have 4 gigs of ram in my laptop, and the only time I see it swap (with conky) is during very large file transfers, like videos....I would definitely put a swap file there....forget the twice the ram thing, that's ancient I have a 2 gig swap btw.

Last edited by joutlancpa; 05-10-2009 at 12:56 PM.
 
Old 05-10-2009, 12:53 PM   #9
BrZ
Member
 
Registered: Apr 2009
Distribution: Slackware
Posts: 543

Rep: Reputation: 121Reputation: 121
What about suspend to disk? To use this feature you should have at least the same amount of ram on the swap partition.
 
Old 05-10-2009, 12:55 PM   #10
joutlancpa
Member
 
Registered: Apr 2009
Location: Orlando, FL
Distribution: Scientific Linux 6 x64
Posts: 211
Blog Entries: 1

Rep: Reputation: 31
Quote:
Originally Posted by BrZ View Post
What about suspend to disk? To use this feature you should have at least the same amount of ram on the swap partition.
Good point...does linux put that on the swap? I didn't think (know?) that it did.
 
  


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 file vs. swap partition verndog Ubuntu 16 07-09-2012 08:49 PM
need bigger swap partition but missing a valid partition table compused Linux - Hardware 3 07-02-2008 08:46 AM
Hard Drive Partition Management - Mandriva Double Partition with Swap File partition moshebagelfresser Linux - Hardware 2 05-23-2008 10:46 AM
SWAP-Partition ? Player2 Linux - Newbie 3 10-02-2003 05:18 AM
Newbie Installing Debian3 on m68k w/250M Partition Needs help creating swap partition AppleMac Linux - Newbie 2 11-01-2002 08:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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