Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Installing Gentoo
  • Search

4G of ram: swap or no-swap partition ?

Having problems with the Gentoo Handbook? If you're still working your way through it, or just need some info before you start your install, this is the place. All other questions go elsewhere.
Post Reply
Advanced search
30 posts
  • 1
  • 2
  • Next
Author
Message
bilbotux
n00b
n00b
Posts: 28
Joined: Sun Nov 04, 2007 11:55 am
Location: NewYork, USA

4G of ram: swap or no-swap partition ?

  • Quote

Post by bilbotux » Thu Nov 08, 2007 9:33 pm

Hi,

I'm getting a new laptop with 4G of ram and I'm wondering if I really need to create a swap partition.
On this computer, I will do many memory consuming things, like wine, vmware, firefox ( :) ), ... the same things I'm doing on my current computer which has only 512M of ram and a 1G swap partition (often partially used).
I will also try to use the tuxonice sources (on a reiserfs / partition), is it ok, or is a swap partition needed for that ?

So do I need a swap partition at all? I'm thinking of no, but I prefer ask before.

Thanks,
Top
AaronPPC
Guru
Guru
Posts: 522
Joined: Sun May 29, 2005 8:22 am
Location: Tucson, AZ

  • Quote

Post by AaronPPC » Thu Nov 08, 2007 10:11 pm

You'll have plenty of RAM and won't need a swap. However, if you want to use Suspend to Disk (now called Tux On Ice) you will need swap space.
--Aaron
Top
bilbotux
n00b
n00b
Posts: 28
Joined: Sun Nov 04, 2007 11:55 am
Location: NewYork, USA

  • Quote

Post by bilbotux » Thu Nov 08, 2007 10:27 pm

AaronPPC wrote:You'll have plenty of RAM and won't need a swap. However, if you want to use Suspend to Disk (now called Tux On Ice) you will need swap space.
Well, according to http://www.tuxonice.net/HOWTO-2.html#ss2.2, it seems that it can either suspend to a file or to swap partition.
Therefore, I think it's not required to have a swap partition, is it ?
Also, my partitions will be reiserfs, and I'm wondering if it will be able to read/write a reiserfs partition, because http://www.tuxonice.net/FAQ-4.html#ss4.1 said that tuxonice works on many filesystems, but only quote the ext3.

Btw, thanks for the answer.
Top
96140
Retired Dev
Retired Dev
Posts: 1324
Joined: Sun Jan 23, 2005 9:18 pm

  • Quote

Post by 96140 » Thu Nov 08, 2007 10:32 pm

--
Last edited by 96140 on Fri Sep 13, 2013 8:55 am, edited 1 time in total.
Top
NathanZachary
Bodhisattva
Bodhisattva
User avatar
Posts: 2627
Joined: Tue Jan 30, 2007 1:50 am

  • Quote

Post by NathanZachary » Fri Nov 09, 2007 9:38 pm

I have a large amount of physical memory as well (2GB), and I still setup a swap partition. Though I only establish a 512M swap, I still have one just in case. As nightmorph mentioned, compiling things like OpenOffice (not the binary) take a HUGE amount of memory. Better safe than sorry, I say.
“Truth, like infinity, is to be forever approached but never reached.” --Jean Ayres (1972)
---avatar cropped from =AimanStudio---
Top
eccerr0r
Watchman
Watchman
Posts: 10239
Joined: Thu Jul 01, 2004 6:51 pm
Location: almost Mile High in the USA
Contact:
Contact eccerr0r
Website

  • Quote

Post by eccerr0r » Fri Nov 09, 2007 11:09 pm

I've recently ended up with two machines with 4GB RAM and I still put swap on it. It's not for actually using as swap, but rather as emergency buffer space in case some huge process starts gobbling up too much memory. This way I will have a little bit of time to try to resolve the issue (machine will be slowed down) before it starts killing processes that I'd rather not.

8GB swap is insane
4GB swap is still insane
I just opted for a minimal 512MB.

Core2Duo E6700 4GB
Dual Itanium2 1.3GHz 4GB

I've never actually hit swap on 4G. Even on 1G I have to struggle to hit swap... :o
Intel Core i7 2700K/Radeon Firepro W2100/24GB DDR3/800GB SSD
What am I supposed watching?
Top
ianw1974
Guru
Guru
User avatar
Posts: 387
Joined: Wed Oct 18, 2006 12:25 pm
Location: UK and Poland
Contact:
Contact ianw1974
Website

  • Quote

