How to use ZFS Snapshots in Ubuntu 20.04

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 .

Picture 1 of How to use ZFS Snapshots in Ubuntu 20.04

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

Picture 2 of How to use ZFS Snapshots in Ubuntu 20.04

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

Picture 3 of How to use ZFS Snapshots in Ubuntu 20.04

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.

Picture 4 of How to use ZFS Snapshots in Ubuntu 20.04

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.

Picture 5 of How to use ZFS Snapshots in Ubuntu 20.04 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.

Ubuntu Ubuntu 20.04

ncG1vNJzZmismaXArq3KnmWcp51ktbDDjK2mZq2jmnq7stJmqqeZoKi1sMDSZqCnZaWXwq%2FA1GZpaWhk