I created a swap file as described here: https://wiki.archlinux.org/index.php/Swap#Swap_file_creation
When I try to hibernate I get the following error:
$ echo disk > /sys/power/state echo: write error: no such device
Also in dmesg, I get:
[30721.352822] [drm] Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS. [30721.454735] acpi LNXPOWER:07: Turning OFF [30721.454987] acpi LNXPOWER:02: Turning OFF [30721.455365] acpi LNXPOWER:01: Turning OFF [30721.455563] PM: Cannot find swap device, try swapon -a [30721.455563] PM: Cannot get swap writer [30721.553943] OOM killer enabled. [30721.553944] Restarting tasks ... done.
As described in https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file, I set the following kernel params:
Here is how I get the resume_offset and resume parameter values:
$ filefrag -v /swapfile Filesystem type is: 9123683e File size of /swapfile is 536870912 (131072 blocks of 4096 bytes) ext: logical_offset: physical_offset: length: expected: flags: 0: 0.. 0: 148378880.. 148378880: 1: 1: 1.. 131071: 148378881.. 148509951: 131071: last,unwritten,eof
$ findmnt -no SOURCE,UUID -T /swapfile /dev/mapper/nvme0n1p2[/root] 2bfb4ccd-6b80-4806-8a08-4f1e67ef035f
When I try to use
swap_offset, I get the following issue:
$ swap-offset /swapfile ioctl(FIBMAP) failed: Invalid argument
So is it even possible to use a swapfile for hibernation when using BTRFS? It seems that the kernel is not aware of the correction location of the swap file.