Post by ianw1974 » Sat Nov 10, 2007 11:43 am

I have 4GB ram in my laptop, but I also run VMware, so I do have 2GB of swap allocated just in case. I definitely didn't want to give 8GB or even 4GB since I'm pretty sure it wouldn't get used. I was going to put 1GB, but then I opted for 2GB instead. At least if I have a huge vm machine using a lot of ram, I still have swap space available to use if things get over-worked.

It all really depends on what you're going to be doing with your machine at the end of the day. If no swap, when you run out of ram, you'll no doubt have problems.
Top
cyrillic
Watchman
Watchman
User avatar
Posts: 7311
Joined: Wed Feb 19, 2003 3:05 am
Location: Groton, Massachusetts USA

  • Quote

Post by cyrillic » Sat Nov 10, 2007 1:01 pm

... And now for the opposing view :wink:
I don't have swap configured on any of my machines.

Most of my desktop machines have 1GB or more RAM, so running out has never been an issue for me.

My 2 laptops are happy with 256MB RAM and no swap. (updates get compiled on my desktop machines)

And up until recently my router was a pentium3 machine with 64MB of RAM and no swap. It consumed about 10-12MB of RAM during normal operation.
Top
petteyg359
n00b
n00b
Posts: 61
Joined: Sat Apr 30, 2005 7:42 pm

  • Quote

Post by petteyg359 » Sat Nov 17, 2007 9:16 pm

Then the freak view: I have 4GB of RAM and assigned 12GB of swap :) I have a 12GB tmpfs /var/tmp/portage which noticeably speeds up compiling for me and can emerge openoffice, mozilla-firefox, lots of kde stuff, etc. without running out of space :)
Top
Nitro_146
Apprentice
Apprentice
User avatar
Posts: 221
Joined: Wed Mar 02, 2005 8:34 pm
Location: Digne les bains, France
Contact:
Contact Nitro_146
Website

  • Quote

Post by Nitro_146 » Sat Nov 17, 2007 10:14 pm

Here I have 2 Gb of RAM and 4 Gb of swap.

I happened to use swap (as high as 3 Gb) when working on a scribus document.
It was a 100 pages photobook with on average 6 6Mpixels pictures per page.

Anyway, disk space nowadays is cheap. Why dont you create a 4 Gb partition that you can use for /tmp for exemple and quickly convert to swap if it is needed.
Linux, cause booting is for adding new hardware
Top
mrpringle
Apprentice
Apprentice
Posts: 284
Joined: Sun May 27, 2007 5:51 am

The good old "how much swap" question

  • Quote

Post by mrpringle » Tue Dec 04, 2007 10:52 pm

Hey,
I'm stepping up from 32-bit to 64-bit gentoo because I now have 4GB of ram and I'm wondering how much swap space I should allocate.

Some people say twice your system memory but I can see this as a massive waste in my situation. I am going to have vista and gentoo dual booted and the the extra ram is only really for games in windows. I very highly doubt I will ever use up the entire 4GB under linux. Hard disk space isn't really an issue, but I don't want to allocate swap just for the sake of it.

How much swap space would you recommend?

I'm thinking 1-2GB but I don't want to underestimate the swap requirements either.


Thanks
Top
Keruskerfuerst
Advocate
Advocate
User avatar
Posts: 2289
Joined: Wed Feb 01, 2006 3:37 pm
Location: near Augsburg, Germany

  • Quote

Post by Keruskerfuerst » Tue Dec 04, 2007 10:56 pm

In this case, the absolute maximum of swap space should be 4GB.
Top
ajiaojr
n00b
n00b
User avatar
Posts: 26
Joined: Sat Dec 18, 2004 10:19 pm
Location: London

  • Quote

Post by ajiaojr » Tue Dec 04, 2007 11:12 pm

Twice of your ram, 2GB, whichever smaller
Website security is like the female orgasm. Some claim its a myth, many try hard to make it happen but have no idea how, and most movies of it are fake.
Top
Akkara
Bodhisattva
Bodhisattva
User avatar
Posts: 6702
Joined: Tue Mar 28, 2006 12:27 pm
Location: &akkara

  • Quote

Post by Akkara » Tue Dec 04, 2007 11:29 pm

If you want to suspend-to-disk you'll need an amount of swap equal to your ram (or greater).

If not interested in suspend then it doesn't much matter. 1GB should be enough. Some people even go without swap at all, although I don't recommend that because if you do get a runaway process it could take stuff down before you can kill it.
I very highly doubt I will ever use up the entire 4GB under linux.
You're not trying hard enough ;)

