UFS vs ZFS

It depends on how you configure ZFS.
I once had a ZFS setup with no redundancy at all and when the disk got damaged I lost all data on it.
ZFS is powerful if you don't mind on disk space usage to set it up with redundancy.
I'm now using UFS and keep my important documents safe with frequent backups and the code goes to git repos.
Just like any desktop OS, right?
If you have something like a server running in your system you may prefer ZFS with redundancy.
 
I once had a ZFS setup with no redundancy at all and when the disk got damaged I lost all data on it.
ZFS is powerful if you don't mind on disk space usage to set it up with redundancy.
And if you used UFS and had disk damage you would have lost all data on it too.
ZFS has benefits even without redundancy. Boot Environments is a huge win in my opinion.
ZFS without redundancy is no better and no worse than anything else.

BUT UFS is also rock solid you just have to live with how you initially partition.

Look, all I am doing is telling my opinions based on my personal/hands on experience with FreeBSD for a long time. Like it, don't like it, agree, disagree I don't really care. Just make sure statements are accurate.
 
ZFS without redundancy is no better and no worse than anything else.

BUT UFS is also rock solid you just have to live with how you initially partition.
Yes.

ZFS doesn't only offer (optional) redundancy, but also advanced integrity features. And on top of that, a whole lot of other nice features (like flexible datasets/volumes, reliable and efficient snapshots and clones, and so on).

UFS is rock solid and has this one advantage: it needs very little resources. ZFS needs more of them, especially RAM.

When deciding which FS to use, I'd always consider ZFS first. Use UFS if you really need to cut down on resources.

At the moment, I use UFS on just two machines:
  • my router/firewall, which is a VM that really shouldn't allocate lots of resources from the host. On top of that, its virtual disk is backed by some ZFS zvol, so most features ZFS provides are there anyways.
  • my extremely old "Asus EeePC" netbook, an i386 machine with damn weak specs.
 
zirias@ Exactly. But even ZFS can be tuned to run with fewer resources. pfSense is based on FreeBSD (14-Current at the moment I think) and by default uses ZFS. This is a firewall device, typical systems have 2G of RAM and limited disk and use ZFS just fine.
 
I was frankly hoping for this thread to be a place to have a discussion about the technicalities of ZFS, and being able to understand it well enough to put ZFS to good use on our hardware and be proud of that. I didn't want to turn this thread into an holy war about, of all things, filesystems, people.

It's OK to disagree and present your reasoning/examples, that's what makes this thread an interesting read.
 
Two great reasons to use ZFS, even with no redundancy or additional backups:

1) Boot environments. Near risk-free upgrades are a game changer.
2) Snapshots, especially automatic ones. Never again will you wonder “what setting did I tweak between when it worked and now?”

And then pile on compression, the ease and performance of backups if you choose to add them later, and flexibility zfs gives you over standard partitions.

Someone above talked about disk order from the bios; ZFS doesn’t care about this, either. (Although the boot process for UFS or ZFS is another story.)
 
  • Like
Reactions: mer
ZFS doesn't only offer (optional) redundancy, but also advanced integrity features. And on top of that, a whole lot of other nice features (like flexible datasets/volumes, reliable and efficient snapshots and clones, and so on).
Copy-on-write clones of a snapshot are super nice for poudriere(8) jails. No need to copy stuff around first, like you have to with UFS.

UFS is rock solid and has this one advantage: it needs very little resources. ZFS needs more of them, especially RAM.
The main advantage of UFS is sendfile(2). It can make a huge difference for some workloads. Kafka is the one I'm most familiar with.
 
The main advantage of UFS is sendfile(2). It can make a huge difference for some workloads. Kafka is the one I'm most familiar with.
If you want to send a file to a socket, just pipe cat into netcat, and be done with it :p
cat myfile | nc mysocket.sock

ZFS won't give a rat's ass about that.
 
cat myfile | nc mysocket.sock
The idea is to send incoming data to a file, not to send it out.(thanks @zirias) Yes, but your method is highly inefficient. Usually that involves copying the data out of kernel space into a buffer, and then copying it back into the kernel when it's written out to the filesystem a socket. The sendfile(2) system call bypasses that extra copy and writes the data directly to the filesystem in kernel space.
The FreeBSD implementation of sendfile() is "zero-copy", meaning that it has been optimized so that copying of the file data is avoided.
sendfile runs fast because it avoids copying file data into a buffer before it’s sent. The new version of sendfile further speeds up and simplifies large data transfers by supporting asynchronous I/O.

ZFS currently does not play nicely with sendfile(2).
 
Last edited:
Excuse my ignorance but you send a file eg a .tar.gz to a socket.
But on the other end something must be listening to this socket and send it to a copy of the file ?
Also sockets mean the same pc ?
 
Excuse my ignorance but you send a file eg a .tar.gz to a socket.
But on the other end something must be listening to this socket and send it to a copy of the file ?
Yes, see nc(1) for how to accomplish this. It's just an unencrypted (by default, TCP) socket for you to pass data through as fast as possible. Can also be used to debug mail/http/whatever servers.
 
The idea is to send incoming data to a file, not to send it out.
Uhm no? You got that the wrong way around. But apart from that, yes, sendfile() is meant as an optimization.

