Forums

Skip to content

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

Swap size for hibernation question

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
7 posts • Page 1 of 1
Author
Message
leonchik1976
Guru
Guru
Posts: 344
Joined: Sun Jan 24, 2010 1:28 pm

Swap size for hibernation question

  • Quote

Post by leonchik1976 » Wed Sep 13, 2017 3:17 am

I have 64gb RAM, does it mean, that i need 64gb swap for successful hibernation?
Top
LIsLinuxIsSogood
Veteran
Veteran
Posts: 1186
Joined: Sat Feb 13, 2016 11:41 pm

  • Quote

Post by LIsLinuxIsSogood » Wed Sep 13, 2017 3:50 am

That is not how swap space or memory work. The way that swap is used (if at all) is when memory is getting close to full to create some free memory space by moving over some of that. Since you have plenty of memory it really unnecessary to have all that swap space. Probably just follow what the suggestion of the wiki says, but I think it is something like 1 or 2GB should be plenty.

As far as hibernating and the use of swap for that, I was not aware of the problem with needing to have a minimum amount of swap space for that. But it does make sense. The thing you should consider is that when your system is running right before hibernating it probably is using a fraction of the total overall memory. And it should be possible to send that to any part of the disk in order to hibernate to disk. Are you trying to go with hibernate to disk?
Top
The Doctor
Bodhisattva
Bodhisattva
User avatar
Posts: 2678
Joined: Tue Jul 27, 2010 10:56 pm

  • Quote

Post by The Doctor » Wed Sep 13, 2017 3:51 am

Yes. The swap is used to store the state of the ram during hibernation.

A swap file may be more to your taste under the circumstance.
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Top
HungGarTiger
Apprentice
Apprentice
User avatar
Posts: 180
Joined: Tue Feb 04, 2014 1:48 am
Location: /nz/auckland

  • Quote

Post by HungGarTiger » Wed Sep 13, 2017 3:53 am

In theory yes, as hibernation is storing the contents of your RAM in your swap space for later reuse. Though in practise I doubt you would be using 64GBs of RAM unless you go to hibernate in the middle of playing WoW. In order for a successful hibernation I would assume that it is needed or you might run into errors from time to time.
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 » Wed Sep 13, 2017 5:18 am

How much swap space is needed for hibernation depends on your situation - First off, you need to add how much swap you would normally be using. Ideally with 64GB you won't swap so that should be 0.

There is also the transcendent memory swap. Coupled with this is zswap, more later.

Then how much RAM are you using. All cache will be saved though buffers will be flushed. There was a good reason why cache is saved but I don't remember what for, probably so that the machine upon resume will be on the ground running instead of a whole storm of cache misses.

This "real" hibernation image usage is actually compressed. I believe it uses a "normal" compress routine so you get fairly good compression ratio unless you were working on compressed data or had lots of transcendent memory zswap areas.

I would say for 64GB RAM and if you NEVER use swap for real swap (I've seen 512GB machines swap before, so don't say I didn't warn you...) then for hibernation you probably can get away with 32GB. 48GB would be "safe", but if you have the disk space, 64GB would be optimal in case you swap and can still hibernate.
Intel Core i7 2700K/Radeon Firepro W2100/24GB DDR3/800GB SSD
What am I supposed watching?
Top
Fitzcarraldo
Advocate
Advocate
User avatar
Posts: 2057
Joined: Sat Aug 30, 2008 9:49 pm
Location: United Kingdom
Contact:
Contact Fitzcarraldo
Website

  • Quote

Post by Fitzcarraldo » Wed Sep 13, 2017 5:39 pm

Back in 2010 I performed a small experiment to see how much swap space would be required for hibernation when using TuxOnIce. I found that, with in-kernel LZO compression enabled, the amount of swap space used for hibernation was 23 per cent of my then laptop's 4GB RAM.

The TuxOnIce developer stated in 2009 that:
Nigel Cunningham wrote: > * How the installer of a Linux distribution should decide on the size of
> the hibernation file/partition? Worst case seems to be the installed
> memory size + swap partition but given that LZO compresses the image
> well enough is it possible to assume a size for the image file based on
> some proportions or something else?

LZO compression almost always achieves greater than 50% compression, so
you should be able to fit all images in swapspace equal to half the
amount of memory you have. Of course you might want to add a margin for
normal swapping and variations in the compression that's achieved.
I have not used TuxOnIce for several years, but I wonder if enabling compression in one's kernel configuration (without using TuxOnIce) would result in a significant reduction in the memory image when hibernating, and thus a significant reduction in the required size of the swap partition. I would imagine it would if using LZO compression. It would be worth trying various swap partition sizes to see, if you can be bothered.
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC systemd-utils[udev] elogind KDE on both.

My blog
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 » Wed Sep 13, 2017 5:58 pm

Probably worst case is you have some mp3s or movies in your tmpfs ... Then likely you'll need a full swap=physical memory size.

However if you don't keep these things in buffer, cache, or tmpfs/ramfs, then you'll likely be fine with smaller hibernation areas.

I'm glad they thought of compressing the hibernation image, I was quite upset the first time I tried using hibernation, took forever, the first thing I thought was that they should compress as it would both speed up hibernation time as well as reduce SSD wear.
Intel Core i7 2700K/Radeon Firepro W2100/24GB DDR3/800GB SSD
What am I supposed watching?
Top
Post Reply

7 posts • Page 1 of 1

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