Seriously though, look into setting up /var/tmp/portage in ram for a nice speed boost with that much ram. Emerging wxGTK (if you use it) ends up needing about 3GB.

Also just having that much around for filecache, even if no one program comes anywhere close to needing it all, helps makes things zippy.
Top
mrpringle
Apprentice
Apprentice
Posts: 284
Joined: Sun May 27, 2007 5:51 am

  • Quote

Post by mrpringle » Tue Dec 04, 2007 11:34 pm

Akkara wrote:If you want to suspend-to-disk you'll need an amount of swap equal to your ram (or greater).
suspend to disk? Can't DDR2 suspend to RAM?
Akkara wrote:Seriously though, look into setting up /var/tmp/portage in ram for a nice speed boost with that much ram. Emerging wxGTK (if you use it) ends up needing about 3GB.
I don't know how to do this, but would it cause a portion of my memory to be allocated for file storage and non-usable for other applications?
Top
Akkara
Bodhisattva
Bodhisattva
User avatar
Posts: 6702
Joined: Tue Mar 28, 2006 12:27 pm
Location: &akkara

  • Quote

Post by Akkara » Tue Dec 04, 2007 11:50 pm

suspend to disk? Can't DDR2 suspend to RAM?
Yes you can suspend to ram, and you don't need swap for that.
I don't know how to do this, but would it cause a portion of my memory to be allocated for file storage and non-usable for other applications?
It only allocates as much memory as needed to store whatever files are put there, and is freed when files are deleted. Portage normally cleans up after itself so the memory will be freed once compilation finishes.

As far as how to do this: There's a guide posted somewhere on the forums that I'm not finding right now. I'll try to look for it later when I have more time (or maybe someone else will post a link). In any case, don't worry about this particular optimization until you're comfortable around gentoo.
Last edited by Akkara on Tue Dec 04, 2007 11:54 pm, edited 2 times in total.
Top
mrpringle
Apprentice
Apprentice
Posts: 284
Joined: Sun May 27, 2007 5:51 am

  • Quote

Post by mrpringle » Tue Dec 04, 2007 11:53 pm

Akkara wrote:As far as how to do this: There's a guide posted somewhere on the forums that I'm not finding right now. I'll try to look for it later when I have more time (or maybe someone else will post a link). In any case, don't worry about this particular optimization until you're comfortable around gentoo.
Thanks. I have been using gentoo for about a year, but I'm doing a new installation with the amd64 version as opposed to the x86 version I was using previously.
Top
Tin
Guru
Guru
Posts: 305
Joined: Thu Dec 22, 2005 10:10 am
Location: Namur, Belgium
Contact:
Contact Tin
Website

  • Quote

Post by Tin » Wed Dec 05, 2007 12:24 pm

Hi,

Just for your information, I did a little test :

normal /tmp
emerge -f ktorrent (to be sure not to be dependent of download speed)
emerge ktorrent
=> 7m38s

/tmp mounted as tmpfs
emerge -f ktorrent (to be sure not to be dependent of download speed)
emerge ktorrent
=> 6m28s

(max /tmp space used is 50 Mo for this example)
Tin, the gentoobie
Top
Akkara
Bodhisattva
Bodhisattva
User avatar
Posts: 6702
Joined: Tue Mar 28, 2006 12:27 pm
Location: &akkara

  • Quote

Post by Akkara » Wed Dec 05, 2007 12:41 pm

/tmp mounted as tmpfs
Portage normally uses /var/tmp/portage for compilation, unless you changed the default, or symlinked it to /tmp. (The compiler itself **i think** might use /tmp unless -pipe was given as one of the CFLAGS.)
Top
Tin
Guru
Guru
Posts: 305
Joined: Thu Dec 22, 2005 10:10 am
Location: Namur, Belgium
Contact:
Contact Tin
Website

  • Quote

Post by Tin » Wed Dec 05, 2007 12:48 pm

Akkara wrote:
/tmp mounted as tmpfs
Portage normally uses /var/tmp/portage for compilation, unless you changed the default, or symlinked it to /tmp. (The compiler itself **i think** might use /tmp unless -pipe was given as one of the CFLAGS.)
Yop ! You are right :-)

I just forgot to mention that I do a link from /var/tmp to /tmp

Here are some more details for those who are not used to "hack" their system :

Code: Select all

tmpfs                  /tmp            tmpfs           size=1g         0 0
(adapt the size regarding your memory capacity)