What it does is send some file, optionally adding header and/or footer data (so it's easy to wrap it into a whole protocol message, for example a HTTP response). It will always do that, no matter which filesystem you use.

But the real purpose of using it is performance by avoiding any copies (the kernel should read the file to the buffer that is also used for sending it out the socket without even copying anything to userspace). This only works with a filesystem that allows this tight integration.

ZFS doesn't, so sendfile() will work slower with ZFS.

You will need a very specific workload (involving sending a LOT of files from the filesystem to a LOT of concurrent clients) to notice a difference here, so in general, this won't be a reason to prefer UFS. If you have exactly such a workload, then it is of course.
 
And if you used UFS and had disk damage you would have lost all data on it too.
ZFS has benefits even without redundancy. Boot Environments is a huge win in my opinion.
ZFS without redundancy is no better and no worse than anything else.

BUT UFS is also rock solid you just have to live with how you initially partition.

Look, all I am doing is telling my opinions based on my personal/hands on experience with FreeBSD for a long time. Like it, don't like it, agree, disagree I don't really care. Just make sure statements are accurate.
I totally agree.
Check that I mentioned that "ZFS is powerful", so there's more than just redundancy, but ZFS need more memory also.
I would certainly use ZFS if I had a server or have a disk hub and need to add more disks to the system, etc.
 
Is it possible to install ZFS on whole HDD (single) with Auto (ZFS), later add second disk of the same size and extend ZFS to mirror without re-install? Or if possible - start with RAID1 configuration but with one HDD (second is missing). Run the system like degraded and one day in future add the second HDD and resilver.
 
Is it possible to install ZFS on whole HDD (single) with Auto (ZFS), later add second disk of the same size and extend ZFS to mirror without re-install? Or if possible - start with RAID1 configuration but with one HDD (second is missing). Run the system like degraded and one day in future add the second HDD and resilver.

Yes; you can use the FreeBSD installer onto a single-device zpool, and later zpool-attach(8) a mirror device. No need to make it a “missing mirror” at the start.

Note the bootcode isn’t on the zpool, so you’ll need to manually create/copy-over the boot portions if you want a redundant setup. (You can use gpart(8)’s backup/restore to copy of the partition layout — note it only copies the layout, not any contents.)
 
ZFS memory usage often depends on the usage patterns. ARC/L2ARC is where a lot of memory winds up being used, but ARC is basically "Read Cache".
pfSense is a firewalling product based on FreeBSD (14-CURRENT at the moment). Most of the devices have memory in the range of 2-4G, then SSD/eMMC/NVMe devices for storage. The default install uses ZFS, the usage on one of my devices is 35% of RAM (4G total).
Why? Well, after the initial boot, the majority of I/O to the filesystem is writes so you hit steady state pretty quickly.

So yes, under a lot of workloads, ZFS will benefit from having more RAM available, but you have to look at exactly what your specific patterns are.
 
Right, on a system with low IO requirements and low amounts of RAM, ZFS can still be a fine choice. I’ve run it on my (4G RAM) router for years, and have been very happy with it.
 
Yeah, ZFS does offer relatively painless ways to increase storage space of the system beyond the original HDD/SSD... Other filesystems do have to rely on stuff like SMB/NFS, and that does bring in more complexity. Fun stuff to play with, but I'd prefer to be able to at least pretend it's all just one processor, one filesystem, one zpool...
 
I am using UFS on my single workstation. I know my needs and rarely (almost never) needs to change my setup. Drive space is cheap. So having enough is not a problem. I know how to fix errors when they happen and make baclups on a regular basis. On a server or commercial system I would definitely consider ZFS. But in the next release UFS will finaly be able to take snapshots under all circumstances. So I will keep using it although it is not because of lack of resources (64GB ram)
 
I am using UFS on my single workstation. I know my needs and rarely (almost never) needs to change my setup. Drive space is cheap. So having enough is not a problem. I know how to fix errors when they happen and make baclups on a regular basis. On a server or commercial system I would definitely consider ZFS. But in the next release UFS will finaly be able to take snapshots under all circumstances. So I will keep using it although it is not because of lack of resources (64GB ram)
I don't get that rationale. So, you have the necessary resources, and you don't have one of these specific workloads that would benefit from "optimized" sendfile()... Then why miss out on all the nice features? Having datasets (volumes) dynamically allocated from the pool is already a big plus (they can be treated separately, e.g. for backups, can have their own mount options, can be snapshotted and cloned separately, still you will never have to deal with inflexible partitions), also even without redundancy, ZFS offers advanced integrity features, and then, snapshots is just one part of the whole picture, to really profit, you also need copy-on-write clones with the flexibility to exchange the original and the cloned dataset freely (only with that, something like boot environments or a tool like poudriere can work efficiently). With the possibility to (de)serialize snapshots (or, differences between two snapshots) using zfs send/recv, you also get a very powerful mechanism for incremental backups.

So, is there a key selling point for UFS in your case? Or did you just never try ZFS so far?
 
I have tried ZFS a few time. But I am not missing any features on UFS and diod not use most of the features of ZFS. And I can restore files in case of errors and emergency. In some situations that is not possible on ZFS without multiple copies (wich I consider overhead when I have backups of my data), And I would not be able to recover in case of emergency, as easy as with fsck (witch has never let me down yet). I also know and want to decide what data to place on my different disks (2 nvme and two big HDD).

I am not going to tell anyone what they should use or not. I am just saying that UFS for me is a stable and satisfying tool. ZFS has a lot of use cases, especially on servers. But both file systems are valid choices in my opinion.
 
Back
Top