Ubuntu and ZFS on Linux [and how to get it right]

It seems like only yesterday that I read Jeff Bonwick’s blog entry “ZFS: The Last Word in Filesystems”. It was Halloween of 2005 that ZFS was released for Sun Microsystem’s Solaris, and the filesystem was very well received. For the readers not familiar with ZFS, it is a combined all-purpose filesystem and volume manager. It simplified data storage management while also offering the most advanced features of the time. Such technologies include drive pooling with software RAID support, file snapshots, in-line data compression, data deduplication, built-in data integrity, advanced caching (to DRAM and SSD), and more. Today, the ZFS trademark and technology is owned and maintained by the Oracle Corporation.

Also in 2005, Sun Microsystems introduced OpenSolaris. Now a defunct project, OpenSolaris was a fully functional Solaris operating system built entirely from open source, which included ZFS, and all of which were re-licensed to the Common Development and Distribution License (CDDL), a weak copyleft license based on the Mozilla Public License (MPL). Although open source, ZFS and anything else under the CDDL was, and supposedly still is, incompatible with the GNU General Public License (GPL).

To avoid licensing infringements, the earliest incarnations of ZFS on Linux were written for the Filesystem in Userspace (FUSE). This prevented the technology from touching the Linux kernel. It also added its fair share of limitations. Being in userspace, it never could really measure up to its Solaris and FreeBSD counterparts. Over time, some of the FUSE implementations were highly neglected and in some cases abandoned. In 2008, the “ZFS on Linux” project changed everything by developing an in-kernel implementation of ZFS. Since its conception, the project was met with a lot of resistance (and criticism) from within the Linux community, all relating to licensing. Now, let us fast-forward to the present. A few years ago, Canonical, the parent company of the Ubuntu Linux distribution released Ubuntu 16.04 with pre-built ZFS modules.

In even more recent news (about 2 weeks ago), Canonical announced that they will be enhancing support for ZFS on Ubuntu by:

We want to support ZFS on root as an experimental installer option, initially for desktop, but keeping the layout extensible for server later on. The desktop will be the first beneficiary in Ubuntu 19.10. Note the use of the term ‘experimental’ though!

Other noteworthy features include:

  • We are shipping ZFS On Linux version 0.8.1, with features like native encryption, trimming support, checkpoints, raw encrypted zfs transmissions, project accounting and quota and a lot of performance enhancements. You can see more about 0.8 and 0.8.1 released on the ZOL project release page directly.
  • We backported (and will continue to backport) some post-release upstream fixes as they fit, to provide the best user experience and reliability.
  • We added a new support in the GRUB menu. A small preview is available below and a more detailed blog post will be presented later on.

All awesome news!

I was one of the early adopters of ZFS and even more so, when it became part of and fully integrated into the Sun Solaris 10 operating system in 2006. It was [and still is] an exciting volume manager that boasted a ton of production grade features and functionalities. Shortly after this time, OpenIndiana became a thing and from the project, OpenSolaris images were spun and made available for general and end-user consumption. What this meant was that ZFS was more accessible to those willing to experiment with it. OpenSolaris was fitted with a user-friendly version of the GNOME2 desktop environment and ZFS was fully integrated into said environment and manageable from both the command-line and the graphical desktop. Mastering ZFS from the command-line was one thing, but what made the experience even better was the ability to do similar tasks from GNOME.

The Time Slider

In some ways, ZFS on Linux still falls short from the ZFS on Solaris. It is fully ingrained in the Solaris ecosystem, from the boot environment all the way to the user experience. The first thing that comes to mind is its customizable snapshot support. A snapshot is the state of a particular system at a particular point in time. In the case of ZFS, this concept is directed toward file level state. ZFS uses a copy-on-write transaction model. Blocks containing active data are never overwritten in place. For every write, a new block is allocated, and the modified data is written to it. All metadata blocks referencing the original data block are also updated to reflect this change and then reallocated, keeping the original metadata contents unmodified in their original place. This approach makes it possible to enable file snapshots.

Snapshot Customization through the Time Slider Manager
Figure 1: Snapshot Customization through the Time Slider Manager

For example, with writeable snapshot support, Solaris has simplified the recovery of a corrupted operating system, where by using boot environment specific utilities (beadm), one easily can boot in to the previously working snapshot image of the operating system and reconfigure it as the default boot image. The process is relatively painless.

Built right in to Nautilus, the official file manager of the GNOME Desktop Environment, is the Time Slider visualization feature. With snapshots enabled, a user is then able to navigate to the enabled directories and click the Time Slider box, which then will produce a visual representation of all the snapshots taken on that particular directory.

Snapshot Visualization Using Nautilus Showing the Present
Figure 2: Snapshot Visualization Using Nautilus Showing the Present

Let’s say you need an earlier revision of a document or to retrieve a now-deleted file. Using the Time Slider, you can go back in time and do just that, with ease.

Snapshot Visualization Using Nautilus Showing the Past
Figure 3: Snapshot Visualization Using Nautilus Showing the Past

Of course these Time Slider features are more intended for use on the Desktop versions of a particular distribution but either way, they would definitely be a nice-to-have.

The Boot Environment Manager

Yes, the Ubuntu team have and still are making adjustments to GRUB to better support ZFS. Back in my days of using Solaris [and OpenSolaris], I enjoyed using a command-line utility called beadm. From the man page:

The beadm command is the user interface for managing ZFS Boot Environments (BEs). This utility is intended to be used by system administrators who want to manage multiple Oracle Solaris instances on a single system.

beadm was ported to FreeBSD but an official port does not exist for Linux. I have found side projects and new projects but none of them are official.

Anyway, using beadm, one is able to manage the boot environment on top of a ZFS file system. For instance, if I ran a system update but one or more packages place my operating system into an inconsistent state, I would then use this utility to point GRUB to boot from a previously known working snapshot image. No manual hacking of a grub.cfg file required.

Automated System Update Snapshots

This does not need an explanation. There should be a simplified way where a user can enable the package manager to capture a system snapshot just before a system [or package] update. If the update hoses the system, then using utilities [such as beadm], one could revert to the same working snapshot.

Other Things That Should Be Done

Another [list of suggested and] desktop focused set of features would be to implement a method to easily enable/ disable and overall manage additional ZFS functions such as data compression and data deduplication from a graphical interface. Or maybe one can tune the ARC in DRAM or the L2ARC to a local SSD from within the same graphical environment.

Adding root support for ZFS is a wonderful next step for the Ubuntu distribution. However, I am more intrigued to see what comes next in the integration of ZFS from within the Ubuntu operating environment.
 

2 Replies to “Ubuntu and ZFS on Linux [and how to get it right]”

  1. Thanks for covering. Please be aware that the OpenZFS project is working to standardize ZFS across ALL operating systems and bring feature parity to all.

Comments are closed.