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.
![](/var/linux_magazin/storage/images/issues/2016/189/snapper/figure-7/673823-1-eng-US/Figure-7_large.png)
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).
![](/var/linux_magazin/storage/images/issues/2016/189/snapper/figure-8/673826-1-eng-US/Figure-8_large.png)
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.
![](/var/linux_magazin/storage/images/issues/2016/189/snapper/figure-9/673829-1-eng-US/Figure-9_large.png)
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
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.