- change to root user
su -
# unmount and remove /.snapshots directory
umount /.snapshots
rm -r /.snapshots
snapper -c root create-config / # create snapper config
btrfs subvol del /.snapshots # remove extra snapshot subvolume
mkdir /.snapshots
mount -a # mount /.snapshots, it should be in /etc/fstab already
chmod 750 /.snapshots
chmod a+rx /.snapshots
chown :$USER /.snapshots- modify snapper config
vim /etc/snapper/configs/root-
ALLOW_USERS="aloks"replace
alokswith usernameTIMELINE_MIN_AGE="1800"TIMELINE_LIMIT_HOURLY="5"TIMELINE_LIMIT_DAILY="7"TIMELINE_LIMIT_WEEKLY="0"TIMELINE_LIMIT_MONTHLY="0"TIMELINE_LIMIT_YEARLY="0"
-
enable and start services
systemctl enable --now snapper-timeline.timersystemctl enable --now snapper-cleanup.timersystemctl enable --now grub-btrfsd.service(if using grub)- snapshot will directly be added to grub bootloader list
-
snapper -c root list0is current system
-
install
paru -S --needed snap-pac rsync
paru -S --needed snap-pac-grub # if using grub
paru -S --needed snapper-gui # optionalsudo mkdir /etc/pacman.d/hookssudo vim /etc/pacman.d/hooks/95-bootbackup.hook
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Path
Target = usr/lib/modules/*/vmlinuz
[Action]
Depends = rsync
Description = Backing up /boot...
When = PostTransaction
Exec = /usr/bin/rsync -a --delete /boot /.bootbackup- create first snapshot
snapper -c root create -c timeline -d "first snapshot"snapper -c root list1is the firstSnapshot- check snapshot entry in grub [read-only]
mount /dev/nvme0n1p2 /mnt- here nvme0n1p2 is the partition with btrfs subvolumes
- check subvolumes
ls /mnt
- find the number of the snapshot you want to recover
grep -r '<date>' /mnt/@snapshots/*/info.xmlgrep -r '<description>' /mnt/@snapshots/*/info.xml
mv /mnt/@ /mnt/@.brokenORrm -rf /mnt/@- removing can take 5-10 sec
-
btrfs subvol snapshot /mnt/@snapshots/NUM/snapshot /mnt/@
- here
NUMis snapshot number
- here
reboot