how to delete btrfs snapshot?
sudo btrfs subvolume show /
outputs
/
Name: @
uuid: 1f0da442-cdf3-144c-a4ce-f6c06248cfde
Parent uuid: -
Creation time: 2014-08-16 19:06:51
Object ID: 257
Generation (Gen): 30683
Gen at creation: 6
Parent: 5
Top Level: 5
Flags: -
Snapshot(s):
@apt-snapshot-release-upgrade-utopic-2014-11-28_15:10:02
Now, I want to delete the snapshot @apt-snapshot-release-upgrade-utopic-2014-11-28_15:10:02.
I tried:
sudo btrfs subvolume delete @apt-snapshot-release-upgrade-utopic-2014-11-28_15:10:02
Only got:
Transaction commit: none (default)
ERROR: error accessing '@apt-snapshot-release-upgrade-utopic-2014-11-28_15:10:02'
Solution 1:
I have a set of 3 drives running btrfs for data (not the operating system drive), and after testing it I found that btrfs snapshots behave like subvolumes.
For example, you can create a read-only snapshot like so:
sudo btrfs subvolume snapshot -r /mnt/data/some_dir /mnt/data/@some_dir-snapshot-test
Then, to delete the snapshot again:
sudo btrfs subvolume delete /mnt/data/@some_dir-snapshot-test
Be very careful not to delete the original subvolume! It's very easy to accidentally delete the original subvolume instead of the snapshot if you're not careful. Make sure you have tested backups!