I have a BTRFS filesystem, running Arch Linux x86_64. On that filesystem, I have the top level subvolume (id=5), then inside that I have @root, @home, @snapshots, @swapfile. I want to be able to create a Snapper configuration to automatically snapshot @root and @home to @snapshots. The default seems that it will create a subvolume for its snapshots inside the subvolume I create a configuration for, is there any way to change where it creates the snapshots to?
2 Answers
Well, what I did was :
- mount the Btrfs root volume if not already done (e.g. to
/mnt
) - create the snapper configs as usual; snapper will create the subvolumes
/.snapshots
,/home/.snapshots
etc. - delete these subvolumes and create new ones at the places you like them to be, maybe your Btrfs root (e.g.
/mnt/@SNAPS
,/mnt/@HOMESNAPS
etc.) - create empty folders at the locations where snapper created the subvolumes before (
/.snapshots
,/home/.snapshots
) - add entries to
/etc/fstab
to have the/@SNAPS
subvolume mounted to/.snapshots
,/@HOMESNAPS
to/home/.snapshots
etc.
With this setup, snapper does have access to its hardcoded snapshot destinations while they actually reside in direct subvolumes of the Btrfs top-level.
Sorry, but no. snapper
always creates snapshots within the subvolume it snapshots.
An alternative tool is btrbk. It's configuration allows you to specify where the snapshots are created.
I've been using btrbk
successfully to create periodic snapshots (triggered with a systemd timer) and also within my backup script to transfer snapshots to an external device, while applying a retention policy.