]> Clearing down snapshot directories 🌐:aligrant.com

Clearing down snapshot directories

Alastair Grant | Monday 20 April 2015

Snapper is included with openSUSE and manages snapshots of your file system. When you setup a BTRFS directory to snapshot it'll create a .snapshots subvolume, inside are numbered directories which in turn have a snapshot subvolume with the actual snapshot.

If for whatever reason you need to wipe out your snapshot directory and cannot use the snapper tool - e.g. if you've copied the snapshots from another disk or something, then you need to clear it manually. You can't "rm -rf" as the snapshot directories are sub-volumes, and you can't just delete the .snapshots subvolume as it contains data. Argh.

Still, this is a quick and easy way of doing it - to be run from your .snapshots directory:

find . -max-depth 1 -type d | xargs -i btrfs subvolume delete '{}/snapshot'



Breaking from the voyeuristic norms of the Internet, any comments can be made in private by contacting me.