1

I have mounted Btrfs subvolumes (including /home) with the compress=no option in /etc/fstab. However, when I run btrfs inspect-internal dump-super -a <device_name> (both, on the running system, as well as on a live boot and mounting with compress=no), it shows COMPRESS_ZSTD in incompat_flags. So, are the subvolumes being used without compression, or with compression? Fedora 34 Workstation (GNOME), fresh install. This seems to default to zstd for at least the /home subvolume, which was not the case earlier, but is compression actually enabled despite being mounted with compress=no, as shown by inspect-internal? The partition containing the subvolumes is LUKS2-encrypted.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Saurav Sengupta
  • 301
  • 3
  • 11
  • Does `mount | grep /home` show that it's compressed? On my Fedora 34 XFCE VM, my (1) btrfs mount does not have compression enabled (using mount defaults). – ajgringo619 Aug 18 '21 at 20:03
  • No, `mount | grep '/home'` does not show compression. Also, I found the following on both `journalctl -b` and `dmesg`:- `BTRFS info (device dm-1): use no compression`. But the output from `inspect-internal` confuses me. What does it mean? – Saurav Sengupta Aug 19 '21 at 21:37
  • Check out this page from the btrfs wiki: https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs(5). About half-way down the page you'll see info on the incompat_flags. None of my btrfs mounts show `COMPRESS_ZSTD` in those flags. – ajgringo619 Aug 20 '21 at 00:07
  • @ajgringo619: As far as I can tell, your mounts showing or not showing `COMPRESS_ZSTD` will depend on how your file system was formatted and/or mounted. Defaults may differ by version. For example, there was no zstd by default up to Fedora 33. – Saurav Sengupta Aug 23 '21 at 12:19

1 Answers1

2

Use compsize to find out! Like this:

$ sudo compsize /home/
[sudo] password for mattdm: 
Processed 505961 files, 770493 regular extents (777052 refs), 272467 inline.
Type       Perc     Disk Usage   Uncompressed Referenced  
TOTAL       79%       86G         108G         109G       
none       100%       63G          63G          63G       
zstd        50%       23G          45G          45G       
prealloc   100%      1.0M         1.0M          20M        

This shows that on my /home subvolume, quite a lot of files are compressed. Note that this doesn't necessarily mean compression is active now; btrfs won't compress or uncompress files unless they're written.

mattdm
  • 39,535
  • 18
  • 99
  • 133
  • Got this:- ```Processed 6851 files, 6412 regular extents (6422 refs), 717 inline. Type Perc Disk Usage Uncompressed Referenced TOTAL 100% 238M 238M 238M none 100% 238M 238M 230M prealloc 100% 8.0K 8.0K 8.4M ``` So, if I am right, this means no compression? Also, you have said, "btrfs won't compress or uncompress files unless they're written." I have `nodatacow,nodatasum`, and I read that these disable compression; is there any relationship here? – Saurav Sengupta Aug 23 '21 at 12:12
  • ^ Sorry, I don't know how to format newlines in comments, if at all possible. – Saurav Sengupta Aug 23 '21 at 12:14
  • Yeah, comments can't have linebreaks. But from what I see there, 100% of your files are uncompressed. – mattdm Aug 23 '21 at 14:46
  • So, does that mean that it's running with no compression as intended? In that case, am I right in assuming that `inspect-internal` is showing what options the file system was formatted with, not the current state? Also, any ideas about whether/how `nodatacow` and `nodatasum` may (or may not) be affecting this? – Saurav Sengupta Aug 23 '21 at 19:02