There are tools like snapper and btrbk that periodically make snapshots. Since btrfs is a COW filesystem, the live subvolume just stores newer changes on top of the snapshot — it doesn’t need to copy anything until it changes. Only when file data is no-longer referenced is it actually marked free to overwrite. This can make disk usage a bit un-intuitive since you can have large files stuck in snapshots that don’t show up in your live subvolumes but still use up space. It can really save you from serious mess ups and is really cheap in terms of performance. It’s also possible to send snapshots over a network to another machine if you want longer term backups without keeping them on local disks.
But rm -r when you created a snapshot before basically just adds metadata about which files are supposed to be deleted in the current version.
The snapshot still has the old filesystem content.
That also means that when you use up all your space, deleting files actually worsens the problem.
Btrfs snapshots to the rescue!
I’ve been meaning to tinker with Brfs. Is the idea that snapshots live on a separate volume so you can always recover a messed up system?
There are tools like snapper and btrbk that periodically make snapshots. Since btrfs is a COW filesystem, the live subvolume just stores newer changes on top of the snapshot — it doesn’t need to copy anything until it changes. Only when file data is no-longer referenced is it actually marked free to overwrite. This can make disk usage a bit un-intuitive since you can have large files stuck in snapshots that don’t show up in your live subvolumes but still use up space. It can really save you from serious mess ups and is really cheap in terms of performance. It’s also possible to send snapshots over a network to another machine if you want longer term backups without keeping them on local disks.
That would be a separate step (send/receive).
But
rm -rwhen you created a snapshot before basically just adds metadata about which files are supposed to be deleted in the current version. The snapshot still has the old filesystem content.That also means that when you use up all your space, deleting files actually worsens the problem.