Code: Select all

ls -ld /var/tmp
lrwxrwxrwx 1 root root 4 Nov 20 10:06 /var/tmp -> /tmp
Of course, with this configuration, it should be a good idea to emerge openoffice-bin because openoffice (not binaries) use a LOT of memory :-P
Tin, the gentoobie
Top
downer
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 120
Joined: Thu Sep 20, 2007 5:45 pm
Location: sweden

  • Quote

Post by downer » Wed Dec 05, 2007 1:17 pm

ianw1974 wrote:...
It all really depends on what you're going to be doing with your machine at the end of the day. If no swap, when you run out of ram, you'll no doubt have problems.
Just out of curiosity, what happens if/when linux runs out of ram and/or swap? random killings of processes? panic? what?


//D
HP dv6500 (dv6501eo) Laptop and Dell Latitude E6420 work puter;
both running Gentoo x86_64 quite successfully.
Top
Tin
Guru
Guru
Posts: 305
Joined: Thu Dec 22, 2005 10:10 am
Location: Namur, Belgium
Contact:
Contact Tin
Website

  • Quote

Post by Tin » Wed Dec 05, 2007 1:43 pm

downer wrote:
ianw1974 wrote:...
It all really depends on what you're going to be doing with your machine at the end of the day. If no swap, when you run out of ram, you'll no doubt have problems.
Just out of curiosity, what happens if/when linux runs out of ram and/or swap? random killings of processes? panic? what?


//D
I think that it is like the disk space :
As soon as a process want some ram/disk space and there is no available, this program would crash.
If the running processes don't need additional space, they will continue to run.
I was completely stuffed to see one day that I was running with all my filesystem full (yes, yes, I know, I should not have only one root mountpoint...) and my system was quite stable for such a situation !
I only had to delete one big log and all was going on running smoothly !
I love linux !
Tin, the gentoobie
Top
timeBandit
Bodhisattva
Bodhisattva
User avatar
Posts: 2719
Joined: Fri Dec 31, 2004 1:54 am
Location: here, there or in transit

  • Quote

Post by timeBandit » Wed Dec 05, 2007 3:25 pm

Tin wrote:
downer wrote:Just out of curiosity, what happens if/when linux runs out of ram and/or swap? random killings of processes? panic? what?
I think that it is like the disk space :
As soon as a process want some ram/disk space and there is no available, this program would crash.
If the running processes don't need additional space, they will continue to run.
No. First, whether a program crashes or continues to run when a memory allocation request fails depends mostly on the program design and coding. Some keep running with minor problems, some with major problems, some shut down cleanly and some crash hard. A process can run out of memory before the system runs out of memory (see man ulimit).

Second, as to what Linux does when the whole system runs out of memory, read about the mighty hammer of the OOM Killer.
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Top
downer
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 120
Joined: Thu Sep 20, 2007 5:45 pm
Location: sweden

  • Quote

Post by downer » Wed Dec 05, 2007 4:14 pm

timeBandit wrote:No. First, whether a program crashes or continues to run when a memory allocation request fails depends mostly on the program design and coding. Some keep running with minor problems, some with major problems, some shut down cleanly and some crash hard. A process can run out of memory before the system runs out of memory (see man ulimit).

Second, as to what Linux does when the whole system runs out of memory, read about the mighty hammer of the OOM Killer.
Just what I was looking for, thanks!


//D
HP dv6500 (dv6501eo) Laptop and Dell Latitude E6420 work puter;
both running Gentoo x86_64 quite successfully.
Top
Tin
Guru
Guru
Posts: 305
Joined: Thu Dec 22, 2005 10:10 am
Location: Namur, Belgium
Contact:
Contact Tin
Website

  • Quote

Post by Tin » Wed Dec 05, 2007 5:39 pm

downer wrote:
timeBandit wrote:No. First, whether a program crashes or continues to run when a memory allocation request fails depends mostly on the program design and coding. Some keep running with minor problems, some with major problems, some shut down cleanly and some crash hard. A process can run out of memory before the system runs out of memory (see man ulimit).

Second, as to what Linux does when the whole system runs out of memory, read about the mighty hammer of the OOM Killer.
Just what I was looking for, thanks!


//D
Indeed, this is pretty cool !
Another point for linux vs windows !
Score : linux : 79365, windows : -19826
Tin, the gentoobie
Top
Post Reply

30 posts
  • 1
  • 2
  • Next

Return to “Installing Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic