LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-31-2011, 12:28 AM   #1
Saurav Ghosh
LQ Newbie
 
Registered: Oct 2011
Posts: 3

Rep: Reputation: Disabled
Why size of swap space is 2x of RAM??? Why not 1.5x of RAM or 2.5x of RAM???


Why size of swap space is 2x of RAM??? Why not 1.5x of RAM or 2.5x of RAM???
 
Old 10-31-2011, 12:47 AM   #2
konsolelover
Member
 
Registered: Jul 2011
Location: 127.0.0.1
Distribution: Arch, Ubuntu 11.04
Posts: 68

Rep: Reputation: 2
It's just a customary idea , not a rule.

Last edited by konsolelover; 10-31-2011 at 01:01 AM.
 
1 members found this post helpful.
Old 10-31-2011, 06:49 AM   #3
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,079

Rep: Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110
It was a fairly stupid "rule of thumb" back when ram as a lot more expensive. Actual swap space requirements always depend on what you're doing with the system and don't correlate significantly with the amount of ram you have.

Now that people routinely (but not uniformly) buy much more ram than they really need, that 2X rule has shifted from fairly useless to totally useless.

If you can't figure out how much swap you should have (don't worry, most people are no better at figuring that out) a better blind rule is configure 2GB of swap regardless of ram size. If you have 0.5GB of ram, 2GB of swap. If you have 8GB of ram 2GB of swap.
 
Old 10-31-2011, 12:28 PM   #4
Saurav Ghosh
LQ Newbie
 
Registered: Oct 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank u...
 
Old 10-31-2011, 12:39 PM   #5
elliott678
Member
 
Registered: Mar 2005
Location: North Carolina
Distribution: Arch
Posts: 977

Rep: Reputation: 72
Quote:
Originally Posted by johnsfine View Post
If you can't figure out how much swap you should have (don't worry, most people are no better at figuring that out) a better blind rule is configure 2GB of swap regardless of ram size. If you have 0.5GB of ram, 2GB of swap. If you have 8GB of ram 2GB of swap.
Unless you plan on hibernating, then the partition must be at least as much as your RAM.

Though, if you're careful, it is entirely possible to get away with no swap at all. I've never had a swap partition on my EeePC with 2gb of RAM. I even keep /tmp/, /var/log/ and my browser cache in tmpfs, which is in RAM.

Last edited by elliott678; 10-31-2011 at 12:41 PM.
 
1 members found this post helpful.
Old 11-01-2011, 03:29 AM   #6
singhjc
Member
 
Registered: Nov 2010
Location: Moradabad
Distribution: Redhat,Centos
Posts: 31

Rep: Reputation: 1
Hello ,


it is not a rule, it was just because mostly systems had less physical memory earlier so we had to made swap space just double of ram but now days system have sufficient physical memory around 1 GB or more then 1 GB mostly ,so there is no need to create 2 GB swap partition if you do create only 1 GB swap your system will work fairly without any issue.

for example my server has 8 GB RAM but swap space is only 2 GB and server is working fine since last 3 years.
 
Old 11-01-2011, 03:46 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,544
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
An alternative is to swap to a file (in a file system) as opposed to dedicated partition(s). AFAIK the file stays at the maximum swap used size so is a good way of measuring it, perhaps to decide what size dedicated partition to use. If the system is using swap then it will probably use more swap later (computing load has a tendency to grow) so best to configure more than the system actually uses to allow room for future growth.
 
Old 11-01-2011, 03:49 AM   #8
floppy_stuttgart
Member
 
Registered: Nov 2010
Location: Stuttgart, Germany
Distribution: Tiny Core Linux 4.5.6, knoppix 6.7, antixM8.11, partedmagic, slitaz 3.0,PuppyLinux,Ubuntu 10.04
Posts: 530
Blog Entries: 1

Rep: Reputation: 37
hello,
here are my thoughts.
depending of what you want to do, you dont need swap at all..
my desktop PC has 768 MB RAM. A LOT for the processor and tinycorelinux. And just for the principle of having it, 100 MB of swap (it was used 1 time when I had too much applications opened).
I run my tinycorelinux USB stick on different PCs direct in RAM (no swap, no HDD).
Using SWAP by these days is perhaps because
- you cannot increase the RAM (physical limitation in your HW),
- dont have more money for RAM,
- have the wrong linux (too big too fat)
.. forgot to buy RAM?
 
  


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
Difference in the RAM's size and the size of the image of RAM (taken via dd), Why? Usmanaj Linux - Newbie 2 08-01-2009 12:17 AM
Swap size for a server with 128 GB RAM shaikjaveed1 Linux - Server 9 03-17-2009 02:28 PM
SWAP space=2*RAM p_test Linux - Enterprise 3 04-27-2006 02:22 PM
Swap double size of the RAM zillah Fedora 3 12-24-2005 07:13 AM
Swap double size of the RAM zillah Solaris / OpenSolaris 3 11-22-2005 11:30 AM


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

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