Hibernation image_size editing

Hi,

I am currently working on a 6 Gb Ram laptop with vm.swapiness=10 and with a 10Gb of swap partition. So I would like to change the maximum size of the swap partition to be used by hibernation/suspend-to-disk since there is no need of compressing the files loaded on Ram and my hibernation resuming is almost unusably slow.

Thus, I have tried to edit /sys/power/image_size which is currently preset to 2440716288 (I believe it corresponds to 2/5 of total Ram as default) and change the value to 4000000000.

However, after editing it and rebooting the value in /sys/power/image_size changes back to 2440716288.

How do I successfully change the image size to be used within swap partition for hibernation so that I can speed up hibernation processes?

Thanks in advance :slight_smile:

PS: My kernel already has the parameter resume=<my swap partition> and hibernation is working despite being too slow for resuming.

you could try adding hibernate=nocompress to your kernel parameters, see

https://www.kernel.org/doc/Documentation/power/swsusp.txt

You cannot “edit” /sys/power/image_size, or anything in /sys/ for that matter.
/sys/ is a runtime interface to some kernel internals, changes won’t get “saved”.

See sysfs - Wikipedia

So you’d need to actively set it during boot.
Maybe this would help: [Solved] How to change image_size to control image size hibernation? / System Administration / Arch Linux Forums

I tried it by adding hibernate=nocompress in Yast>Boot loader>Kernel Parameters>Optional Kernel Command Line Parameter. This text box becomes like that:
“resume=/dev/sda6 hibernate=nocompress splash=silent quiet showopts”

Rebooting and hibernating is working but there seems to be no change. Image-size file in /sys/power remains 2439507968.

Should I try creating a .conf file in /etc/tmpfiles.d, named for example hibernation-image-size.conf which contains the command line:

w /sys/power/image_size - - - - 4000000000

Yes, that may work, although I’m not sure of the correct syntax.

Please try it yourself, if it doesn’t work or causes problems you can just remove that file again… :wink:

Thank you very much :slight_smile:

What worked for me was:

 w /sys/power/image_size - - - - 6000000000

But in order to feel any difference in speed the “hibernate=nocompress” in kernel parameters was also necessary.

After a while testing it on my daily work (which is heavy with multiple tabs and windows) I found that some things keep running buggy or weirdly. For example, Firebox every other time crashes or freezes for a long while after resuming, and reporting script malfunctioning on window where I was logged in any google account.

So, the only way I found to make hibernation run smoothly every time was with vm.swappiness=100 !!

I guess swappiness for usual swap files during OS functioning may be influencing the resume process too. I’m not sure, but one could verify whether swappiness on resuming processes and swappiness on normal swap file obey the same parameters or not. If it does, I would suggest otherwise.