LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices



Reply
 
Search this Thread
Old 10-01-2009, 01:55 PM   #1
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,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
What size swap partition for hibernate?


Hello

For hibernate, the swap partition needs to be a little bigger than the memory but which memory? The aim is to be able to restore the computer to the state it was in before hibernation so "the memory" must include any paged out memory. If that is correct then the swap partition needs to be big enough to accommodate any paged out memory plus the RAM.

Assuming there is no paged out memory, the swap partition needs to be a little bigger than the RAM but how big is that? On my system, both "top" and /proc/meminfo show total memory 3368904 kB. The system has a nominal 4 GB RAM; why is the total memory so much less (~16%) than 4,000,000 kB? Even if a kB is taken as 1000 B rather than 1024 B, the discrepancy is only ~2%. Would a swap partition of 3,368,905 kB be enough? Or does it need to be a little over 4 GB to match the nominal RAM?

Best

Charles
 
Old 10-01-2009, 02:20 PM   #2
mobinskariya
Member
 
Registered: Sep 2007
Location: Kerala, India
Distribution: ubuntu 10.04
Posts: 367

Rep: Reputation: 55
i am too confused with the memory(very bad at basic mathematics)..in my ubuntu system monitor it shows 3.4GB but when it comes to top and /proc/meminfo both show 3605100K..where did the 200MB go??when talking about about the swap size i gave only 2GB to swap..in sysyem monitor it shows 0% usage of swap all the time because in normal case my application only eats up 400MB of main memory(maximum of 600MB if i run 8-10 applications simultaneously and of course it burns my C2D processor)...now i think 1Gb swap was sufficient for me since i dont use memory demanding applications.
 
Old 10-01-2009, 02:21 PM   #3
cpuobsessed
Member
 
Registered: Jan 2006
Distribution: Fedora, Ubuntu, Slackware
Posts: 53

Rep: Reputation: 15
I have two gigs of RAM (2 Gb) and have a swap space that is 2 Gb and hibernates works. If still feel unsure you can create a hibernate partition by creating an empty partition equal to your physical RAM and then recompile your kernel and point it the empty partition to use for hibernate.
 
Old 10-01-2009, 02:21 PM   #4
btncix
Member
 
Registered: Aug 2009
Location: NC, USA
Distribution: Slackware x86
Posts: 141

Rep: Reputation: 26
If I remember correctly, the traditional rule of thumb I thought was 2x your memory size for your swap partition. I don't know if the rule applies these days with systems that come with a lot more memory.

Here's a question though. Would a system ever be go into hibernation by itself when its resources are being used close to full capacity? You could force it to go into hibernation, but I would think that we would normally want the system to stay awake and finish whatever it was doing e.g. finish compiling code, running a simulation, and backing up the system. Then once it's finished and goes to idle mode, with resources and memory freed, the system could/would hibernate.

Long story short, I think 4GB will be fine for your swap, assuming hard drive space really isn't a issue.

Someone with better knowledge of this correct my comments please.

Last edited by btncix; 10-01-2009 at 02:23 PM.
 
Old 10-01-2009, 02:27 PM   #5
ingerudo
LQ Newbie
 
Registered: Aug 2008
Location: Mexicali, BC, México
Distribution: Slackware
Posts: 2

Rep: Reputation: 0
Pagination is not a problem

Pagination should not be a problem for hibernation; usually you should not be paginating more than 1/4 from the total RAM you have:

I mean if you have 4GB of Ram you will be paginating as a maximum 1GB this is at least what I have noticed on my box so you can use this to calculate how big you should make the partition in order to support hibernation and pagination in one.
 
Old 10-01-2009, 05:32 PM   #6
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 3,919

Rep: Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779
Quote:
Originally Posted by catkin View Post
..a little bigger than the RAM but how big is that? On my system, both "top" and /proc/meminfo show total memory 3368904 kB. The system has a nominal 4 GB RAM; why is the total memory so much less (~16%) than 4,000,000 kB? Even if a kB is taken as 1000 B rather than 1024 B, the discrepancy is only ~2%...
As this is the easy part of the question, this is the part that I'll go for.

I'd bet that you have a 32 bit kernel and a non-PAE kernel, at that.

For 32 bit addressing, 4G is the maximum amount of memory that can be directly addressed. What with one thing and another -holes in the address space for things like video cards, and which cannot be used for main memory space, primarily- it is typical for something like 3.2 G to be available.

There are ways around this; the most obvious is to use a 64 bit system, but a more work-around-y kind of work-around is to use a PAE kernel. On a suitable system, this allows each of several applications to see an address space of 4G.

There have been a zillion threads on this recently (I do exaggerate a bit, but recently it is a subject that has got a bit of attention in the past few weeks; memory must have become cheaper, I guess), so if you want more do a search on this very site. Or somewhere else, if you prefer.

Last edited by salasi; 10-02-2009 at 04:18 AM. Reason: ...missing bit (literally)...
 
Old 10-05-2009, 02:18 PM   #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,563
Blog Entries: 29

Original Poster
Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
Quote:
Originally Posted by salasi View Post
There have been a zillion threads on this recently (I do exaggerate a bit, but recently it is a subject that has got a bit of attention in the past few weeks; memory must have become cheaper, I guess), so if you want more do a search on this very site. Or somewhere else, if you prefer.
I am admonished and duly grovel My only possible plea in mitigation is I was primarily thinking about how to determine the exact swap size required and stumbled across the "small memory" issue while collecting data for that. While 'fessing up I also confess to not reading all those missing memory threads, assuming they were about the kernel using spare memory for buffers and I have no particular expertise to contribute on that topic. Hair shirts and flagellation for days!
 
  


Reply

Tags
gb, hibernate, kb, memory, paging, ram, swap


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
Possible to share the swap partition between two installations if I hibernate? Stuart Morrow Linux - Desktop 10 12-02-2014 08:17 PM
F7: Hibernate using new swap partition Mleahy Linux - Software 2 07-26-2008 03:16 PM
quick question: Does hibernate requires swap partition? carboncopy Linux - Laptop and Netbook 5 09-18-2005 07:35 AM
Swap Partition Size Murdock1979 Slackware 11 07-27-2005 02:09 AM
swap partition size? Toker Linux - Newbie 16 10-12-2003 12:19 PM


All times are GMT -5. The time now is 03:00 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration