Ubuntu – btrfs and missing free space

btrfscompressiondisk-usagefilesystem

I converted my ext4 partition to btrfs and deleted the save subvolume after doing so. Then I enabled the compression (lzo) of the filessystem in the fstab file and everything is correct so far.

Then I forced the compression of all files using the defragmentation command with the parameter -c that the new compression is applied to all files.

While doing so, I noticed that my ssd got completly filled up – before I had 6gigs of free space. No I got nothing left.

easteregg@x201s:~$ btrfs fi df /
Data: total=50.00GB, used=49.17GB
System: total=32.00MB, used=4.00KB
Metadata: total=24.50GB, used=9.86GB

and

easteregg@x201s:~$ df -ha
Filesystem        Size  Used Avail Use% Mounted on
/dev/sda1          75G   60G  852M  99% /

So now. How can I regain my free space. I expected to gain more space because of the lzo compression. And now!

The fs is correctly mounted.

easteregg@x201s:~$ mount
/dev/sda1 on / type btrfs (rw,noatime,ssd,compress=lzo)

Any ideas how to fix this issue?

Best Answer

I know this question is old - but as of today the balance command solves this stuff:

During conversion a lot of space will be allcoated to move stuff to it. Once it is allocated, it will not show up as "free" or "unallocated" anymore. To fix this simply start a balance

btrfs balance start "path"

you can also tell the balance command, to only balance chunks, which are used for acertain percentage - like 0% which would mean the chunks are empty:

btrfs balance start "path" -dusage=0 -musage=0

parameter -d means options for the data. parameter -m means options for the metadata.

play with the balance command, it should help.

Related Question