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 … “
In the window that pops up, select “EXPERIMENTAL: Erase disk and use ZFS” and click OK.
With “ZFS selected” showing next to “Advanced features … “, you can proceed with the rest of the installation as usual.
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.
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.
Move to the third entry, “History for Ubuntu 20.04 LTS,” and press Enter.
Choose the snapshot you want to revert to from the list that appears.
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.
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.