Closed zambetti closed 8 months ago
My understanding from reading the archlinux wiki is that subvolumes cannot be mounted with different cow on the same file system: https://wiki.archlinux.org/title/btrfs It is also mentioned in btrfs documentations (https://btrfs.readthedocs.io/en/latest/Administration.html):
Most mount options apply to the whole filesystem and only options in the first mounted subvolume will take effect. This is due to lack of implementation and may change in the future. This means that (for example) you can’t set per-subvolume nodatacow, nodatasum, or compress using mount options. This should eventually be fixed, but it has proved to be difficult to implement correctly within the Linux VFS framework.
In this case a workaround may be to explicitly set nodatacow as attribute for the folder, such as chattr +C /swap
. Perhaps this can be automated inside disko with a post-hook or similar.
Thank you for pointing me in the right direction; the documentation that you pointed me to helped a lot.
After getting a bit further with the installation, despite the subvolume /swap being mounted with compression and COW enabled, the swap file itself is configured correctly (without COW and without compression). I suppose this is because disko calls btrfs filesystem mkswapfile
and that configures the swapfile as it should be.
All seems to be working perfectly.
$ mount | grep swap
/dev/mapper/system on /swap type btrfs (rw,noatime,compress=zstd:1,ssd,discard=async,space_cache=v2,subvolid=260,subvol=/@swap)
# lsattr -l /swap/swapfile-0
/swap/swapfile-0 No_COW
$ swapon
NAME TYPE SIZE USED PRIO
/swap/swapfile-0 file 38G 0B -2
Ok. So this is one is solved, right?
The disk configuration below does successfully run, but when verifying the result with
mount
the swap subvolume does not respect themountOptions
in the configuration ("nodatacow" "nodatasum" and no compression).Might anyone be able to shed light on this? Does this seem like a reasonable approach overall?