[HowTo] get Space on BTRFS

If you encounter a situation where a Btrfs volume is out of space,

There is a way out

However, you have to accept that Btrfs is a “strange” filesystem. So if you’re doing things that would help with other filesystems, it might NOT help with btrfs. If you want to know why, check out the wiki

Here are a few simple tips:

1. Only use btrfs to meassure the unallocated space on your filesystem:

sudo btrfs filesystem usage /

2. Look at “Device unallocated:”

If the Unallocated size is less than 10GB, it may cause problems.
Please follow the steps mentioned in the wiki under “Solving problems”.

3. Look at “Free (estimated):”

If the free size is below 10GB, you need to delete something to free up space.

4. Search for Snapshots (from Timeshift)

sudo btrfs subvolume list / | grep 'timeshift-btrfs'

All timeshift snapshots that you actually have are displayed here.

5. You may need to delete some of these

Please select some of the oldest. Then delete them.

You need to mount them before you can delete some.

sudo btrfs filesystem show | grep -C2 '/dev/.*'

The name of the device is marked red. Now you need to mount it

sudo mount -t btrfs -o subvol=/ /dev/???? /mnt
mount -t btrfs

And when it is mounted,

sudo btrfs subvolume delete -C /mnt/timeshift-btrfs/snapshots/2023-06-13_17-16-41/@

6. After deleting some, you need to check the following:

sudo btrfs filesystem usage /mnt

Note, however, that Btrfs may take some time to free up some of the now unused disk space. This can take a few minutes !!!

7. You may need to balance a bit :wink:

But please only do what is necessary. The first step may be sufficient in your situation. Btrfs tells you how many blocks have been moved.

sudo btrfs balance start -musage=50 -dusage=50 /
sudo btrfs balance start -musage=75 -dusage=75 /
sudo btrfs balance start -musage=85 -dusage=85 /
sudo btrfs balance start -musage=95 -dusage=95 /