Excerpt from man: Snapper is a command-line program for filesystem snapshot management. It can create, delete and compare snapshots and undo changes done between snapshots.
Snapper never modifies the content of snapshots. Thus snapper creates read-only snapshots if supported by the kernel. Supported filesystems are btrfs as well as snapshots of LVM logical volumes with thin-provisioning.
This is my notes. Use at your own risk.
Usage ๐
snapper list
snapper restore <number>
Set default subvolume ๐
- 
List subvolume on filsystem.
btrfs sub list /ID 256 gen 15137 top level 5 path home ID 257 gen 11927 top level 5 path root - 
Set default subvolume for the mounted filesystem to the
rootsubvolume.btrfs sub set-default 257 / - 
Remove subvolume from
/etc/fstabsince it’s now default.sed -i 's/subvol=root,//' /etc/fstab - 
Update grub to use the default volume. Use
SUSE_BTRFS_SNAPSHOT_BOOTINGgrub config to avoid adding root subvolume to the grub kernel parameters.grep -q SUSE /etc/sysconfig/grub || \ echo SUSE_BTRFS_SNAPSHOT_BOOTING=true | \ sudo tee -a /etc/sysconfig/grub - 
Update grub config. This updates grub configuration on an EFI system.
grub2-mkconfig > /boot/efi/EFI/fedora/grub.cfg 
Install and configure snapper ๐
- 
Install snapper.
dnf install snapper - 
Add default snapper configuration.
snapper create-config / - 
Keep number of
NUMBERsnapshots to3.sed -Ei 's/(NUMBER_LIMIT)=(.*)/\1="3"/' /etc/snapper/configs/root - 
Keep number of
IMPORTANTsnapshots to3sed -Ei 's/(NUMBER_LIMIT_IMPORTANT)=(.*)/\1="3"/' /etc/snapper/configs/root - 
Keep number of
TIMELINEsnapshot to one each day for 7 days.sed -Ei 's/(TIMELINE_LIMIT_HOURLY)=(.*)/\1="0"/' /etc/snapper/configs/root sed -Ei 's/(TIMELINE_LIMIT_DAILY)=(.*)/\1="7"/' /etc/snapper/configs/root sed -Ei 's/(TIMELINE_LIMIT_WEEKLY)=(.*)/\1="7"/' /etc/snapper/configs/root sed -Ei 's/(TIMELINE_LIMIT_MONTHLY)=(.*)/\1="0"/' /etc/snapper/configs/root sed -Ei 's/(TIMELINE_LIMIT_YEARLY)=(.*)/\1="0"/' /etc/snapper/configs/root - 
Enable snapper.
systemctl enable snapper-boot.timer --now systemctl enable snapper-cleanup.timer --now systemctl enable snapper-timeline.timer --now 
Example output ๐
snapper --iso list
 # | Type   | Pre # | Date                | User | Cleanup  | Description           | Userdata     
---+--------+-------+---------------------+------+----------+-----------------------+--------------
0  | single |       |                     | root |          | current               |              
2  | single |       | 2020-08-25 17:10:57 | root | number   | rollback backup       | important=yes
4  | single |       | 2020-08-25 17:13:49 | root | number   | rollback backup of #3 | important=yes
5* | single |       | 2020-08-25 17:13:49 | root |          |                       |              
6  | single |       | 2020-08-25 17:31:16 | root | number   | boot                  |              
7  | single |       | 2020-08-25 18:00:56 | root | timeline | timeline              |              
8  | single |       | 2020-08-25 18:11:41 | root | number   | boot                  |              
9  | single |       | 2020-08-25 19:00:48 | root | timeline | timeline              |              
Highlighted current running snapshot.