Deep Diving into the Strengths of FreeBSD
klarasystems.com
klarasystems.com
For me, native ZFS support is FreeBSD's killer feature. It's had containerisation (called "jails") long before Linux knew it was a thing and combining those jails with ZFS gave you several of convenience features that VMs and/or Docker offered but 10+ years ago before Docker was a thing. And yes, I know some Linux distributions support ZFS in an official capacity but having used them and FreeBSD, ZFS support on FreeBSD is easily light years ahead of Linux. It's hard to substantiate why other than saying all of those minor niggles you have with Linux+ZFS simply doesn't exist with FreeBSD+ZFS. On FreeBSD, using ZFS feels as native as using the ext4 on Linux.
It's a great shame that the industry has monopolised on Linux because FreeBSD brought, and continues to bring, a lot to the table.
Why? I never cared about my filesystem. Does it make a difference what filesystem am I using?
There are significant differences in performance, admittedly SSDs temper these differences but there are plenty of systems with large HDDs. This isn't an abstract performance benchmark thing, I feel it when doing operations on large numbers of small files.
There are significant differences in features that impact how you use the system. For instance, sometimes I like to backup a directory I'm working in (typically before some funky git operation), normally that can be done with cp or tar, but that's slow. Much faster is a manual filesystem(/volume manager) snapshot. But I have to remember to do that. Much more convenient would be if I didn't have to explicitly create a snapshot, which HAMMER would offer me.
All non-temporary HAMMER filesystems in DragonFly by default automatically maintain 60 days worth of 1-day snapshots and 1-day worth of fine-grained (30-second) snapshots. - https://www.dragonflybsd.org/features/#index3h2
There are a lot of other features that might or might not matter to you. If the above don't it is because you haven't been burned yet in life. (Or you use one of several other filesystems that support those features)
$ zfs snapshot zroot/home@migrate
$ zfs send -R zroot/home@migrate | ssh newhost zfs recv zroot/home
ZFS automatic snapshots (via zfstools[1]) can also saved hours of headaches trying to recover an older version of a file. Since snapshot appears as a regular mount (ZFS even automatically expose them under /path/to/mount/.zfs/snapshot), all existing tooling just works (cp, cat, running diff against snapshot, etc.).My Linux machine these days also runs ZFS, but the level of integration with the system is still far from that of FreeBSD's. That can range from something as simple as ZFS ARC stats in top, to native support for ZFS Boot Environment allowing the system to boot directly from snapshots or do an offline upgrade of a clone of a live system[2]. (On Linux side of things there's zfsbootmenu[3] which provides something similar but the project is still quite new.)
The filesystem may not matter that much, and I'm sure many these features can be replicated with LVM, but having a unified tooling and community around it really makes quite a difference in quality of life as an end-user.
[1]: https://github.com/bdrewery/zfstools
[2]: https://vermaden.wordpress.com/2021/02/23/upgrade-freebsd-wi...
Using them for system updates/upgrades is built right into FreeBSD (copying a feature from Solaris):
* https://www.freebsd.org/cgi/man.cgi?beadm
If the changes fail just rollback the system to the previous state/snapshot (including kernel changes) via the boot loader.
Services like rsync.net allow one to have offsite backups with easy, and the destination can be encrypted such that the remote end can't see your data. All through an SSH pipe.
I'm guessing the newness/missing features of zfsbootmenu is in regards to beadm [2]?
[1] https://pthree.org/2013/01/03/zfs-administration-part-xvii-b... [2] https://vermaden.files.wordpress.com/2018/11/nluug-zfs-boot-...
I've been using ZBM since its inclusion in void-packages. It already does everything I wanted it to, but I don't think its usage is widespread outside Void Linux community just yet. Being dependent on Dracut might be one of the reason why (I believe Arch is still using mkinitcpio). There's installation instruction for Void and Debian Buster on ZBM GitHub[4]. I used to have a separate ZBM root for void-musl and void-glibc which worked quite well (though I'm now running only void-glibc due to Nvidia).
[1]: https://savannah.gnu.org/bugs/?func=detailitem&item_id=58270
[2]: https://openzfs.github.io/openzfs-docs/Getting%20Started/ind...
[3]: https://wiki.archlinux.org/title/Install_Arch_Linux_on_ZFS
This is my last root ZFS install on linux.
I had problems with fedora before (where at least ZFS wasnt supported and I was expecting problems), I am having problems with Ubuntu now and I never had any issues with zfs root on FreeBSD in ~15 years.
I am sick of distributions "moving fast and breaking things" on my back.
Snapshotting imo is one of the best things. Copy on write file systems really are awesome. And FreeBSD adopting ZFS so early was a huge win imo.
>It's a great shame that the industry has monopolised on Linux because FreeBSD brought
No sure about that, i think it better the way it is, Linux (the ecosystem) is such a bloatware because it implements every single feature the Industry needs, then having userlandtools like toolbox, busybox or Gnu, 3 different libC's, 5 different MAC-Framework, around 50 different local filesystems (but just 3-4 are stable enough for daily use)....and so on.
We don't even need hypotheticals, how many proprietor Unices were there before Linux? Forget history, how many libre Unices are there now? Off the top of my head I can count Free/Net/Open/Dragonfly BSD and may be missing one or two.
Only difference is Linux provides a-la-carte experience, while BSDs provide the bundled options. But zoomed out, none bloat doesn't appear to me as an issue in choice/decision making department.
That's what i meant.
>Forget history, how many libre Unices are there now?
I fail to understand what you wanna say.
EDIT: Adding reference: "FreeBSD moving to ZFS-on-Linux"
https://forums.freebsd.org/threads/freebsd-moving-to-zfs-on-...
https://forums.freebsd.org/threads/freebsd-moving-to-zfs-on-...
https://openzfs.org/wiki/Main_Page
>The OpenZFS project brings together developers from the Linux, FreeBSD, illumos, MacOS, and Windows platforms. OpenZFS is supported by a wide range of companies.
It makes a great deal of sense for the Linux and FreeBSD communities to collaborate on ZFS rather than both maintaining their own separate forks and merging back and forth. It means you much more easily maintain feature & bugfix parity, and makes migrating filesystems between OSes easier.
It's a win for everyone involved, not a negative.
However, since the ZFS code basis is now the same for Linux and FreeBSD (which I also agree is a good thing) I don't think we will have the same superior FreeBSD ZFS argument anymore. And people who are in favor of FreeBSD over Linux have to provide other pro arguments than ZFS in order to make a case for FreeBSD.
FreeBSD has features like 'bootonce', to switch ZFS boot environments on the next boot only. Better integration with the boot loader, more boot environment tooling, and other things that can only come when the filesystem is part of the OS.
To any sane person this news should be viewed as a victory not a loss.
[W]orking through the git history of ZoL I have also discovered that
many races and locking bugs have been fixed in ZoL and never made it
back to Illumos and thus FreeBSD. This state of affairs has led to a
general agreement among the stakeholders that I have spoken to that it
makes sense to rebase FreeBSD's ZFS on ZoL.
This port will provide FreeBSD users with multi modifier protection,
project quotas, encrypted datasets, allocation classes, vectorized
raidz, vectorized checksums, and various command line improvements.
From content, parent reply is correct. ZoL was far ahead FreeBSD's native ZFS port, that FreeBSD devs found that is better using ZoL instead.Edit: Also related presentation by A. Jude at https://2019.eurobsdcon.org/slides/The%20Future%20of%20OpenZ...
The FreeBSD fork also had a bunch of ZFS features that hadn't yet made it to ZoL as well as their own bug fixes too. I know this first hand from porting volumes between ZoL and FreeBSD.
FreeBSD didn't switch their code base and dump everything they had in their own fork. They switched upstream so that everyone worked on the same common code base and merged what was practical and kept any of their own OS dependent code separate. Just as I said in my previous post and just as the presentation you linked to also confirms. And for what it's worth, it's the OS dependant stuff that makes ZFS's experience better on FreeBSD than it is on Linux.
I also don't understand why so many people want to assume a negative spin on the story. Projects fork and change upstreams all the time when it's identified that there's a commonality they can share resources on. This isn't any different.
One of the experiences is very much "native" - the other is possible, but a GIANT pain to accomplish.
At some point I'm sure, Ubuntu at least, will make installing to ZFS on a server OS more straightforward. I've got several systems doing it today, but I can tell you it's not for the faint-hearted and it took a TON of trial and error to get it to do what I wanted consistently. I also cringe every time I apply an update because I know it's not something that is getting any significant testing by Canonical or the community at large.
There's other OS specific features that FreeBSD does better with regards to ZFS such as ACLs too. But like with trashed volumes, they're edge cases.
FreeBSD also has better bundled tooling for working with ZFS. By this I don't mean `zfs` and `zpool` but little shell scripts et al that are FreeBSD specific.
Then there is the documentation. If you're running Linux then all the documentation regarding server management is about standard server management (ie with an ext4 or xfs root). But FreeBSD documentation will talk about how to do management with the assumption you're running ZFS. The FreeBSD docs (which are excellent, by the way) has pages and pages on ZFS outside of the stuff published by ZoL (which is pretty poor it has to be said) and OpenZFS. And I say the last points as someone who's had to manually compile kernel modules on Linux to get the latest patch to support a feature that made it to FreeBSD first.
I do have servers running ZFS + Linux and they work really well. So I'm not taking anything away from that architecture. But when things go wrong or you're trying to do something a little more specialised outside of basic file storage, ZFS has always felt like an awesome hack on top of Linux rather than an integral part of it's design. Unlike with FreeBSD where the same people managing the kernel and userland are the same people pushing ZFS as the default file system. If Torvalds, Pottering or others held ZoL in the same esteem then I'm sure the edge cases I've described would go away (Linux certainly has the larger developer community).
ZFS as root is completely normal on FreeBSD, is it on Linux? You have tools like zfs-stats, bectl, zfs or dataset-jails, poudriere (packagebuilder) fully integrated with zfs, the list goes on and on. So even when the base of OpenZFS came from ZoL, it's use on freebsd feels much more integrated...or let's call it native.
ZFS relies heavily on Solaris VFS API, which is inherently different from both Linux's VFS and FreeBSD's VFS implementation (e.g., behavior of vnode[1]). Both FreeBSD and Linux implements this VFS API with a layer called Solaris Porting Layer (SPL).
In the original Illumos-based FreeBSD ZFS, this SPL layer was implemented as a kernel module (opensolaris.ko). OpenZFS originally maintain this shim in other repo, but later incorporate this shim into its codebase. FreeBSD port of OpenZFS involved importing SPL layer from FreeBSD tree into OpenZFS. On this part, there's not much difference in nativeness of the port.
However, this SPL layer also serve the purpose of adding one degree of separation between GPL code and CDDL code in order to comply with GPL in order to prevent ZFS code from becoming a derivative of the Linux kernel. The shim in OpenZFS is in three licenses; the Linux part of SPL is GPLv2, the FreeBSD part is 2-BSD, and the part that interacts directly with ZFS code is CDDL.
This is the area where FreeBSD can be more native with regarding to ZFS. Since CDDL is compatible with BSD license, FreeBSD kernel and its userland can integrate directly with ZFS without any licensing issue, e.g., FreeBSD bootloader can simply linked against ZFS, whereas GRUB2 must reimplement a part of ZFS in order to do probing.
[1]: https://wiki.freebsd.org/AndriyGapon/AvgVfsSolarisVsFreeBSD
btrfs is still very rough for things like raid5/6 (where you want to prioritise available capacity), and unfortunately there are lots of reports of recent corruption (even on single disk FSes) every time we have a thread about it on HN. I'm one of those people with recent experience of corruption with btrfs + compression.
ZFS isn't flawless, and the license situation means distribution is more awkward on Linux - except for Ubuntu, who have a different view to other distros on what is allowed with it legally. This means that root on ZFS is a real pain on many distros, and possibly not something you should really do, but ZFS has really solid multi-disk pool support & working + battletested support for things like RAIDZ.
But this isn't linux, this is FreeBSD. The license issues with CDDL & GPL don't apply here, so FreeBSD has native ZFS support. It works well (especially in 13, where it's up to date with the main OSS OpenZFS work), and the installer will quite happily assist you with root on ZFS.
I'd love to use btrfs on root on linux, and I try it on my home server and VMs reasonably often (and this is a xeon + ECC etc, and when I use ZFS/xfs/ext4 I don't get FS issues). I keep finding it's often still fragile unfortunately (and snapshotting is still painful compared to ZFS!).
The only issue I did have was a bad ASM1061-based SATA controller, which would corrupt data in weird ways, throw up alignment errors, generic I/O errors, all kinds of issue. That can hardly be blamed on btrfs.
Because it was a RAID1 pool and a checksumming filesystem, I could switch the affected drive to a known good SATA controller and correct all of the corrupted data, to bring everything back in line. I found it very robust and undramatic. I strongly assume it would have worked more or less the same on ZFS, but ZFS is less flexible when adding disks (have to add new separate vdevs instead of integrating individual drives), so I stick with btrfs.
Don't buy ASM1061-based SATA controllers. At the very least, get something Marvell-based, or an LSI-based SAS controller in IT mode, if you want to get fancy.
For me it's a mix of NVMe drives, SATA SSDs on Intel SATA, or SATA SSDs on LSI SAS HBAs (in IT mode).
It doesn't seem to be pinned to specific hardware, sadly - and the exact same hardware works fine with zfs/ext4/xfs.
But from the impression of the type of hardware you're running, I highly doubt that is the case. And of course ZFS would be affected, too.
At one point it was limited to if I was using compression, but using compression was the major reason I wanted btrfs for that use rather than ext4/xfs.
In theory, yes. But one of the design goals of ZFS was to be resilient against faulty hardware. On paper that seems an impossible task but I've seen first hand just how impressive it is where I had a faulty raid controller which would randomly disconnect HDDs but only under heavy load. It took weeks to debug this -- it was so bad it actually caused Solaris to crash (which made fault diagnosis all the harder). I then switched to FreeBSD, which was a little more stable so enabled me to get a little more meaningful diagnostics and when I realised what the fault was, I was amazed I hadn't actually lost any data. At one point the fault was so bad it completely trashed the superblock but FreeBSD's ZFS tooling meant I could recover that superblock and the entire outage took all of 10 minutes.
On the flip-side, the few times I've used btrfs I've either been left scratching my head at the confusing tooling, or pulling my hair out because of data loss. On one system, the storage pool -- which literally just consisted of one HDD and no clever raiding -- reverted itself by 6 months. I was an early adopter of ZFS and never ever experienced so much as a blip despite running it on hardware that really should have caused ZFS to go tits up. Yet Btrfs would get it's knickers in a twist on stable hardware.
I get my stories here are purely anecdotal but I her the same kinds of stories crop up over and over again from other people too. So I find it very hard to take Btrfs seriously as a ZFS replacement. But then given ZFS is an older and more mature project and ZFS already works pretty damn well, I also question why anyone would want a replacement to ZFS when they could just use ZFS.
Basically just licencing. The great irony is that btrfs was started by Oracle (not sure if they're still involved) before they acquired Sun. A relicensing effort to GPL would probably be better, but, you know, Oracle.
I argued in the past that OpenZFS should have contributors sign a small CLA which permits relicensing to GPL to prepare for this nonetheless, it's a small effort and could save a lot of effort later.
Recovery was quite undramatic once the affected disks were put on a known stable controller. Btrfs-check followed by a scrub got everything back in order.
And btrfs gives me one thing that ZFS can't do (yet): a completely flexible RAID1 storage pool where I can add and remove disks as I want, the only limitation being that no one disk can be larger than half the total pool size. For me, this flexibility is a killer feature.
-Use btrfs JUST for the OS (just use mirror if you have to) nothing else..don't change any switch, don't defrag...don't touch it with the exception of making and restoring/deleting snapshots.
-Use XFS for Data
I guess only facebook and suse are big users.
It's hard to think it's a good proof that btrfs is ready for everyone just because facebook is using it.
And for what it's worth, ZFS development pre-dates Btrfs. You can make all the arguments for Btrfs that you want but ZFS is still the vastly more mature filesystem out of the two. Hence why the few examples people can come up with regards to Btrfs usage are companies with the resources of Facebook (as opposed to ZFS which is used by companies large and small).
Not just the online documentation, but there are really good offline (books) documenting the BSD stack.
Back in 1998 I chosed BSD (openBSD) for my thesis just because there was _a lot_ of reliable information about internals, how to develop, etc.
For Linux the documentation wasn't as good, and had to search too much online for internals, also and it was a moving target and I was afraid of working on top of something that might change while I was working on my project.
Now you can get a lot of information about linux just googling; but if you're offline you can get great *BSD documentation.
While it's great to have friction in order to continuously question the status quo it has huge downsides when you need to focus on the long-term goals and ensure consistency across the stack. (echoes from mythical man month or too many chefs in the kitchen spoiling the broth etc). Linus has done a good job for as long as he could (and still does) but there are limits to what one can achieve as things grow.
Theo de Raadt seems a very similar character (like Poettering and Linus strongly opinionated which isn't a flaw but job-requirement). Theo had an easier time ensuring continuity & consistency because there aren't 25 distributions of OpenBSD under 1 "OpenBSD Foundation" umbrella. The problem was that Poettering (who despite my dislike for how he treats anyone who questions his approach, I still think is a genius) didn't create his own OS from scratch (perhaps something based on his own distro, or genode or whatevs) but hi-jacked Linux for his purpose.
Then there is the problem with Docker/isolation that, as others above have pointed out, is not new in the BSD world and is actually a poor product that constantly breaks things on every update. The BSD world would have laughed docker out of the door and down the street yet on Linux we pretend it's "genius" and we accept it comes not from the community but some outside vendor with terrible record in its own security posture. Pipe shit straight to | sudo bash was the docker way for a long time until they got called out for it and then pretended it never happened. But you can still see their incompetence also in other places such as dockerhub which remains the petri dish of choice for malware, or their latest stunt of forcing people to upgrade.
Compared to BSD's, in Linux we practice a lot of "hype driven software engineering" and the result is abstraction hell, and insecurity. This is visible especially if you just compare apples with apples, e.g. a Linux vs BSD on a server (ignoring all aspects where BSD's are hardly present but Linux is).
Poettering has also pushed for unifying isolation options within systemd to help orchestrate the mess, but it still feels like a lot of duct tape when comparing how all of this is done in BSD.
there are many other topics like eBPF, and how much we're now able to move into the kernel for performance / observability etc ... but I'll stop.
The Linux Standards Base (LSB) perhaps lacked teeth and never fulfilled the potential it could have, but a democracy (or federation of interests) is harder.
Edit: Actually I see that GNOME doesn't require (since 3.30?) systemd: it can be used with just elogind. (Slackware actually recently adopted elogind for KDE and Xfce). Gentoo is another distro that doesn't require systemd (it's actually optional).
I would be interested to hear a source for that because I never heard of such a thing. I heard the exact opposite, that GNOME is still open to keeping things working on BSD. The latest version in FreeBSD is GNOME 3.36.
Unfortunately, getting much less attention than Linux has implications for funding. We're almost half way through the year and haven't reached 10% of the not overly ambitious annual target: https://freebsdfoundation.org/donate/.
int64_t ru_ixrss; /* shared memory size (integral kb CLK_TCK) */
int64_t ru_idrss; /* unshared data size (integral kb CLK_TCK) */
int64_t ru_isrss; /* unshared stack size (integral kb CLK_TCK) */
int64_t ru_inblock; /* block input operations */
int64_t ru_oublock; /* block output operations */
int64_t ru_nsignals; /* signals received */
int64_t ru_msgsnd; /* IPC messages sent */
int64_t ru_msgrcv; /* IPC messages received */
Linux doesn't give you that information. Since FreeBSD does, it's easier to do something like write a reliable network server that monitors worker behavior.They are very good at this.