Mailing List Archive

Hibernation without initramfs
Hello!

Quick question: is it possible to use hibernation (suspend to disk)
with no initramfs? I don't have one and don't want to have one. So I'd
rather disable hibernate in kernel (so I won't do this by accident) or
leave it to use it happily when needed.

--
xWK
Re: Hibernation without initramfs [ In reply to ]
On Thursday, 25 April 2024 22:29:01 BST Wojciech Kuzyszyn wrote:
> Hello!
>
> Quick question: is it possible to use hibernation (suspend to disk)
> with no initramfs?

Yes.

> I don't have one and don't want to have one. So I'd
> rather disable hibernate in kernel (so I won't do this by accident) or
> leave it to use it happily when needed.

You have to specify a swap block device - a swap partition, or a preconfigured
swap file on an already mounted partition - in your kernel configuration, for
hibernation to work, e.g.:

[*] Hibernation (aka 'suspend to disk')
[*] Userspace snapshot device
(/dev/sdb6) Default resume partition

This swap device will be used at hibernation time to compress and store what
is running in your RAM. Since the contents of your RAM will be compressed
less space will be required than the size of your RAM.

However, if you are using RAM heavily when you try to hibernate, e.g. because
you are compiling some large package, have many memory hungry applications
open, etc., you may find hibernation fails due to lack of space. This would
be more acute if your RAM is not large enough and swap is used on a regular
basis. With large enough RAM less swap space will be used, since swap would
be virtually empty. Therefore size your swap device accordingly.
Re: Hibernation without initramfs [ In reply to ]
On Fri, 26 Apr 2024 09:40:54 +0100
Michael <confabulate@kintzios.com> wrote:

> [*] Hibernation (aka 'suspend to disk')
> [*] Userspace snapshot device
> (/dev/sdb6) Default resume partition

My swap partition is /dev/nvme0n1p2 - this would work I assume, right?

> However, if you are using RAM heavily when you try to hibernate, e.g.
> because you are compiling some large package, have many memory hungry
> applications open, etc., you may find hibernation fails due to lack
> of space. This would be more acute if your RAM is not large enough
> and swap is used on a regular basis. With large enough RAM less swap
> space will be used, since swap would be virtually empty. Therefore
> size your swap device accordingly.

I have oldschool swap - 2x RAM.


--
xWK
Re: Hibernation without initramfs [ In reply to ]
On Friday, 26 April 2024 10:23:28 BST Wojciech Kuzyszyn wrote:
> On Fri, 26 Apr 2024 09:40:54 +0100
>
> Michael <confabulate@kintzios.com> wrote:
> > [*] Hibernation (aka 'suspend to disk')
> > [*] Userspace snapshot device
> > (/dev/sdb6) Default resume partition
>
> My swap partition is /dev/nvme0n1p2 - this would work I assume, right?

Yes, it is a block device accessed via the PCIe bus.


> > However, if you are using RAM heavily when you try to hibernate, e.g.
> > because you are compiling some large package, have many memory hungry
> > applications open, etc., you may find hibernation fails due to lack
> > of space. This would be more acute if your RAM is not large enough
> > and swap is used on a regular basis. With large enough RAM less swap
> > space will be used, since swap would be virtually empty. Therefore
> > size your swap device accordingly.
>
> I have oldschool swap - 2x RAM.

OK, with this much space you'd have at least 2x more hibernation storage space
than you will need. :-)