Installed on BTRFS, need help setting up snapshots

So I am using Hefftor Linux (a boutique spin of ArcoLinux) with bspwm. I decided to install on BTRFS so I can get the benefits of snapshots and CoW and the like. Got the install completed and it runs. I installed grub-btrfs and and snapper but I am at a loss what to do next. I checked the subvolume list and @ (root) and @home were created. How do I add @snapshots and set up the system to automatically take snapshots and modify grub so I can rollback to the snapshot if needed?

Easiest way is to simply install Timeshift and maybe also timeshift-autosnap (AUR (en) - timeshift-autosnap) which basically works like zsys and creates automatic snapshots before any pacman operation (you have options how many to keep).

Alternatively, you need to mount the top level root into a directory e.g. /mnt
ˋˋˋ
mount -o subvolid=5 /dev/yourbtrfspartition /mnt
ls /mnt
create btrfs subvolume /mnt/@snapshot
ls /mnt
ˋˋˋ

Then you can set up Snapper or btrbk to take snapshots for you or do it manually. Again I. Would simply use Timeshift as it automatically deletes snapshots as well and sets also everything up in /run/timeshift/backup/ for easy access.

grub-btrfs creates grub boot entries of all your snapshots independent of the way they are taken.

I have some references on my HomePage for btrfs which might be useful for you (Installation guides | Willi Mutschler)

timeshift-autosnap did the trick! Thanks! I expect that the first snapshot will be a bit time consuming and future ones are just deltas?

For some reason it is working in rsync mode not btrfs mode.

If you use btrfs mode in Timeshift then snapshots are instant due to copy on write.
If you use rsync mode then the first one will take long of course.

Open timeshift and change to btrfs mode in the settings.

1 Like

I just did that and manually kicked off a snapshot but is 0 bytes in size. Is that normal?

Yes that is the beauty of btrfs or zfs, it takes a snapshot of your current system. Once you start changing files, adding or removing stuff this snapshot increases in size. But note that now you can always return to this point in time.

https://forum.manjaro.org/t/btrfs-tips-and-tricks/71186/6
I found this thread and particularly the comments by tomz very useful in understanding btrfs

1 Like

Question:
How do I limit the number of snapshots kept by timeshift-autosnap? Considering how many times Arch based distros update I don’t want to consume my drive with snapshots.

By default it keeps only the last 3 snapshots created by timeshift-autosnap (it does not care about the other snapshots you took with e.g. timeshift schedule) . There is a configuration file /etc/timeshift-autosnap.conf where you can change this setting.

As you are on Arch, have a look at the following thread for more information

So my work on this has inspired me to try it out on my main workstation. Here the drive situation is more complex. I would like to use btrfs for all of it but since RAID56 is still broken, those bits will stay as they are.

I have two nVMe drives: one for / and the other for /home. The first drive isn’t a problem, it’s mounting the home drive as a subvolume. Or am I barking up the wrong tree? the btrfs wiki’s section on multiple drives mostly talks about RAID0/1/01/10 and the dire warnings about RAID56. I am not sure how to proceed.

For the record my existing RAID arrays: one internal (LVM RAID5 + Cache Drive +XFS) and one external (HW RAID5 + ext4) will remain untouched.

Your guidance is sought and highly appreciated.

Turns out it was simpler than I expected. After having made two backup copies of my /home folder, the install proceeded thusly:

  1. Boot off installer USB key.
  2. Once booted, launch gparted.
  3. Create new gpt partition table on root drive.
  4. Create efi, root, and swap partitions.
  5. Format efi as fat32 and root as btrfs.
  6. Set flags to esp and boot on efi partition.
  7. Switch to second drive.
  8. Create new ‘gpt’ partition table on home drive.
  9. Create a single partition and format it btrfs.
  10. Exit gparted.
  11. Start calamares.
  12. Proceed with install as normal until you get to drives section.
  13. Choose manual partitioning.
  14. Set the efi partition to mount on /boot/efi/. Do not format.
  15. Set the root partition to mount on /. Do not format.
  16. Set the single partition on the second drive to mount on /home.
  17. Finish the install.
  18. After booting into the system, run an update then install the following
    timeshift, timeshift-autosnap, snapper, and grub-btrfs.
  19. Reboot the system. Open timeshiftand set the target to btrfs. timeshift will create an appropriate target. Disable any automatic backups.
  20. Now, when you do a system update, timeshift-autosnap will take a snapshot of your system before applying updates. The backups are visible inside of timeshift or on the grub menu.
1 Like