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 ?

  • ryannathans@aussie.zone
    link
    fedilink
    English
    arrow-up
    1
    ·
    14 minutes ago

    Zfs slaps and it’s so simple it doesn’t really need complex documentation, just get started and don’t fiddle with advanced options until you understand how they work

  • chattre@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 hour 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

  • Lettuce eat lettuce@lemmy.ml
    link
    fedilink
    English
    arrow-up
    3
    ·
    2 hours ago

    I love ZFS, and you don’t have to get deep in the technical stuff to enjoy the basic benefits. I’ve used it via TrueNAS, and it’s super easy to get set up.

  • Avid Amoeba@lemmy.ca
    link
    fedilink
    English
    arrow-up
    7
    ·
    4 hours ago

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

  • friend_of_satan@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    4 hours ago

    I’d go with zfs. You’ll get copy-on-write snapshots that take a split second to create and do not add any read or write overhead, online filesystem checking, detection of corrupt files down to the filename in the filesystem and all snapshots, lz4 file compression, and more. I even use zfs on single disk usb drives just because the features it offers are so good.

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

  • Onomatopoeia@lemmy.cafe
    link
    fedilink
    English
    arrow-up
    10
    ·
    8 hours 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
      ·
      7 hours 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
        2
        ·
        6 hours 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

  • ulemmyagainst@lemmy.world
    link
    fedilink
    English
    arrow-up
    25
    ·
    12 hours 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
      11
      ·
      12 hours 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.

  • BeigeAgenda@lemmy.ca
    link
    fedilink
    English
    arrow-up
    12
    ·
    10 hours 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.

  • Zwuzelmaus@feddit.org
    link
    fedilink
    English
    arrow-up
    19
    ·
    12 hours 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
      8
      ·
      9 hours 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
        2
        ·
        8 hours 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.

  • BCsven@lemmy.ca
    link
    fedilink
    English
    arrow-up
    15
    ·
    12 hours ago

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

      • BCsven@lemmy.ca
        link
        fedilink
        English
        arrow-up
        2
        ·
        9 hours ago

        You need a mirror copy so that when it checks the checksum it can go and pull the good copy

  • Err(()).unwrap()@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    ·
    11 hours 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.

  • eleitl@lemmy.zip
    link
    fedilink
    English
    arrow-up
    2
    ·
    8 hours ago

    I never had problems with zfs either on Solaris or BSD derivates nor Linux. It just works.

  • 2ndDegreeOWO@lemmy.world
    link
    fedilink
    English
    arrow-up
    5
    ·
    10 hours ago

    Personally, I use ZFS heavily, and I’d highly recommend it … but for such a simple system with only two drives and you just want redundancy, ZFS is kind of overkill. The only benefit you might get is the ‘copy on write’ feature, which gives you the ability to mount older snapshots of the drive and potentially recover data that has been deleted or overwritten. (Without unmounting the current version of the partition, you can mount an older version that still has the files that are gone. However, the deleted/overwritten files don’t stay around forever, especially if the drive is nearly full or gets written to often. It’s kind of like a fancy ‘recycle bin’, but it’s smarter about what files to keep shadow copies of – for example, files that existed for longer are more likely to be retained than files that only existed for a brief time.)

    Where ZFS really shines is in more complex setups where you want to take advantage of the performance gains. It can do some pretty cool stuff because unlike most other systems, it’s aware of both the layout of the data on the physical drives and the files and filesystem. In most other systems, those two things are handled by different subsystems that aren’t really aware of one another and can’t optimize things as nicely. For example, in a normal RAID system, the data blocks that are mirrored/striped across multiple drives are always the same size. But ZFS can mirror/stripe data blocks of varying sizes, allowing it to better optimize for a mix of small and large files. You can also do cool stuff like designating particular partitions/drives as file directories or caches to further optimize performance. (Great use for that old fast but small SSD you have lying around.)

    I got into ZFS with very little experience, and it was actually pretty straightforward to set up. If you want to use it just to learn it, I’d recommend that. But for the very simple setup you want, there are probably simpler solutions if you want something that just works out of the box without needing to configure things in the command line.

  • neidu4@piefed.social
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    8 hours ago

    Depends on your requirement and hardware really. If you don’t have the RAM for zfs, but a proper RAID controller, just go for raid 6. (The ones crying about raid and dataloss never use a proper RAID controller). If you do not have one, then zfs is a pretty decent choice, but it benefits greatly from having loads of RAM (not required, just very beneficial). If you need something ridiculously large, beegfs is your friend.

    For me, personally, I use zfs to serve a volume of 24 physical drives at home. I find that zfs sits in the middle where it’s flexible enough to serve a lot of those intermediate situations where mdraid isn’t enough, you don’t have a (proper) raid controller, and it’s not enough disks/machines to justify beegfs.

    With 2 drives I’d just go mdraid.