Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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?
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.
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.
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.
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.
..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)...
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!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.