btrfs-progs: (chattr) Failure to create swapfile in fs with compression off in subvolume #384047
Open
3 tasks done
Labels
0.kind: bug
Something is broken
Nixpkgs version
Describe the bug
Btrfs supports both file compression and nodatacow, but not at the same time.
btrfs-progs
supports setting the compression algorithm at a per-subvolume level, without having to specify mount options for the subvolume. When this is done for a subvolume, btrfs will set them
attribute for each file in the subvolume:However, whether due to design or otherwise, chattr does not support setting +C (no copy-on-write) on files that have the
m
attribute. Trying to do so creates this error:This gets us to the core of the issue, which is that the command
btrfs filesystem mkswapfile
does not work in certain circumstances where it should. It creates this (obtuse) error:Steps to reproduce
btrfs property set compression zstd /path/to/mounted/fs
btrfs subvolume create /path/to/mounted/fs/@subvolume
btrfs property set compression none /path/to/mounted/fs/@subvolume
btrfs filesystem mkswapfile /path/to/mounted/fs/@subvolume/swapfile
Expected behaviour
btrfs
should remove them
attribute before setting theC
attribute, this works fine in my testingScreenshots
No response
Relevant log output
Additional context
There are two issues I can see here, first is that
man chattr
fails to document that them
attribute conflicts with theC
attribute. An appropriate warning is on thec
attribute:But for some reason the
m
attribute does not have this warning.The second issue is that btrfs itself fails to document that removing the
m
attribute is necessary:These commands will not work on a subvolume with the property
compression none
.This is likely an upstream issue?
System metadata
"x86_64-linux"
Linux 6.12.10-zen1, NixOS, 24.11 (Vicuna), 24.11.714685.36864ed72f23
yes
yes
nix-env (Nix) 2.24.12
"home-manager-24.11.tar.gz, nixos-24.11, nixos-unstable"
/nix/var/nix/profiles/per-user/root/channels/nixos
Notify maintainers
@7c6f434c @shlevy @alyssais @dezgeg @vcunat @K900 @edolstra @Ma27 @viric @globin @delroth
Note for maintainers: Please tag this issue in your pull request description. (i.e.
Resolves #ISSUE
.)I assert that this issue is relevant for Nixpkgs
Is this issue important to you?
Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: