Restore Btrfs files at the push of a button with Snapper
Ubuntu and Debian with ext4 and Btrfs
On Debian sid/Siduction and Ubuntu, I tried to get Snapper and the Snapper GUI [8] running using ext4. Several attempts delivered mixed results that do not suggest a predictable experience; therefore, I would advise against the use of ext4 with Snapper right now. Because I had already installed all components and configurations for Snapper and the Snapper GUI, I decided to convert the existing ext4 filesystem to Btrfs.
The Debian instructions on how to perform such a conversion [9] were useful. After a subsequent reboot, Snapper and the Snapper GUI worked well together. Note, however, that it is faster to set up a new system with Btrfs than to convert from ext4. The process described here was more of an exercise to see whether the conversion could work at all.
While re-installing Ubuntu with Btrfs as the filesystem on a 30GB partition, I took advantage of putting the system under the control of LVM [10]. If you want to do this, select the Use LVM checkbox during installation, then right-click the partitions below Others at the bottom, which lets you choose Btrfs as the filesystem (Figure 7). The rest of the installation proceeds as usual. After restarting the installed system, you should first upgrade it, because each new kernel of late has introduced optimizations for Btrfs.
Next, install the snapper package; libpam-snapper, if needed, which launches Snapper when you log in to the system; and apt-btrfs-snapshot, which ensures that a snapshop is created after every upgrade with Apt. Then install snapper-gui
. As a precondition, you only need to install the git and python3-setuptools packages on a recent Ubuntu. Then, type
git clone --depth=1 https://github.com/ricardomv/snapper-gui.git cd snapper-gui/ sudo python3 setup.py install sudo snapper create-config / sudo snapper-gui
to download the code for and install the GUI, create a basic configuration for snapshots of the entire system, and launch the GUI, which is relatively self-explanatory with its sparse controls (Figure 8).
You can create configurations and open, remove, and view the differences between snapshots. You use the left Ctrl key to select the snapshots, and the changes are then displayed when you click on Changes (Figure 9). All told, the Snapper GUI offers roughly the same features as the YaST module in openSUSE. In the end, however, with a little practice, managing Snapper in a terminal window is not rocket science.
Snapper on Ubuntu, Debian, and probably other operating systems uses the same configuration file for snapshots as on openSUSE. Before you start production operation, you will want to check all the configurations you created in /etc/snapper/configs and modify them to match Listing 1 or to suit your own needs. All further management steps are as already described; the commands described for openSUSE also work on Debian and Ubuntu.
Although I chose to use LVM, it is not mandatory because Btrfs already has LVM functionality built in. Setting it up in this case can be viewed as more of a test as to whether the duplicate functions would interfere with each other, which could not be proved in the lab. An error with the apt-btrfs-snapshot package, which is supposed to ensure that a snapshot is automatically created after every upgrade with Apt, currently prevents it from working; therefore, before a system upgrade, you should use the command line or the GUI to create a snapshot.
Conclusions
Snapper optimizes the Btrfs snapshot feature, making it a valuable helper on systems subject to continuous change, such as developers and users of rolling release distributions. The software provides a valuable service by letting you roll back to a prior state before upgrading.
If you operate a stable system and do not install a lot of software daily, it is worthwhile calculating Snapper's overhead. Under certain circumstances it might be advisable to disable the snapshots launched every hour by cron and to only use automated snapshots when installing or upgrading.
The stability of Btrfs is an important factor. During the tests on three operating systems, more than 100 snapshots were created automatically and manually; they were compared, rolled back, and used to launch snapshot systems in GRUB. Under Btrfs, Snapper and the Snapper GUI on Ubuntu were stable; no errors endangered the data in any way. All the same, you should remember that Snapper is not a replacement for complete backups: In fact, it is more like the well-known Windows System Restore feature.
Infos
- Btrfs: http://en.wikipedia.org/wiki/Btrfs
- ZFS: https://en.wikipedia.org/wiki/ZFS
- Snapper in Arch: https://wiki.archlinux.org/index.php/Snapper#Create_a_new_configuration
- Snapper configuration: http://snapper.io/manpages/snapper-configs.html
- SUSE documentation for Snapper: https://www.suse.com/documentation/sles-12/book_sle_admin/data/sec_snapper_config.html
- Snapper man page: http://snapper.io/manpages/snapper.html
- Rolling back files: https://www.suse.com/documentation/sles-12/book_sle_admin/data/sec_snapper_snapshot-boot.html
- snapper-gui: https://github.com/ricardomv/snapper-gui
- Debian how-to: https://www.debian-administration.org/article/675/How_to_convert_a_Wheezy_or_newer_system_to_btrfs
- LVM: https://en.wikipedia.org/wiki/Logical_volume_management
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Direct Download
Read full article as PDF:
Price $2.95
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Find SysAdmin Jobs
News
-
OpenMandriva Lx 23.03 Rolling Release is Now Available
OpenMandriva "ROME" is the latest point update for the rolling release Linux distribution and offers the latest updates for a number of important applications and tools.
-
CarbonOS: A New Linux Distro with a Focus on User Experience
CarbonOS is a brand new, built-from-scratch Linux distribution that uses the Gnome desktop and has a special feature that makes it appealing to all types of users.
-
Kubuntu Focus Announces XE Gen 2 Linux Laptop
Another Kubuntu-based laptop has arrived to be your next ultra-portable powerhouse with a Linux heart.
-
MNT Seeks Financial Backing for New Seven-Inch Linux Laptop
MNT Pocket Reform is a tiny laptop that is modular, upgradable, recyclable, reusable, and ships with Debian Linux.
-
Ubuntu Flatpak Remix Adds Flatpak Support Preinstalled
If you're looking for a version of Ubuntu that includes Flatpak support out of the box, there's one clear option.
-
Gnome 44 Release Candidate Now Available
The Gnome 44 release candidate has officially arrived and adds a few changes into the mix.
-
Flathub Vying to Become the Standard Linux App Store
If the Flathub team has any say in the matter, their product will become the default tool for installing Linux apps in 2023.
-
Debian 12 to Ship with KDE Plasma 5.27
The Debian development team has shifted to the latest version of KDE for their testing branch.
-
Planet Computers Launches ARM-based Linux Desktop PCs
The firm that originally released a line of mobile keyboards has taken a different direction and has developed a new line of out-of-the-box mini Linux desktop computers.
-
Ubuntu No Longer Shipping with Flatpak
In a move that probably won’t come as a shock to many, Ubuntu and all of its official spins will no longer ship with Flatpak installed.