If you want to get the size of your BTRFS snapshots you would probably use btrfs qgroup show
. This only shows you a list of IDs and the sizes are in bytes. I wrote a script that will convert the sizes from bytes to kilobytes, megabytes or gigabytes. It will combine the IDs with the name of each snapshot or subvolume from btrfs subvolume list
to make each row a lot more meaningful.
In the end instead of seeing a list like this:
You’ll see:

Instead of meaningless IDs you now have the name of your BTRFS subvolumes or snapshots. Instead of a hard to decipher string of bytes it converts each amount into the most appropriate unit of measurement. You can also see the total amount of data that is being used by the snapshots.
For this to work you first need to enable quotas. Run this command to enable quotas if you haven’t done so already:
sudo btrfs quota enable /
You can clone the project from github by running:
git clone https://github.com/agronick/btrfs-size.git
Or you can just go a wget on the script:
wget https://raw.githubusercontent.com/agronick/btrfs-size/master/btrfs-size.sh
Set it to executable with:
chmod +x ./btrfs-size.sh
Now you can just run the script with: ./btrfs-size.sh
All the columns are pretty self explanatory. The Total column will tell you how much data is in that BTRFS subvolume. The Exclusive Data column is how much data is exclusive to that subvolume. Since BTRFS is a “copy on write” filesystem none of the data is replicated when you create a snapshot. It only needs to make a copy when something changes.
Leave your feedback here to let me know how it worked for you.
Very nice , it works perfectly