How to Use ZFS Snapshots in Ubuntu 20.04

Easy Ubuntu 20 04 Zfs Snapshots Featured

Ubuntu’s support for ZFS isn’t new in the 20.04 LTS version. What is new is how easy it is to use one of ZFS’s most essential features – snapshots. Thanks to snapshots, you can revert your operating system to an earlier state before any problems occurred. Learn here how to use ZFS snapshots in Ubuntu 20.04.

Install with ZFS

To be able to use ZFS’s features, you must also be using ZFS. This means that during Ubuntu’s installation, during the “Installation type” step, instead of going with the default “Erase disk and install Ubuntu,” you should click on “Advanced features … “

Easy Ubuntu 20 04 Zfs Snapshots Installation Advanced Features

In the window that pops up, select “EXPERIMENTAL: Erase disk and use ZFS” and click OK.

Easy Ubuntu 20 04 Zfs Snapshots Installation Experimental Zfs

With “ZFS selected” showing next to “Advanced features … “, you can proceed with the rest of the installation as usual.

Easy Ubuntu 20 04 Zfs Snapshots Installation Zfs Selected

Automatic Snapshots

With Ubuntu 20.04, you don’t have to do anything to take advantage of ZFS’s snapshot feature. You may notice the feature in action when installing new packages in your favorite terminal, creating symlinks to alternate versions of files, and updating the GRUB menu.

Easy Ubuntu 20 04 Zfs Snapshots Symlinks And Grub

When you do need them, though, to revert your system to an earlier state, they’ll be there for you. Let’s do a test run. Install a package you’d like to try with:

After you’ve tried your new package, you can uninstall it again with apt. For this tutorial, though, you’ll see in the steps that follow how you can revert your whole system to the point before its installation.

Restoring to an Earlier State

Whenever you decide you want to revert your file system to an earlier state, do a restart. After the initial boot screen, you will have to press a different key to access GRUB, depending on your computer’s firmware.

If your computer uses BIOS, you have to keep the Shift key pressed. If it uses UEFI, you must hit Escape after the initial system boot but before the operating system starts loading.

Easy Ubuntu 20 04 Zfs Snapshots Grub

Move to the third entry, “History for Ubuntu 20.04 LTS,” and press Enter.

Easy Ubuntu 20 04 Zfs Snapshots Grub History

Choose the snapshot you want to revert to from the list that appears.

Easy Ubuntu 20 04 Zfs Snapshots Grub History Entries

Choose if you want to revert only the system files to an earlier state, but keep your personal data intact, or if you’d like to turn back time on everything.

Easy Ubuntu 20 04 Zfs Snapshots Grub System And Data

Wait a while for the different versions of files to “remap” in the filesystem. When you next enter your desktop, it will be back to where you left it before the selected snapshot.

Do you like the ZFS snapshots feature in Ubuntu 20.04? Or do you prefer using a combination of Ext4 and a backup tool with similar functionality? Tell us in the comments section below.

Related:

One comment

  1. I tried zfs on an external drive, also as boot. This was an nvme ssd. I had inexplicable errors, e.g. that it could not write at random moments in my photo album. First thought this new ssd was bad. Have been using it as ext4 now, and fine now. Sorry this is anecdotal, I did not investigate more. But I decided zfs was not for me yet.

Leave a Comment

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.