one of the cool features of BTRFS is filesystem-level snapshots. unfortunately, none of the ubuntu flavors uses them by default.
this guide serves for convenient utilizing of BTRFS snapshot and their automation.
in order to use BTRFS features, you must use BTRFS for your root partition, obviously.
during installation, your root partition entry must look like this:
/ btrfs
Note: the sharp #
sign means that the command needs root privileges. you have to run that command either in elevated terminal or using sudo
, eg.:
$ sudo apt install git
# apt update
# apt install git python3 libgtksourceview-3.0-1 gir1.2-gtksource-3.0 python3-dbus python3-setuptools python3-distutils-extra
# apt install snapper
after installation, you need to create initial configuration for root partition
# snapper create-config /
install from git repository:
$ git clone https://github.com/ricardo-vieira/snapper-gui/
$ cd snapper-gui/
# python3 setup.py install
install from git repository:
$ git clone https://github.com/agronick/apt-btrfs-snapper/
$ cd apt-btrfs-snapper/
# python3 setup.py install
a CLI utility for snapshots management. it can list, create, restore, delete snapshots as well as show diff between them.
it is encouraged to read this tutorial.
you need to create a subvolume configuration for your BTRFS partition(s). there must be at least one - root subvolume:
# snapper create-config /
# snapper create --description "before changes"
# snapper list
# snapper diff 2..3
2 and 3 are snapshot numbers as shown in the list command
# snapper undochange 2..3
2 and 3 are snapshot numbers as shown in the list command
a GUI utility in which you can conveniently list snapshots, diffs and configs as well as create them.
a CLI utility and a daemon, which hooks into apt actions. it automatically creates two snapshots before and after every apt install, update and remove action.
it also has convenient 'shortcut' commmands for creating and restoring snapshots as well as deleting snapshots older than X days.
# apt-btrfs-snapper
shows more info