Ivan Vilata i Balaguer (2022-12-12 21:11:53 +0100) wrote: > Mekeor Melire (2022-12-10 01:00:24 +0000) wrote: > > > > 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 > > 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 had a quick look to the [source code of mkswap][1] and it does take care of checking whether the swap file has holes in it (look for the word "hole"). If it has, it prints a warning (but it continues). For instance: ``` $ dd if=/dev/zero of=swap bs=512 count=1 seek=1000 1+0 records in 1+0 records out 512 bytes copied, 0.000234313 s, 2.2 MB/s $ mkswap swap mkswap: swap contains holes or other unsupported extents. This swap file can be rejected by kernel on swap activation! Use --verbose for more details. Setting up swapspace version 1, size = 496 KiB (507904 bytes) no label, UUID=3c5920cb-04ee-4713-8008-c2c1bebc2f6f ``` [1]: https://github.com/util-linux/util-linux/blob/master/disk-utils/mkswap.c Since it's unlikely that the file will change its block arrangement on disk, and enlarging it requires another invocation of `mkswap`, it's probably enough to tell the user to check for such warnings on `mkswap` invocation (in section "(guix)Keyboard Layout, Networking, and Partitioning"), and then instructing them to use `filefrag` in "(guix)Swap Space" should be ok. I can work on an additional patch for that, but I can't ensure that it'll be ready before 1.4.0 (I'm not in the dev team, so I don't know what the planning for the release is 😉). Cheers! -- Ivan Vilata i Balaguer -- https://elvil.net/