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 ?
If you spend more than an a few hours a year on unix IT, ZFS pays dividends.
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
One of the most annoying parts is that OpenZFS drags their feet on Linux kernel releases. I understand Linux isn’t their only target, but adapting to the new APIs is usually merged quickly, but you are lucky to get a release before the last kernel is deprecated. I’ve been keeping Linux 7.2 on life support for weeks now.
The old advice was to stick to LTS. For stability this is true, but now with all these LLM-guided bug/security finds, much of these aren’t backported & leaves one at greater risk than before.
You’d be surprised at how many companies still use el7 internally 🥶
el7?
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.
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.
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.
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.
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.
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.
I dropped TrueNas when they dropped BSD. Speaking personally, FreeBSD+ZFS works well, but it’s a steep learning curve.
Agreed. I just needed more app support.
I prefer FreeBSD. I started on v2.2.1 back in like 1997. But on TrueNAS, it wasn’t cutting it for me.
Iirc scale is now the mainline, even.
Ah, I haven’t bothered to check since moving from the standalone BSD version. Thanks.
Ah yeah same, the only reason I vaguely remember this is that I helped a friend set his own server up.
I have no opinion here, and I’m rather on the ‘interested in the replies’ side. But I think what is it about just being with ext4? I have it on most my computers, as I had it many years ago. Only my home computer (Fedora, default install) has btrfs, and ironically it contains none of the data anyone cares about.
I am not really willing to reformat most of my disks, so I wonder what should I expect then? Do I need to do backups meticulously?
I lost some data recently due to a hard drive failing (no backups rip) and previously some files on disk due to corrupt blocks. I didn’t expect the drive to fail soon because it’s new but I learned my lesson.
I want a more fault tolerant system to avoid this again in the future. Of course RAID is not a backup but mostly fault tolerance
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
it’s not default in mainline linux
This may or may not be a huge con depending on what distro you’re using. I guess a lot of folks like using something like TrueNAS, which I assume takes a lot of the pain of maintaining the ZFS install…
On the other hand, if you want freedom of distro choice… this might be more important to consider… I’m currently blocked on updating my Fedora IoT servers because the ZFS installation (that I had to manually do) some how broke… 😭
btrfs actually being part of Linux seems really nice. I just started with ZFS, so that’s what I know. I actually did look into switching to btrfs last year… but now I don’t remember why I stuck with ZFS… maybe I should check again.
Self healing for bit-rot in files. So if your data is critical it is worth it.
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.
That is a good point. A backup is probably higher priority over choosing a filesystem assuming you already have something functional and no backup.
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
I like ZFS but I don’t like striped RAID for most home applications. The problem with striped RAID is that if you lose parity + 1, you lose all the data on all the drives. I use Unraid, which is unstriped RAID. Meaning if I lose parity + 1, I keep all the data on the unaffected drives. It’s also much more flexible, meaning I can mix and match drives of different sizes, and easily expand the array over time as required. If this interests you, SnapRAID is free and does the same thing. In fact, it’s even better, as it offers bitrot detection.
With only two drives you don’t need to worry about RAID yet. Maybe with three+, where one drive becomes your parity drive. So if a drive dies, you can replace it and not lose your data. It’s a terrible time to be leaning into this hobby given the price of HDDs.
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.
Yeah btrfs user here as well. But I never tried zfs, so cannot compare.
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.
Short answer: not for this machine. Your reading is right: on a single drive ZFS only detects corruption. It repairs a file only when a second copy exists, and with two drives that means a mirror. So the real question is what the second drive should do. I would give it a backup job rather than a mirror. A mirror survives one drive dying, but it also copies every deletion and every mistake to both drives at the same moment. A second drive holding a nightly copy (rsync, or restic if you want older versions) covers both cases, and then plain ext4 or XFS on the first drive is plenty. If you can, keep the backup drive in another room. ZFS or btrfs earns its place later, when you have more drives and want checksums and snapshots, and nothing you set up now stops you moving to it. Once the nightly copy runs, test it by restoring one file from the backup drive onto the first.
Please don’t just post LLM generated comments.
Snapshotting, which ZFS has, prevents any data loss from accidental deletion or mistakes.
Snapshots also occupy no space until you delete files
You could just use btrfs which has way less overhead
Alright gonna need some kind of citation for “way less overhead”
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 😬








