Mekeor Melire (2022-12-10 01:00:24 +0000) wrote: > 2022-12-09 23:10 mekeor@posteo.de: > > > 2022-12-05 17:23 ivan@selidor.net: > > > > > in #59746 I skipped documenting `resume_offset` with more detail, even > > > if it's needed for resuming from a swap file. The reason is that > > > according to [swsusp doc][1], some specific tool may be needed to > > > compute the swap file offset. There is [swap-offset][2] from the > > > uswsusp suite, which is missing from Guix and no longer shipped with > > > Debian. > > > > What about the "filefrag" executable from the "e2fsprogs" package. > > According to this article, it can be used in place of the deprecated > > uswsusp suite: > > > > https://www.linuxuprising.com/2021/08/how-to-enable-hibernation-on-ubuntu.html > > I just tried this out. And it worked like a charm! I have hibernated and > resumed successfully - first time with Guix System. I'm so happy :) > > Would you like to add instructions for swap-files to your > patch-series #59746? > > What I did: First, determine offset: > > --8<---------------cut here---------------start------------->8--- > $ sudo filefrag -v /swapfile > Filesystem type is: ef53 > File size of /swapfile is 1717986918 (4194304 blocks of 4096 bytes) > ext: logical_offset: physical_offset: length: expected: flags: > 0: 0.. 0: 5308416.. 5308416: 1: > --8<---------------cut here---------------end--------------->8--- > > Then, use offset in operating-system declaration: > > --8<---------------cut here---------------start------------->8--- > (kernel-arguments > (cons* > "resume=/dev/mapper/cryptroot" > "resume_offset=5308416" > %default-kernel-arguments)) > --8<---------------cut here---------------end--------------->8--- > > Caveat: IIUC, this does not work with Btrfs. Good find! Besides the issue of `filefrag` being ExtFS-specific, another thing that worries me is [this check][1] that `swap-offset` does about the swap header being physically contiguous on disk, which would need to be made manually with `filefrag`. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-utils.git/tree/swap-offset.c#n114 I guess that swap header fragmentation won't happen in most cases, but I also see that the instructions in "(guix)Keyboard Layout, Networking, and Partitioning" to create a swap file use `dd` instead of something less prone to fragmentation like `fallocate` (which then may or may not work depending on the particular FS). So I'm not completely at ease with extending the instructions for swap files, but someone more versed in the topic may. `:)` Cheers, -- Ivan Vilata i Balaguer -- https://elvil.net/