BTRFS snapshot size

  • First you need to enable quota
sudo btrfs quota enable /home
  • You need to wait for BTRFS so scan the filesystem for quota usage, then
sudo btrfs qgroup show /home
  • You get output which looks like this:
qgroupid         rfer         excl
--------         ----         ----
0/5         142.21GiB     89.70MiB
0/410        96.00KiB     96.00KiB
0/2191       17.62GiB        0.00B
0/3237      137.90GiB      4.05GiB

qgroupid is the snapshot ID, rfer is the total size of that snapshot (the size of the parent subvolumes are included), excl is the exclusive space that particular snapshot occupies.

Deleting snapshots

  • You can list all the subvolume by running this:
sudo btrfs subvolume list /home

Note that this will display the link between the BTRFS_SNAPSHOT_ID and SNAPPER_SNAPSHOT_ID.

  • Note that if you are using snapper, you should delete snapshots using:
snapper -c home delete $SNAPPER_ID

You shouldn't delete the snapshot using btrfs subvolume delete, as this will confuse Snapper.

Re-initialise qgroups

If your filesystem has just suffered an episode of catastrophic failure, you might need to re-initialise things. A Snapper rollback can cause it.

for i in $(btrfs qgroup show /home | tail -n+3 | cut -d ' ' -f 1); do btrfs qgroup destroy $i /home; done
btrfs quota disable /home
btrfs quota enable /home