Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a btrfs partition. When I run df -h, it shows:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       113G  101G  8.3G  93% /home

From Why is that? Is it because reserved space for root as wth ext2/3/4? Or is it something else? If the former, how can I change it and reclaim those 4GB ?

As per btrfs wiki, I know that metadata are stored twice which inflates the size of "Used" data:

user@machine:~$ df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             894G  311G  583G  35% /
                            ^^^^
user@machine:~$ btrfs fi df /
Metadata: total=18.00GB, >>used=6.10GB<<  *2=  12.20GB
Data: total=358.00GB, >>used=298.37GB<<   *1= 298.37GB
System: total=12.00MB, >>used=40.00KB<<   *1=   0.00GB
                                           == 310.57GB 
                                           ~~ 311   GB

But this still does not explain why Used + Avail < Size.

share|improve this question
    
btrfs.wiki.kernel.org/articles/f/a/q/FAQ_1fe9.html - read the "Why are there so many ways to check the amount of free space?" section, it has lots of information. –  Mat Apr 28 '12 at 6:10
    
Yes, it has plenty of informations, but in all their examples Used + Avail = Size in df output. I have updated the question with this. –  sup Apr 28 '12 at 8:32
    
Does lsof show any deleted files? (The btrfs output from your system would have been a bit more appropriate than that from the wiki.) –  Mat Apr 28 '12 at 16:53
    
I know, but I was lazy to reformat it and it is analogical. If lsof |grep 'DEL'|wc -l gives the number of deleted files, it is 338. They do not seem big though (can I get their overall size somehow?) –  sup Apr 28 '12 at 18:31

1 Answer 1

up vote 4 down vote accepted

Unless you specified otherwise when you formatted, the default is to store duplicate copies of the metadata blocks for improved reliability. You probably have 2gb worth of metadata that is stored twice, using 4gb. You can see more details with btrfs filesystem df.

share|improve this answer
    
btrfs filesystem df /home gives Metadata, DUP: total=1.75GB, used=385.70MB so I have about 771MB of Metadata stored, together with Data it amounts to 101G, but it does not explain why Used + Avail < Size - I expanded the question to reflect this. –  sup Apr 28 '12 at 8:33
3  
@sup, 1.75GB is allocated for metadata, so it consumes twice that or 3.5GB of space. Only 385mb of that 1.75 gb is currently used for metadata, but the full 1.75GB is reserved for that use and so is not counted towards available space for file data. –  psusi Apr 28 '12 at 20:29
    
Ah, now I understand. I guess the examples from btrfs wiki just use some old df that did not know about this. Thanks for the answer! –  sup Apr 28 '12 at 22:36

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.