Does Linux have a variably-sized hibernation file like hiberfil.sys?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You may either decrease the value of /sys/power/image_size to make the suspend image as small as possible (for small swap partitions), or increase it to possibly speed up the hibernation process. For systems with a large amount of RAM, smaller values may drastically increase the speed of resuming a hibernating system. See systemd#systemd-tmpfiles - temporary files to make this change persistent.
Linux isn't Windows, and you should look up the differences between suspend and hibernate, what they are, and how they work.
Not sure what the actual issue/problem is; suspend is always going to be faster, and there are well known issues with both suspend and hibernate in Linux. My laptops boot cold to desktop in less than 30 seconds...not sure why that would be too long for you to wait.
The swap area, as you probably already know (regardless of whether it's a file or a partition), needs to be large enough to hold everything in RAM and likely more for the situations where you're already using more memory than you have physical RAM for your running processes. My rule of thumb comes from my days administering Oracle servers: 4 x physical RAM (disk space is cheap nowadays). With a large-enough swap partition, I've had no problems hibernating. I've only hibernated on my laptop, though. It ought to work on my desktop system but I've just never used it.
There is a kernel boot command line option, "resume=...", that points to a disk partition. I seriously doubt it could be used to specify a file in a filesystem. (Does the kernel know about what filesystem is built on a particular partition during bootstrap and know how to look for a file within it? I'm doubting it.) There are other boot command line parameters that are used for suspend/hibernation in "/usr/src/linux/Documentation/admin-guide/kernel-parameters.txt". A little research into their use might get you what you want.
There is a kernel boot command line option, "resume=...", that points to a disk partition. I seriously doubt it could be used to specify a file in a filesystem.
From /usr/src/linux/Documentation/power/swsusp-and-swap-files.rst
Quote:
In principle the location of a swap file's header may be determined with the
help of appropriate filesystem driver. Unfortunately, however, it requires the
filesystem holding the swap file to be mounted, and if this filesystem is
journaled, it cannot be mounted during resume from disk. For this reason to
identify a swap file swsusp uses the name of the partition that holds the file
and the offset from the beginning of the partition at which the swap file's
header is located. For convenience, this offset is expressed in <PAGE_SIZE>
units.
There are several ways that the Linux kernel can implement "suspend." One way is to use the swap area, which may or may not be a file. The kernel architecture is somewhat flexible here.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.