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 ?

  • andioop@piefed.social
    link
    fedilink
    English
    arrow-up
    1
    ·
    5 days ago

    I’m just so glad you asked this because I’ve been looking for an answer to this too. Will read all the comments!

  • Shimitar@downonthestreet.eu
    link
    fedilink
    English
    arrow-up
    39
    ·
    9 days ago

    It’s my personal opinion but: no

    Btrfs is integrated in the kernel already and pretty solid. I have been running it for the last few years. I use Linux mdarray to create a raid5 and on top of it, format btrfs.

    Never had issues, and yes it did catch data corruption (and fixed it) so I am pretty happy .

    Zfs on the other hand, needs specific kernel patches and I don’t like that too much.

    • Avid Amoeba@lemmy.ca
      link
      fedilink
      English
      arrow-up
      6
      ·
      8 days ago

      ZFS has been running with upstream kernels for years. Ubuntu ships with precompiled module and Debian has a DKMS package which compiles ZFS against the stock kernel.

    • dadarobot@lemmy.ml
      link
      fedilink
      English
      arrow-up
      4
      ·
      9 days ago

      fully agree.

      i used zfs on arch many yeara ago and my updates would fall months behind.

      then i switched to freebsd for better zfs support. but lost support of some linux apps

      later i started using truenas and it works great.

      on a related note, i switched to cachyos on my desktop and laptop and used btrfs for the first time and i absolutely love it.

      so if youre building a nas from scratch, id say use btrfs, but if youre using an os that manages that stuff for you, zfs is a great choice.

      • Guiorgy@lemmy.ml
        link
        fedilink
        English
        arrow-up
        5
        ·
        9 days ago

        If you only require mirrors (RAID 1) then BTRFS works fine, but if you need something more and the system has good support for it (e.g. Ubuntu) then ZFS is better IMO. Yes you can use mdraid with BTRFS, but I prefer 1 ZFS over 10 different moving parts.

        I use both, choosing which one depending on the conditions.

  • ulemmyagainst@lemmy.world
    link
    fedilink
    English
    arrow-up
    37
    ·
    9 days ago

    I use and highly recommend truenas. It uses zfs by default and has a nice web ui, so you don’t have to worry about setting up zfs. It has docker built in and can also do virtual machines and containers.

    • orbituary@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      15
      ·
      9 days ago

      I’ve used it for about 4 years now. It is a good platform with a few limitations, but largely worth it. Do not use anything but TrueNAS SCALE or you’ll be disappointed by the availability of packages for it.

  • Zwuzelmaus@feddit.org
    link
    fedilink
    English
    arrow-up
    29
    ·
    9 days ago

    2 legends about ZFS seem never to die: that it is difficult in normal linux, and that it needs much extra RAM.

    Truth is, it is availible in the normal kernel now and several distros offer it from start. There are tools for maintaining it, and after a while, you will find that it needs less routine maintenance that most traditional file systems.

    Truth is also that it can absolutely work with less RAM. That thing is only important for servers with a high load. There it is recommended strongly to have lots of RAM, but even there it is not for the sake of ZFS itself, but it is for the performance of your server. It makes good use of all that RAM in ways that other file systems cannot.

    Is my understanding right that it just good for detecting storage corruption, but not really self healing?

    If you use it on just 1 drive, and the default setting, then this is true. It still detects bit rot, but it cannot repair it automatically. But it has also an option for the self healing on only 1 drive (for the price of drive space then).

    If you use 2 mirrored drives, or more as a raidz, the self healing is always there.

    • lemmyvore@feddit.nl
      link
      fedilink
      English
      arrow-up
      14
      ·
      9 days ago

      Truth is, it is availible in the normal kernel now and several distros offer it from start.

      You may want to rephrase this. ZFS license (CDDL) is still incompatible with the Linux kernel (GPL) so it’s not part of the kernel sources and needs to be compiled as an out-of-tree module against the kernel you’re running.

      Some distros make such modules available by default with some of their official kernels, some don’t. You can get it installed on most distros but the manner of doing so and the amount of support you can expect from the distro varies wildly. If install/update is a manual operation you run the risk of the module falling out of sync with the running kernel.

      • ShortN0te@lemmy.ml
        link
        fedilink
        English
        arrow-up
        4
        ·
        9 days ago

        That beeing said. For most popular ‘server’ distros its available in the packet sources and the hussle to install it is just a single command to the packet manager.

        It you run custom kernels, or do anything that is not officially supported then obviously you do not have the support and have to risk having it falling onto your feet.

        Mostly scarecity.

        • lemmyvore@feddit.nl
          link
          fedilink
          English
          arrow-up
          2
          ·
          8 days ago

          Mainly what bothers me about the whole approach is the possibility of having the module not load one day, for whatever reason.

          I’ve had this happen with out-of-tree modules for other stuff. I’m fine with something like a controller or camera not working, can even cope with the GPU not working. Not ok with not being able to mount a filesystem that all your stuff is on.

          • Zwuzelmaus@feddit.org
            link
            fedilink
            English
            arrow-up
            2
            ·
            7 days ago

            not being able to mount a filesystem that all your stuff is on.

            No fun, ofc. But also no extra damage comes from it.

            The ZFS will stay OK, your disks as well. You can even pack them into a different PC and use them there, all will be fine. I have done it. It is NOT like traditional RAID that can work only with the right controller from the right brand.

          • ShortN0te@lemmy.ml
            link
            fedilink
            English
            arrow-up
            1
            ·
            8 days ago

            But thats why you dont do that? Either you go for an official package that will be held up to date with your kernel or other system packages or when you for some reason build it yourself or are side loading it, then you automate the process to be triggered during update.

            But this is true for every piece of software that depends on specific other software like libraries.

            Been running zfs on Debian and Ubuntu for years now and never had to gave it a thought during updates and even between release upgrades.

    • Jason2357@lemmy.ca
      link
      fedilink
      English
      arrow-up
      1
      ·
      7 days ago

      Not quite self-healing, but worth noting: if you use zfs send to automate backup of snapshots, and local files get corrupted for whatever reason, the corrupted files are not propogated to the backup. That is not the case for most other backup solutions because they cant detect it. Zfs not only alerts you to the bitrot, it prevents it from spreading.

  • BCsven@lemmy.ca
    link
    fedilink
    English
    arrow-up
    21
    ·
    9 days ago

    Self healing for bit-rot in files. So if your data is critical it is worth it.

  • kalleboo@lemmy.world
    link
    fedilink
    English
    arrow-up
    20
    ·
    8 days ago

    Thanks to btrfs I learned I had bad RAM that was corrupting files. Nothing was crashing, so I would never have noticed otherwise. 100% would recommend using a file system with checksumming, be it ZFS or btrfs.

  • BeigeAgenda@lemmy.ca
    link
    fedilink
    English
    arrow-up
    19
    ·
    9 days ago

    I chose btrfs over zfs, because you can add and remove disks from a volume (I’m not sure if zfs has this feature now) I use this to move the volume from old to new disks.

    • FlexibleToast@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      8 days ago

      ZFS does have that feature now, sort of. You can add drives to a vdev now, but the vdev will keep its original shape. So for example if you had 4 drives in a RAIDZ it would be 3 stripe + 1 parity. If you add a 5th drive it will stay 3+1 and not efficiently use the space. It doesn’t rebalance to 4+1. It’s strongly recommended not to do it.

  • Avid Amoeba@lemmy.ca
    link
    fedilink
    English
    arrow-up
    15
    ·
    8 days ago

    Worth it 100%. Even for single-drive systems like laptops. It allows for a trivial full system backups while the system is running.

  • chattre@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    14
    ·
    8 days ago

    I think BTRFS is easy enough (included in the kernel, pretty stable) and has most of the practical benefits of ZFS with little overhead. I like the snapshots and FS compression

  • Onomatopoeia@lemmy.cafe
    link
    fedilink
    English
    arrow-up
    14
    ·
    9 days ago

    ZFS shines with large datastores and multiple drives. It has its uses, for sure.

    As others have said, it puts all the layers: RAID blocks, file system, volume management, etc, all under a single umbrella. Because of this it can do some things that are more challenging with other approaches.

    For your two drives, I wouldn’t bother with anything other than what they are, and make sure you have proper backups.

    Drives die all the time. Just today one of my RAID boxes complained about a drive, in the process of replacing the drive I discovered 2 other bad drives that I had sitting around as spares.

    Last week an external drive decided to die. Fortunately I was using it as one of three replicants of my primary system, so no big deal.

    • monkeyman512@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      9 days ago

      That is a good point. A backup is probably higher priority over choosing a filesystem assuming you already have something functional and no backup.

      • Guiorgy@lemmy.ml
        link
        fedilink
        English
        arrow-up
        4
        ·
        9 days ago

        RAID is not a backup, what RAID gives is availability, what you should prioritize depends on the usecase, but generally proper backups are usually the priority

  • Jimbambuli@lemmy.world
    link
    fedilink
    English
    arrow-up
    11
    ·
    8 days ago

    I use both in my Proxmox cluster: ZFS on the big storage node, LVM-thin on the smaller ones. ZFS is worth it where you want snapshots, send/receive and checksums, but it wants RAM and you should plan the pool layout up front. On small boxes LVM-thin is simpler and does the job.

  • Err(()).unwrap()@lemmy.world
    link
    fedilink
    English
    arrow-up
    10
    ·
    9 days ago

    I absolutely recommend ZFS. I’ve been burned by MD (the other software RAID) because it doesn’t scan the array for bad data, so bit rot and silent errors can go undetected until a process wants to read it. ZFS periodically scans the array and fixes corrupted data if possible.

    ZFS can use more CPU resources compared to MD, but the difference in performance is insignificant compared to the read bandwidth of mechanical hard drives. Memory usage is comparatively high because it uses the RAM as cache, but you can set a limit. My current 8TB RAIDZ1 array uses only 8GB of RAM and it could still be lower.

    I recommend using some dedicated OS to manage ZFS pools, like TrueNAS Scale or Proxmox.

    https://pve.proxmox.com/wiki/ZFS_on_Linux

    it’s not default in mainline linux

    It’s purely an issue of licenses. ZFS is a mature solution, and being out-of-tree does not reflect a qualitative issue. It’s available as a separate package on most distributions.

    • Shimitar@downonthestreet.eu
      link
      fedilink
      English
      arrow-up
      3
      ·
      9 days ago

      You cannot compare zfs to md, they are different like apples and oranges.

      MD it’s a raid device, not a filesystem.

      You should compare btrfs to zfs, they pretty much share the same capabilities and features.

      I use MD as my raid array, and btrfs on top of MD.

      Of course if you use ext4 on top of MD you get nothing of the good stuff, except a very solid array management due to md.

  • SayCyberOnceMore@feddit.uk
    link
    fedilink
    English
    arrow-up
    10
    ·
    8 days ago

    Just chipping in as someone who’s tried mdadm, zfs and btrfs over the years…

    I settled on btrfs in the end basically due to the quantity of tools that can read the filesystem.

    I use clonezilla and gparted a lot when setting up and maintaining systems and btrfs just has more support, easier to add disk, etc.

    It’s also - as others have mentioned - already in the kernel so you can keep your data and change your distro if needed.

    I see - and this is a generalisation - most people have ZFS because of TrueNAS, which is fine, but when I built my own (Arch, btw) NAS, it just all came together nicely (giggity) with btrfs

  • Guiorgy@lemmy.ml
    link
    fedilink
    English
    arrow-up
    9
    ·
    edit-2
    8 days 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 😬

  • IsoKiero@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    9
    ·
    9 days ago

    ZFS requires also quite a bit of RAM, so if you’re tight on it then just go with traditional filesystem. But if you’ve got the hardware to support it, it can absolutely be worth it. But, like any RAID or other similar solutions, it’s not a backup and all hardware will fail, so plan accordingly.

    • Shimitar@downonthestreet.eu
      link
      fedilink
      English
      arrow-up
      8
      ·
      9 days ago

      Try btrfs if ram footprint of zfs scares you. Pretty solid , all the same features (at least the ones I need) and no licensing issues and already baked in Linux kernel.

    • Avid Amoeba@lemmy.ca
      link
      fedilink
      English
      arrow-up
      3
      ·
      8 days ago

      It does not require much RAM. It uses whatever you give it. It uses the RAM for read speedup. By default it takes half of the system RAM but you can give it basically nothing and it’ll work fine. I’ve used it on Raspverry Pi 3 for years without fault.

    • non_burglar@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      9 days ago

      My nas is an SBC with 4GB ram and a 2 disk mirror. There is no appreciable performance difference between this and my recent retired 128GB ram nas.

      ZFS will use as much memory as you want it to, but it doesn’t need it if you consider your setup.

    • kalleboo@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      8 days ago

      The “ZFS requires a lot of RAM” meme comes from back in the day when people were obsessed with the de-duplication feature (which yes, does require a lot of RAM) as the big cool feature to use ZFS for. Nobody uses the de-duplication feature.