VOOZH about

URL: https://thenewstack.io/how-to-create-and-destroy-zfs-snapshots-on-ubuntu-19-10/

⇱ How to Create and Destroy ZFS Snapshots on Ubuntu 19.10 - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2019-10-22 09:49:50
How to Create and Destroy ZFS Snapshots on Ubuntu 19.10
tutorial,
Linux / Storage

How to Create and Destroy ZFS Snapshots on Ubuntu 19.10

A test drive of the ZFS file system that has been recently added to Ubuntu.
Oct 22nd, 2019 9:49am by Jack Wallen
👁 Featued image for: How to Create and Destroy ZFS Snapshots on Ubuntu 19.10

As we noted last week, Ubuntu 19.10 has officially arrived and it brings along with it a number of really exciting features. Although the majority of those new options target desktop users, there is one particularly exciting feature that will benefit both desktop and server users. That feature is ZFS support.

First developed by Sun Microsystems for its Solaris Unix distro, ZFS is a combination 128-bit file system and logical volume manager that offers the following features:

  • Is scalable.
  • Offers support for high storage capacity and more efficient data compression.
  • Includes snapshots and rollbacks.
  • Supports copy-on-write clones.
  • Does continuous integrity checking and automatic repair.
  • 128-bit addressing
  • And much more.

Ask any admin and they’ll agree that the addition of ZFS is a big deal for Ubuntu. Why? The snapshots and rollback features alone are worth the price of entry (which, by the way, is free). With this feature, admins can roll back their systems to a working state (or a state that included accidentally deleted data). That’s quite a big deal.

Of course snapshots and rollbacks aren’t a new thing. In fact, many platforms have included this tool for years. So maybe Ubuntu is a bit behind the curve on this. But for anyone who uses Ubuntu this is a case of “better late than never.”

But how does ZFS work on Ubuntu? I’m glad you asked. Let me show you.

A Caveat

Before you dive into this, know that ZFS support in Ubuntu 19.10 is experimental. Although I’ve found it to be incredibly stable, you might think twice about using it in a production environment (until it is no longer listed as “experimental”).

Also, note that ZFS support is currently only offered during the desktop version installation. That doesn’t mean you cannot add support for the filesystem on the server version, but it’s not quite as simple. Because of this, I’ll be demonstrating on the desktop version of Ubuntu 19.10.

Installation

The first step is to enable ZFS at the install time of Ubuntu 19.10. During the installation, you will find a new option in the Installation type phase (Figure 1).

👁 Image

Figure 1: Selecting the ZFS option during installation.

Once the installation completes, reboot and log in.

If you’re using the server version of Ubuntu 19.10, you can always install ZFS support with the command:

sudo apt-get install zfsutils-linux

Of course, should you go that route, you’ll have to take a few extra steps (such as creating datasets). With the desktop installation, you’ll find your entire directory hierarchy is made up of ZFS datasets, so there’s much less work to do.

First Steps with ZFS

Once you’ve logged into the desktop, you’ll want to open a terminal window and get a listing of your datasets. With Ubuntu installations that don’t use ZFS, you’d typically work with directory paths like /home/jack or /usr/local/. That’s not the case with ZFS-enabled systems. Instead, they work with datasets. A dataset is a type of filesystem that shares a storage pool (the most basic building block of ZFS).

To find your datasets, issue the command:

zfs list

As you can see (in Figure 2), every directory is either found in the bpool (boot) or rpool (root) pool. 

👁 Image

Figure 2: Our dataset listing.

Let’s work with a user’s home directory. In this case, the dataset rpool/USERDATA/jack_bwcn4u.

Creating a Snapshot

The first thing we’re going to do is create a new snapshot of the /home/jack directory (which, remember, is the rpool/USERDATA/jack_bwcn4u dataset). Let’s say we want to create a snapshot tagged with today’s date. The command for this would be:

sudo zfs snapshot rpool/USERDATA/jack_bwcn4u@FRIDAY10-18-19

Of you could include the date command like so:

sudo zfs rollback rpool/USERDATA/jack_bwcn4u@`date +%F`

To verify that your snapshot was taken, issue the command:

zfs list -t snapshot

You should see all current snapshots listed (Figure 3).

👁 Image

Figure 3: Our new snapshot has been created.

Rolling Back a Snapshot

Let’s say, for whatever reason, a directory was accidentally deleted out of that home directory. What do you do? Fortunately, you’ve taken a snapshot and can roll that snapshot back, such that the deleted directory returns.

First, let’s delete the ~/Documents directory with the command:

rm -rf /home/jack/Documents

Issue the ls command and you can see the Documents directory is gone (Figure 4).

👁 Image

Our Documents directory has been deleted.

Now we’ll roll back the Friday snapshot to recover that directory. To do this, issue the command:

sudo zfs rollback rpool/USERDATA/jack_bwcn4u@FRIDAY10-18-19

After the command completes, issue ls again to see that Documents has returned (Figure 5).

👁 Image

Figure 5: Documents is back.

Destroying Snapshots

Let’s say you’ve created a number of snapshots, or a particular snapshot has either corrupt or missing data. You might want to delete that snapshot. Let’s say we want to delete the rpool/USERDATA/jack_bwcn4u@FRIDAY10-18-19 snapshot. To do that, the command would be:

sudo zfs destroy rpool/USERDATA/jack_bwcn4u@FRIDAY10-18-19

Once you’ve destroyed a snapshot it cannot be retrieved, so use that command with care. If you happen to have a particularly important snapshot that you don’t want destroyed, you can place a hold on it. To place a hold on our rpool/USERDATA/jack_bwcn4u@FRIDAY10-18-19 snapshot,  you would issue the command:

sudo zfs hold keep rpool/USERDATA/jack_bwcn4u@FRIDAY10-18-19

Now if you try to destroy that snapshot, you’ll see an error (Figure 6).

👁 Image

Figure 6: Cannot destroy this snapshot.

To destroy a held snapshot, you have to add the -d option like so:

sudo zfs destroy -d rpool/USERDATA/jack_bwcn4u@FRIDAY10-18-19

That’s it, the held snapshot is gone.

And that’s the basics of creating and destroying snapshots with the newly added ZFS feature in Ubuntu 19.10. Give this a try on a testing environment and see how well it works. So far I’ve only discovered one issue that, when trying to roll back a snapshot, I had to reboot the machine before the rollback command would successfully run. Outside of that one issue, it’s been smooth sailing with ZFS and Ubuntu 19.10.

TRENDING STORIES
Jack Wallen is what happens when a Gen Xer mind-melds with present-day snark. Jack is a seeker of truth and a writer of words with a quantum mechanical pencil and a disjointed beat of sound and soul. Although he resides...
Read more from Jack Wallen
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.