[EdLUG] Linux hibernate

John Dow jmd at nelefa.org
Sun Sep 18 07:11:06 UTC 2022


Hi Roy,

The image may well be compressed, but then the contents of memory may be
too. This is all part of the “ymmv” thing. It’s something I’ve never really
looked at too closely.

Back when everyone used magnetic disks, a rule of thumb was “make the swap
twice the size of the physical memory”. In these days of cheap memory and
ssd/NVMe drives, I think many people run without swap in the hope that it
prevents “disk wear”.

Maybe this is one of those times Windows has it right by having a
“hibernate.sys” file of flexible size…

J

On Sat, 17 Sep 2022 at 18:48, Roy <roy at crossford.net> wrote:

> Isn't the hibernate image compressed these days?
>
> That means that it might fit with some swap in use. It might not too.
>
>

Regards,
>
> Roy Bamford
>
>
>
> On 17/09/2022 16:50, Geetam wrote:
>
> I only know the theory of hibernating, so please fill in a bit of
> hibernating knowledge that I do not have. (I am so old-fashioned that I
> shut down and boot up 😬 )
>
> When hibernating, the state of internal memory is stored on disk. Linux
> uses the swap partition on disk for this. So your swap partition needs to
> be large enough, i.e. at least as large as your internal memory - in your
> case 32Gb
>
> BUT WHAT HAPPENS when you have so much open on your desktop that your
> internal memory wasn't big enough and some of the less active processes
> have been swapped to swap space? (I am sure most of us avoid that, but that
> is what swap space is for, isn't it?)
>
> Say you have 40GB in use (32Gb in internal memory, 8Gb swapped to swap
> space). Is hibernating going to try to save 40GB into swap space? That
> won't fit into the 32Gb swap partition... Or is it only writing the 32Gb in
> internal memory to the swap partition clobbering the 8Gb that was there?
> Then the full state of your desktop cannot be restored.
>
> Is this maybe why Andrew is not able to hibernate?
>
> I am sure someone in the Linux world has thought about this, but I think
> we have forgotten because we try to have so much internal memory that swaps
> space is not used and the issue hardly ever arises these days. Still, I am
> curious 🤔
>
> Regards
> Geetam
>
> --
> I don't know
> ...
> I don't know what it is
> ...
> I don't know what it is that I don't know
>
> Isn't it beautiful
>
>
> On Fri, 16 Sept 2022 at 08:04, Colin Shorts <colin.shorts at gmail.com>
> wrote:
>
>> Hi Andrew, I'd be inclined to add a smidgen more swap to be on the safe
>> side.
>>
>> I take it `sudo pm-hibernate` doesn't work (correctly) either? Are the
>> kernel parameters getting set at boot (I think dmesg should say which
>> device will be used)? Is your swap partition on lvm, are you mounting it
>> using the uuid?
>>
>> I'm in the middle of redecorating my home office or I'd give it a bash
>> myself 😃
>>
>> Cheers,
>> Colin
>>
>> On Fri, 16 Sept 2022, 01:16 Andrew Smith, <asmith9983 at gmail.com> wrote:
>>
>>> Hi Colin
>>> I have 32Gb of swap, with *htop* reporting  none used in normal
>>> operation.
>>> Suspend works OK. Given the minimal energy consumed overnight on
>>> suspend, I may just continue using that until I can investigate further
>>> how  *suspend-then-hibernate* is meant to operate by reading the
>>> sourcecode of *systemctl. *
>>> Andrew
>>>
>>>
>>> On Wed, 14 Sept 2022 at 20:07, Colin Shorts <colin.shorts at gmail.com>
>>> wrote:
>>>
>>>> I'm no expert on hibernate (I use suspend myself), but iirc you'll need
>>>> at least as much free swap as system ram +used swap. 64GB doesn't sound
>>>> unreasonable as a starting point assuming you've got enough space and
>>>> considering how much Chrome can chew up.
>>>>
>>>> -Colin
>>>>
>>>> On Wed, 14 Sept 2022, 18:03 Andrew Smith, <asmith9983 at gmail.com> wrote:
>>>>
>>>>> Guys
>>>>> For quite a while, I've been putting my system into suspend mode,
>>>>> which was successful , apart from an odd occassion.  I now want to try
>>>>> saving more energy
>>>>> I've tried powering down, but would like it to restart in the same
>>>>> state rather than with a new login, as I had with suspend.
>>>>> I've tried "systemctl suspend-then-hibernate" from root CLI, but  I
>>>>> get essentially  a fresh boot.
>>>>>
>>>>> Any suggestions ?
>>>>> I'm running kernel 5.4.0-125-generic from Ubuntu, in 32Gb RAM, and
>>>>> typically have a around hundred tabs open on Chrome.
>>>>> Andrew
>>>>> --
>>>>> EdLUG mailing list
>>>>> EdLUG at mailman.lug.org.uk
>>>>> https://lists.edlug.org.uk/mailman/listinfo/edlug
>>>>>
>>>> --
>>>> EdLUG mailing list
>>>> EdLUG at mailman.lug.org.uk
>>>> https://lists.edlug.org.uk/mailman/listinfo/edlug
>>>>
>>> --
>>> EdLUG mailing list
>>> EdLUG at mailman.lug.org.uk
>>> https://lists.edlug.org.uk/mailman/listinfo/edlug
>>>
>> --
>> EdLUG mailing list
>> EdLUG at mailman.lug.org.uk
>> https://lists.edlug.org.uk/mailman/listinfo/edlug
>>
>
> --
> EdLUG mailing list
> EdLUG at mailman.lug.org.uk
> https://lists.edlug.org.uk/mailman/listinfo/edlug
>
-- 
John Dow  <jmd at nelefa.org>
http://www.nelefa.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.edlug.org.uk/pipermail/edlug/attachments/20220918/4b8c2517/attachment.htm>


More information about the EdLUG mailing list