You know, ZFS, ButterFS (btrfs…its actually “better” right?), and I’m sure more.

I think I have ext4 on my home computer I installed ubuntu on 5 years ago. How does the choice of file system play a role? Is that old hat now? Surely something like ext4 has its place.

I see a lot of talk around filesystems but Ive never found a great resource that distiguishes them at a level that assumes I dont know much. Can anyone give some insight on how file systems work and why these new filesystems, that appear to be highlights and selling points in most distros, are better than older ones?

Edit: and since we are talking about filesystems, it might be nice to describe or mention how concepts like RAID or LUKS are related.

  • aksdb@feddit.de
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    10 months ago

    As with every software/product: they have different features.

    ZFS is not really hip. It’s pretty old. But also pretty solid. Unfortunately it’s licensed in a way that is maybe incompatible with the GPL, so no one wants to take the risk of trying to get it into Linux. So in the Linux world it is always a third-party-addon. In the BSD or Solaris world though …

    btrfs has similar goals as ZFS (more to that soon) but has been developed right inside the kernel all along, so it typically works out of the box. It has a bit of a complicated history with it’s stability/reliability from which it still suffers (the history, not the stability). Many/most people run it with zero problems, some will still cite problems they had in the past, some apparently also still have problems.

    bcachefs is also looming around the corner and might tackle problems differently, bringing us all the nice features with less bugs (optimism, yay). But it’s an even younger FS than btrfs, so only time will tell.

    ext4 is an iteration on ext3 on ext2. So it’s pretty fucking stable and heavily battle tested.

    Now why even care? ZFS, btrfs and bcachefs are filesystems following the COW philisophy (copy on write), meaning you might lose a bit performance but win on reliability. It also allows easily enabling snapshots, which all three bring you out of the box. So you can basically say “mark the current state of the filesystem with tag/label/whatever ‘x’” and every subsequent changes (since they are copies) will not touch the old snapshots, allowing you to easily roll back a whole partition. (Of course that takes up space, but only incrementally.)

    They also bring native support for different RAID levels making additional layers like mdadm unnecessary. In case of ZFS and bcachefs, you also have native encryption, making LUKS obsolete.

    For typical desktop use: ext4 is totally fine. Snapshots are extremely convenient if something breaks and you can basically revert the changes back in a single command. They don’t replace a backup strategy, so in the end you should have some data security measures in place anyway.

    *Edit: forgot a word.

    • rutrum@lm.paradisus.dayOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      10 months ago

      Perhaps I’m guilty of good luck, but is the trade off of performance for reliability worth it? How often is reliability a problem?

      As a different use case altogether, suppose I was setting up a NAS over a couple drives. Does choosing something with COW have anything to do with redundancy?

      Maybe my question is, are there applications where zfs/btrfs is more or less appropriate than ext4 or even FAT?

      • aksdb@feddit.de
        link
        fedilink
        arrow-up
        0
        ·
        10 months ago

        For fileservers ZFS (and by extension btrfs) have a clear advantage. The main thing is, that you can relatively easily extend and section off storage pools. For ext4 you would need LVM to somewhat achieve something similar, but it’s still not as mighty as what ZFS (and btrfs) offer out of the box.

        ZFS also has a lot of caching strategies specifically optimized for storage boxes. Means: it will eat your RAM, but become pretty fast. That’s not a trade-off you want on a desktop (or a multi purpose server), since you typically also need RAM for applications running. But on a NAS, that is completely fine. AFAIK TrueNAS defaults to ZFS. Synology uses btrfs by default. Proxmox runs on ZFS.

        • 4am@lemm.ee
          link
          fedilink
          arrow-up
          0
          ·
          10 months ago

          ZFS cache will mark itself as such, so if the kernel needs more RAM for applications it can just dump some of the ZFS cache and use whatever it needs.

          I see lots of threads on homelab where new users are like “HELP MY ZFS IS USING 100% MEMORY” and we have to talk them off that ledge: unused RAM is wasted RAM, ZFS is making sure you’re running fast AF.

          • aksdb@feddit.de
            link
            fedilink
            arrow-up
            0
            ·
            10 months ago

            ZFS cache will mark itself as such, so if the kernel needs more RAM for applications it can just dump some of the ZFS cache and use whatever it needs.

            In theory. Practically unless I limit the max ARC size, processes get OOM killed quite frequently here.

      • aksdb@feddit.de
        link
        fedilink
        arrow-up
        0
        ·
        10 months ago

        It likely has an edge. But I think on SSDs the advantage is negligible. Also games have the most performance critical stuff in-memory anyway so the only thing you could optimize is read performance when changing scenes.

        Here are some comparisons: https://www.phoronix.com/news/Linux-5.14-File-Systems

        But again … practically you can likely ignore the difference for desktop usage (also gaming). The workloads where it matters are typically on servers with high throughput where latencies accumulate quickly.

  • Possibly linux@lemmy.zip
    link
    fedilink
    English
    arrow-up
    0
    ·
    10 months ago

    ZFS is a crazy beast that’s best for high end server systems with tiered storage and lots of RAM.

    ext4 is really just a basic file system. Its superior to NTFS and fat as it does have extra features to try to prevent corruption but it doesn’t have a large feature set.

    Btrfs is kind of the new kid on the block. It has strong protection against corruption and has better real world performance than ext4. It also has more advanced features like sub volumes and snapshots. subvolumes are basically virtual drives.

    Another few older options include things like XFS but I won’t go into those.

    List of filesystems: https://en.m.wikipedia.org/wiki/Comparison_of_file_systems

    • Lojcs@lemm.ee
      link
      fedilink
      arrow-up
      0
      ·
      10 months ago

      and has better real world performance than ext4

      Source? Most benchmarks I’ve seen it lags behind

        • Lojcs@lemm.ee
          link
          fedilink
          arrow-up
          0
          ·
          10 months ago

          Yes, but most filesystems are already optimized for flash storage. Arch wiki says f2fs is prone to corruption on power loss. Based on that and the lack of information on its anti-corruption measures I’m inclined to think it doesn’t have one and that’s why it’s faster. I wouldn’t use it in a non-battery operated device.

          • Pantherina@feddit.de
            link
            fedilink
            arrow-up
            0
            ·
            10 months ago

            So basically all laptop users can safely use it.

            Crazy how PC users rely on such a steady power supply. Arent there small UPS devices for a few seconds with auto shutdown?

        • d3Xt3r@lemmy.nzM
          link
          fedilink
          arrow-up
          0
          ·
          edit-2
          10 months ago

          That link is for kernel 5.14, so I’d say those results are pretty much invalid for most users (unless you’re actually on it, or the 5.15 LTS kernel). There have been a ton of improvements in every filesystem since then, with pretty much every single kernel release.

          A more relevant test would be this one - although it talks about bcachefs, other filesystems are also included in it. As you can see, F2FS is no longer the fastest - bcachefs and XFS beat it in several tests, and even btrfs beats it in some tests. F2FS only wins in the Dbench and CockroachDB benchmarks.