Per title. From quick googling, I understand that zfs is a filesystem that provides some kind of software RAID and resiliency (eg CRC checks at the block level). Is my understanding right that it just good for detecting storage corruption, but not really self healing?

My home server just for a mini storage/ media server and I am broke to afford RAID. So at the moment, it’s just 2 consumer grade drives .

So pros with zfs I can think of, I get slightly better data resiliency.

But after reading the docs, the cons for me are that a) it’s not so straightforward/ somewhat complex to tune and use, b) it’s not default in mainline linux, and c) slightly lower performance?

What do you think and is it worth learning to use it vs just slapping a plain xfs/ ext4 ?

  • Guiorgy@lemmy.ml
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    6 hours ago

    Both ZFS and BTRFS require having at least 2 copies for healing, however, unlike a standard RAID1 that is oblivious to which of the 2 copies is healthy, the 2 filesystems use CRC checksums to figure out which is corrupt and recover the good one. As long as you have at least 2 copies, they will check the checksum on every read and heal it if corruption is detected. Besides that, you’d schedule a periodic scrub to also check the data that hasn’t been read in a while.

    In ZFS you can tell it to keep 2 copies of everything even if you only have 1 drive, which would give you the healing effect, but this obviously halves the drive capacity, and does not save you if that 1 drive dies, hence spreading it on multiple drives is better.

    Personally, I find ZFS easier to use than BTRFS, it’s not that complicated once you get the hang of it, plus LLMs can help anyway. It does have many dials that can be tuned, but unless you are trying to optimize it for a specific usecase, the generally recommend setting are fine for most use cases.

    It’s not built into the kernel, but server distros (e.g. Ubuntu) build it as a loadable module, which is kept in step with the kernel, so generally no issues there. On distros like Arch it can be really annoying though.

    “Slightly lower” is a bit of an understatement, both for ZFS and BTRFS. Those are CoW (Copy on Write) filesystems, so they are much slower to write, which is a traid off for the benefits of CoW. On the other hand, reads are only slightly slower (since CRC is always checked), and thanks to transparent compression, they can be even faster to read.

    One downside of ZFS over BTRFS is fragmentation, all CoW filesystems suffer from it, but BTRFS allows you to defragment in place (takes a while though) unlike ZFS.

    If you can’t afford storage, the data you want to store is generally compressible, and speed is not critical/priority, it might be woth using ZFS/BTRFS just for the transparent compression to save on space and get more out of the drives you have. I’m using BTRFS on a Fedora system for this reason alone, helps me avoid buying a new SSD 😬