How to use ZFS in Ubuntu 19.10

Ubuntu 19.10 includes one feature that should have every user and admin overcome with the feels.

How to use ZFS in Ubuntu 19.10 Ubuntu 19.10 includes one feature that should have every user and admin overcome with the feels.

Hello, Ubuntu. It's been quite some time since you've brought us something truly exciting with a new release. Oh sure, a while back you shifted away from Unity and defaulted to GNOME, and that was a bold move--one I believe the majority of users are thankful for. Outside of that, the various releases over the past few years have been somewhat underwhelming.

But that all ends with 19.10 (Eoan Ermine). No matter what other new features find their way into the release, they are all overshadowed by one addition that is long overdue. That feature is ZFS. 

SEE: 10 free alternatives to Microsoft Word and Excel (TechRepublic download)

What is ZFS? 

ZFS is a combined file system and logical volume manager that is scalable, supplying support for high storage capacity and a more efficient data compression, and includes snapshots and rollbacks, copy-on-write clones, continuous integrity checking, automatic repair, and much more. 

So yeah, ZFS is a big deal, which includes some really great features. But out of those supported features, it's the snapshots and rollbacks that should have every Ubuntu user/admin overcome with a case of the feels.

Why? Imagine something has gone wrong. You've lost data or an installation of a piece of software has messed up the system. What do you do? If you have ZFS and you've created a snapshot, you can roll that system back to the snapshot where everything was working fine.

Although the concept isn't new to the world of computing, it's certainly not something Ubuntu has had by default. So this is big news.

How does it work?

Note: I've been working with the final release candidate, so the ZFS support is still in the experimental phase. Even so, it's worked tremendously.

When installing Ubuntu 19.10, you are given the option of using the ZFS file system (Figure A). Select that option and then click Install Now.

Figure A

zfsa.jpg

Installing Ubuntu 19.10 with ZFS.

When the installation completes, reboot and log in. At first blush, you won't notice anything different with the ZFS system. In fact, everything just works, as you've come to expect with Ubuntu Linux. 

How do you use ZFS? 

I'm going to show you how to create a snapshot, make a change, and the roll back that snapshot. 

The first thing you must do is find the name of the ZFS dataset you want to use. I'm going to make a snapshot of my home directory. To find the name of the home dataset, issue the command:

zfs list

You should see a complete list of your datasets (Figure B).

Figure B

zfslist.jpg

A listing of datasets.

The dataset I'll be using is named rpool/USERDATA/jack_bwcn4u. It is important that you know the name of the dataset, as you cannot simply take a snapshot using the directory name or path. To create a snapshot named WED101619, the command would be:

sudo zfs snapshot rpool/USERDATA/jack_bwcn4u@WED101619

The snapshots generally complete very quickly, regardless of how much data is stored in the location.

Now, let's make a change. We'll delete the Documents folder in my home directory with the command:

rm -rf ~/Documents

The Documents folder is now gone (Figure C).

Figure C

zfsb.jpg

My Documents folder is gone!

Imagine that folder contained all of your work, school, or research documents? If you didn't have a backup (which you should), you might find yourself throwing a fit or 12. What do you do? Since you took a snapshot, you can roll it back with the command:

sudo zfs rollback rpool/USERDATA/jack_bwcn4u@WED101619

Give the command time enough to rollback the changes and viola! The Documents folder has returned (Figure D).

Figure D

zfsc.jpg

My Documents folder is back!

A glimpse of things to come

Of course there is so much more ZFS can do (such as cloning snapshots and replication), but this gives you an idea of what's coming for the next release of Ubuntu Linux. The full release will be available on October 17, 2019. For those that are curious, the addition of ZFS for Ubuntu 19.10 means even greater things are yet to come. 

ZFS is just the beginning of a much greater system, developed by Canonical, called Zsys. When Zsys is finally released, admins will be able to run multiple ZFS systems in parallel on the same machine, get automated snapshots, manage complex ZFS dataset layouts separating user data from system and persistent data, and more.

So yes, the addition of ZFS on Ubuntu should be cause for every Ubuntu user and admin to get very, very excited. 

It's about time.

Also see

eominhero.jpg

Image: Canonical