Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
I now have got the point: you can't do online re-balancing. That explains why nothing worked for me. So I just booted up my rescue system and just did a re-balance of the whole disk and afterwards I carried out the defragmentation command with compression enabled. Now I have got about 17 gigs of free space! nice :) –  easteregg Jul 31 '12 at 21:59
1  
As a best practice, only keep a minimal set of snapshots and remove unnecessary ones to avoid wasting of space on the volume, because btrfs is copy-on-write file system, as time goes on, more and more data blocks will be changed, thus making snapshots occupying more and more space on the disk. –  Terry Wang Nov 6 '12 at 4:46
1  
See also this question, which has a thorough explanation and useful comments. –  ignis May 11 at 8:05

1 Answer 1

Look at the output from btrfs fi df:

Data: total=50.00GB, used=49.17GB
System: total=32.00MB, used=4.00KB
Metadata: total=24.50GB, used=9.86GB

The total part is the allocated space, while used is the actually used by btrfs. The difference between total and used (around 15 GB) is your missing space. As you can see, it has already been allocated for metadata blocks.

I only have hobby experience with btrfs, but I don't think a ext4 conversion is the best way to create a well laid out btrfs filesystem. Fortunately, you can rebalance the whole filesystem to make it re-do all allocations.

As always, use backups.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.