mount shows incorrect compress option for BTRFS subvolumes

Bug #2049304 reported by Ken Sharp
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
util-linux (Ubuntu)
New
Undecided
Unassigned

Bug Description

I have a number of subvolumes on a single BTRFS partition, the only partition on the disk, but the compression options passed for the subvolumes differ.

The correct compression is used when files are created, so that's all working fine, the only issue is that issuing a `mount` command (with no options) shows the wrong option.

In this particular case it shows that all subvolumes are using compress=zlib:3, when in reality some are using zstd.

My (trimmed) fstab:

UUID=83ed7b7f-ef51-49d7-a6be-a8efee1cdd32 / btrfs defaults,subvol=@ 0 0

UUID=83ed7b7f-ef51-49d7-a6be-a8efee1cdd32 /home btrfs defaults,subvol=@home 0 0

UUID=36aa8383-a103-44c3-93ea-826f1fda1c14 /var/log btrfs defaults,compress=zstd,autodefrag,subvol=log 0 0

# User stuff
UUID=36aa8383-a103-44c3-93ea-826f1fda1c14 /home/ken/Downloads btrfs defaults,compress=zstd,autodefrag,subvol=Downloads 0 0

UUID=36aa8383-a103-44c3-93ea-826f1fda1c14 /home/ken/.config/google-chrome btrfs defaults,compress,autodefrag,subvol=google-chrome 0 0

UUID=36aa8383-a103-44c3-93ea-826f1fda1c14 /home/ken/.thunderbird btrfs defaults,compress,autodefrag,subvol=thunderbird 0 0

UUID=36aa8383-a103-44c3-93ea-826f1fda1c14 /home/ken/.cache btrfs defaults,compress,autodefrag,subvol=cache 0 0

What mount shows:

$ mount | fgrep /dev/sd
/dev/sdc on / type btrfs (rw,relatime,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/@)
/dev/sdc on /home type btrfs (rw,relatime,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/@home)
/dev/sdb4 on /boot type ext4 (rw,relatime,discard)
/dev/sda on /home/ken/.cache type btrfs (rw,relatime,compress=zlib:3,space_cache=v2,autodefrag,subvolid=262,subvol=/cache)
/dev/sda on /home/ken/.config/google-chrome type btrfs (rw,relatime,compress=zlib:3,space_cache=v2,autodefrag,subvolid=260,subvol=/google-chrome)
/dev/sda on /home/ken/.thunderbird type btrfs (rw,relatime,compress=zlib:3,space_cache=v2,autodefrag,subvolid=261,subvol=/thunderbird)
/dev/sda on /home/ken/Downloads type btrfs (rw,relatime,compress=zlib:3,space_cache=v2,autodefrag,subvolid=257,subvol=/Downloads)
/dev/sda on /var/log type btrfs (rw,relatime,compress=zlib:3,space_cache=v2,autodefrag,subvolid=256,subvol=/log)
/dev/sda on /home/ken/.config/transmission type btrfs (rw,relatime,compress=zlib:3,space_cache=v2,autodefrag,subvolid=263,subvol=/transmission)
/dev/sda on /home/test/.xsession-errors type btrfs (rw,relatime,compress=zlib:3,space_cache=v2,autodefrag,subvolid=256,subvol=/log)
/dev/sda on /home/ken/.xsession-errors type btrfs (rw,relatime,compress=zlib:3,space_cache=v2,autodefrag,subvolid=256,subvol=/log)
/dev/sda on /home/ken/.xsession-errors.old type btrfs (rw,relatime,compress=zlib:3,space_cache=v2,autodefrag,subvolid=256,subvol=/log)
/dev/sda on /home/test/.xsession-errors.old type btrfs (rw,relatime,compress=zlib:3,space_cache=v2,autodefrag,subvolid=256,subvol=/log)

And to confirm that the correct compression is being used:

$ sudo compsize /var/log/syslog
Processed 1 file, 30 regular extents (30 refs), 0 inline.
Type Perc Disk Usage Uncompressed Referenced
TOTAL 27% 188K 684K 596K
none 100% 28K 28K 28K
zstd 24% 160K 656K 568K

$ sudo compsize ~/Downloads/test
Processed 1 file, 0 regular extents (0 refs), 1 inline.
Type Perc Disk Usage Uncompressed Referenced
TOTAL 42% 458B 1.0K 1.0K
zlib 42% 458B 1.0K 1.0K

I don't know if mount is to blame here, it could be something lacking in the kernel/BTRFS.

$ uname -a
Linux ken 6.5.0-14-generic #14~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 20 18:15:30 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: mount 2.37.2-4ubuntu3
ProcVersionSignature: Ubuntu 6.5.0-14.14~22.04.1-generic 6.5.3
Uname: Linux 6.5.0-14-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu82.5
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: MATE
Date: Sun Jan 14 11:16:52 2024
SourcePackage: util-linux
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.apport.crashdb.conf: [modified]
mtime.conffile..etc.apport.crashdb.conf: 2019-08-06T11:56:22.315382

Revision history for this message
Ken Sharp (kennybobs) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.