So basically BTRFS transparent compression (zstd:0) isn't working for the log files under /var/log/journal. I don't understand this issue because manually compressing the files (zstd file) gives a significant difference in size, but compsize reports them 100% as uncompressed. The compression works fine for other partitions.


/dev/mapper/vg_1-lv_varlog /var/log        btrfs   compress-force=zstd,relatime,nodev,nosuid,noexec 0       0


Processed 21 files, 28 regular extents (28 refs), 0 inline.
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL      100%      1.0G         1.0G         1.0G
none       100%      1.0G         1.0G         1.0G

Examples files

-rw-r-----+ 1 root systemd-journal  72M Apr  3 07:32 system@0a8678d3dc704a8c898bb86a8a8bc4bd-00000000000c94d0-0005a2528ac7d3c7.journal
-rw-r-----+ 1 root systemd-journal  72M Apr  3 19:09 system@0a8678d3dc704a8c898bb86a8a8bc4bd-00000000000de606-0005a25c3fec3527.journal
-rw-r-----+ 1 root systemd-journal  72M Apr  4 06:45 system@0a8678d3dc704a8c898bb86a8a8bc4bd-00000000000f3745-0005a265fa4a95e6.journal
-rw-r-----+ 1 root systemd-journal  72M Apr  4 18:20 system@0a8678d3dc704a8c898bb86a8a8bc4bd-000000000010887c-0005a26fb371f920.journal

Compression ratio example

-rw-r-----+ 1 root systemd-journal  72M Apr  8 06:55 system@0a8678d3dc704a8c898bb86a8a8bc4bd-00000000001c6a81-0005a2b9d9cd6e8f.journal
-rw-r-----+ 1 root systemd-journal 9.2M Apr  8 06:55 system@0a8678d3dc704a8c898bb86a8a8bc4bd-00000000001c6a81-0005a2b9d9cd6e8f.journal.zst

It even seems that journald is not even performing compression, or am I missing something?

Any advice on this?

  • What does btrfs property get /var/log and btrfs property get /var/log/journal/system@uuid.journal show?
    – rickhg12hs
    Apr 8 '20 at 13:41
  • @rickhg12hs The first command: ro=false label=, the second didn't output anything
    – aardbol
    Apr 8 '20 at 13:59

It seems that the /var/log/journal folder is set as NOCOW (+C), which also disables the compression functionality in BTRFS. You can check it with the command lsattr /var/log.

Since the developers probably enabled it for a good reason, it's best to leave it as it is, especially since SUSE also applies that flag to that (and the whole /var) folder.

See my comment below for the specific details of the +C flag.

  • You should really add this information to your original question.
    – rickhg12hs
    Apr 8 '20 at 17:53
  • If you set the directory to what you want, do you get the compression you are seeking? Is there a reason that directory was set to NOCOW?
    – rickhg12hs
    Apr 8 '20 at 17:55
  • @rickhg12hs I have to disagree because this is the reason for my issue. Since the +C flag is set, BTRFS can't do its Copy-On-Write (read: compression) magic. journald automatically sets the folder as NOCOW, probably because of its very high write activity, which would have a negative effect on the performance of the BTRFS filesystem.
    – aardbol
    Apr 8 '20 at 19:36
  • 1
    Good points. They helped me understand that this is an answer, not an elaboration of the question. Perhaps you could further explain your answer so future readers won't need to read the comments here.
    – rickhg12hs
    Apr 9 '20 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.