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.
In my experience, RAID 5 has always been poor performance, and at RAID 50 you’re better off just using ZFS.
ZFS’s killer feature (aside from RAIDZ) is silent data corruption protection, which is why its preferred for large pools with many drives or anywhere where data resiliency needs to be very high.
The key here is the pool size, ZFS is only worth running if you have a sizable amount of drives and the system resources (RAM mostly) to run it.
You can run it on a cheap homelab server, and people do, but I wouldn’t recommend it unless you only use it for storage and you get more drives for RAIDZ.
Otherwise, the cheapo method of getting better data resiliency without performance loss is RAID 10 (Or in your case, RAID 1). That’s my default for any consumer grade drives. The cost of half the usable space is just worth the level of protection you get from a drive failure, especially when you’re on a budget (still much cheaper per TB than buying some beefy SAS drives and doing RAIDZ).
Make it a RAID 1 and chuck XFS on it for some corruption protection (or BTRFS, or ext4).
Also, make sure you use smartctl and even consider making a script that runs a test monthly and saves the results somewhere easy. Start a long test of your drives and check the output later (take a couple of hours to a day) to see if it found any errors and look at the error counter stats. A failing drive will have a lot of errors stacked up in the counter, and a failed drive is if the long test fails.
Big zfs proponent here.
So as I understand you want to do software raid, don’t bother with zfs. Just use standard lvm and whichever fs you like to make your mirror.
Also it’s not just a Filesystem (so it’s far more). The best description I once saw that it is a layering violation and that’s actually a great description and also pro/con depending on your viewpoint. You can basically manage any storage any way you want. If that’s a good thing is up to you.
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?
(Red Hat) Enterprise Linux 7
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
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.
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.
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
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
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.
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.
NixOS also makes it trivial to use ZFS
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.
Worth it 100%. Even for single-drive systems like laptops. It allows for a trivial full system backups while the system is running.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Yeah btrfs user here as well. But I never tried zfs, so cannot compare.









