19

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'
David S.
  • 1,036
  • 3
  • 19
  • 39

2 Answers2

12

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!

2

Here is good answer

The snapshot exists in the real root of the filesystem, which is not what you have mounted in /. You have the /@ subvolume mounted in /, so there is no such file with that name. You have to mount the real root volume somewhere and use that path to reference the snapshot.

Or you can use apt-btrfs-snapshot delete instead.