FWIW there are some fixes and enhancements coming in btrfs-progs 6.1, now in koji for
Rawhide, including making it easier to get info about hibernation file offset in a
swapfile.
I haven't messed with the new subcommand, but I personally prefer putting swapfiles in
their own subvolume so that I can still snapshot the root subvolume. Snapshotting a
subvolume containing a swapfile will render the swapfile invalid for use (or maybe the
snapshot fails, not sure, haven't tried recently).
The way I do this is mount the top-level of the file system (just do a normal mount
without any options), and inside you'll see what appears to be two directories: root
and home. Those are the subvolumes the installer creates by default. Create a new
subvolume in here and add it to fstab such that:
UUID=$fsuuid /var/swap btrfs noatime,subvol=swap 0 0
I use chattr +C on this swap subvolume, that way any new files created inside will
inherit. This is something the new subcommand will do for you.
An additional entry in fstab:
/var/swap/swapfile1 none swap defaults 0 0
You can certainly make a nested /var/swap thereby avoiding the need to create the earlier
fstab entry. But note that snapshots still don't have this nested subvolume in them,
so if you do a rollback it also won't have the nested swap subvolume or file - thus
you boot probably hangs because the fstab is looking for this swapfile to activate and
never finds it. So I just do it the way I describe, that way I can more or less forget
about it. But an alternative to that, if you really prefer nested, is s/defaults/nofail/
for the swapfile entry and now a missing swap won't cause boot to fail *but* you also
may one day forget all this and come to realize that there's no swap activated because
you once did a rollback way back when... :D
--
Chris Murphy