btrfs: HUGE metadata allocated

I have a 256GB SSD disk on which I converted my ext4 root FS to btrfs. I erased the ext4 backup subvolume, enabled compression and defragmented recursively to enable it on all files.

btrfs fi df / has an output that worries me though:

Data: total=148.00GB, used=106.11GB
System: total=32.00MB, used=16.00KB
Metadata: total=65.00GB, used=2.04GB

If I understand the output correctly, 65GB (1/4 of my disk!) is reserved for meta-data and not available for storing files. If this is correct, it would be a huge waste of my disk space. Am I understanding correctly? Can the metadata-allocated portion of my disk be resized?


Solution 1:

First, make sure your kernel and the BTRFS user-space is up-to-date.

According to the BTRFS FAQ, you cannot resize the metadata block size. You can, however, try to run btrfs balance start -m <mount point> which will reallocate the metadata across the entire disk and, as a side effect, possibly free up unallocated space.

If that doesn't work, you may have to backup your data and recreate the filesystem. (Take a look at this for more info.)

Solution 2:

This will decrease metadata size.

sudo btrfs balance start -v -musage=0 /path