I messed up parts of my home directory and want to be better prepared next time. Can someone explain Btrfs snapshots versus backups in simple terms, and where I should start?
How are Btrfs snapshots different from backups?
Answers
Think of a snapshot as a saved view of a Btrfs subvolume at a particular moment. You can use it to recover an older version of a file after an accidental edit or deletion.
It starts out sharing data with the original, so making one is usually quick and doesn't require another full copy. As files change, the old and new versions can take up extra space. A snapshot on the same drive won't save you if that drive fails.
Reply to this answer
For a backup, put a separate copy of your home directory on another drive. That gives you a way to recover if the original drive dies, not just if you delete something by mistake.
Set it to run regularly and check that you can restore a file from it. Keeping older versions is handy if you don't notice a mistake right away.
Reply to this answer
One detail that trips people up: a Btrfs snapshot covers a subvolume, not necessarily everything that happens to appear underneath a directory. Nested subvolumes aren't automatically included in the parent subvolume's snapshot.
Before setting up snapshots, check which subvolume actually contains your home directory and whether any important folders are separate subvolumes. A tool configured to snapshot only the root subvolume may not protect your home files.
5u!mugtree_763:
That explains why a root snapshot alone might not help with the stuff I messed up in home. I'll check how it's laid out first.
Reply to this answer
You don't have to pick just one. Local snapshots are convenient for quick rollbacks, while a separate backup covers problems the local drive can't survive. Both need to be set up before the mistake you want to recover from.
Reply to this answer
Add your answer
Answers are reviewed before publication.
5j!chalktray_804:
So it's not just a list of changes. The snapshot gives you a view of the files as they were when it was taken.