How to use ZFS Snapshots in Ubuntu 20.04

Ubuntu support for ZFS is nothing new in version 20.04 LTS. What's new is how easy it is to use one of the most important ZFS features - Snapshots.

Thanks to Snapshots, you can revert your operating system back to the state it was in before any crashes occurred. Let's learn how to use ZFS Snapshots in Ubuntu 20.04 through the following article!

Install ZFS

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

How to use ZFS Snapshots in Ubuntu 20.04 Picture 1How to use ZFS Snapshots in Ubuntu 20.04 Picture 1

In the pop-up window, select EXPERIMENTAL: Erase disk and use ZFS and click OK.

How to use ZFS Snapshots in Ubuntu 20.04 Picture 2How to use ZFS Snapshots in Ubuntu 20.04 Picture 2

With ZFS selected displayed next to Advanced features…, you can proceed with the rest of the installation as you normally would.

How to use ZFS Snapshots in Ubuntu 20.04 Picture 3How to use ZFS Snapshots in Ubuntu 20.04 Picture 3

Try to install a new package

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

However, when you need them to revert the system to an earlier state, they are there for you to use. Let's run a test. Install a package you want to try out:

sudo apt install PACKAGE_NAME

After trying out the new package, you can uninstall it using apt. For this tutorial, however, you'll see in the steps to follow in order to be able to revert your entire system back to where it was before the installation.

Restore to the previous state

Whenever you decide you want to revert your file system to its original state, reboot. After the initial boot screen, you'll have to press another key to access GRUB, depending on your computer's firmware.

If the computer uses BIOS, you must hold down the Shift key. If it uses UEFI, you have to press Escape after the system boot starts but before the operating system starts to load.

Scroll to the third item History for Ubuntu 20.04 LTS and press Enter.

How to use ZFS Snapshots in Ubuntu 20.04 Picture 4How to use ZFS Snapshots in Ubuntu 20.04 Picture 4

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

Choose whether you only want to revert system files to their previous state but keep your personal data intact or if you want to go back in time for everything.

How to use ZFS Snapshots in Ubuntu 20.04 Picture 5How to use ZFS Snapshots in Ubuntu 20.04 Picture 5 Choose one of the revert options

Wait a while for different versions of the file to 'remap' in the file system. When you advance to the next screen, they will return to their previous position.

4 ★ | 5 Vote