BTRFS compression with 3ware RAID controller isn't working

Hi,

Today I had following problem:
After I had setup up a RAID 5 with a 3ware RAID controller (3ware Inc 9750), and format the entire disk with BTRFS and added some subvolumes, I wasn’t able to mount a single subvolume with the compress=lzo flag.

At first I tried to mount the partition through fstab, after that wasn’t successful, I tried to mount it from the command line, but neither worked.
I didn’t get an error or anything, but if when I list my mounts and grep for the mount, I see all defined flags, only the compress one is not there…

fstab entry:
UUID=933fdfe1-a908-4ed9-b502-f5c107accf2e /mnt/data/users btrfs subvolid=261,noatime,nodiratime,autodefrag,compress=lzo,defaults 0 0

mount output:
/dev/sdb on /mnt/data/users type btrfs (rw,noatime,nodiratime,space_cache,autodefrag,subvolid=261,subvol=/users)

So I thought I might try it with an external drive and see if that work, and it does! So it seams like its some problem with the RAID, maybe BTRFS compression works only with disks which are directly connected to the system?

Does anyone of you had a similar issue?
I didn’t find anything regarding this problem…

Can you post the entire fstab and the whole section of dmesg that relates to mounting this volume?

Note that the compression option might appear to be per subvolume, but it is a file system wide mount option. If it’s already mounted without compression by some other fstab entry, then subsequent mount will not add compression. It must be -o remount,compress=lzo to add it.

Also, autodefrag is best suited for particular write patterns where files are modified from within (insertion or overwrite inside of a file) such as databases. In particular web browser data bases. It can result in suboptimal behavior if this file system will be use with larger databases that are heavily updated, as well as VM images. Anyway, be certain you want to use it, it’s fairly narrow in what it’s intended to work for.

Currently there isn’t an autodefrag xattr to set per directory, but it’s being considered. In the meantime you can schedule regular defragmentation on specific directories by installing the btrfsmaintenance package and configuring the defragment service and then enable the timer.

Yes I can^^, that’s my fstab:

UUID=904d85d3-5a7e-411f-be81-7ae12b310831 /                       xfs     defaults        0 0
UUID=CED3-40E9          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
UUID=19c6dca5-0b86-487d-9f2d-f1c2922beeff none                    swap    defaults        0 0
UUID=933fdfe1-a908-4ed9-b502-f5c107accf2e /mnt/data/movies      btrfs   defaults,subvolid=256,noatime,nodiratime,aut
odefrag     0 0
UUID=933fdfe1-a908-4ed9-b502-f5c107accf2e /mnt/data/music       btrfs   defaults,subvolid=258,noatime,nodiratime,aut
odefrag     0 0
UUID=933fdfe1-a908-4ed9-b502-f5c107accf2e /mnt/data/apps        btrfs   defaults,subvolid=259,noatime,nodiratime,aut
odefrag     0 0
UUID=933fdfe1-a908-4ed9-b502-f5c107accf2e /mnt/data/backup      btrfs   defaults,subvolid=260,noatime,nodiratime,aut
odefrag     0 0
UUID=933fdfe1-a908-4ed9-b502-f5c107accf2e /mnt/data/users       btrfs   compress=lzo,subvolid=261,noatime,nodiratime,autodefrag,d
efaults     0 0
UUID=933fdfe1-a908-4ed9-b502-f5c107accf2e /mnt/data/snapshots   btrfs   defaults,subvolid=262,noatime,nodiratime,aut
odefrag     0 0

If I understand you correctly I can either mount all subvolumes with compression or with out it?

That would match with what i figured out at this morning. When I remount one subvolume with the compress=lzo and remount options, every other subvolume gets remount with the compression=lzo option…
Moreover the command mount -a mounts every subvolume with the compress=lzo option if this option is configures for every subvolume in the fstab file (makes sense), but it wont mount a single subvolume with the compress=lzo option if one mount in the fstab file is without this option.

EDIT:
I was blind… it seams like this is not implemented yet:
https://btrfs.wiki.kernel.org/index.php/Compression

If you want per file, per directory, or per subvolume compression, you can set a property on it:

btrfs property set compression lzo

In this case you don’t need to set the compress mount option. But realize that this works by inheritance but doesn’t cross subvolume boundaries. So if you set it on a directory, only new files and directories inherit the property. If you create a new subvolume in this directory it won’t inherit. Further, it will be preserved by btrfs/send receive. This method doesn’t yet have the levels option found with the mount option, e.g. compress=zstd:1

Sorry for the late reply.

Thanks for the proposal, I might try it on a test machine.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.