5

I have a Netgear NAS device which uses btrfs filesystem.

du reports all the files on md device taking up 1.37 TB.

btrfs fi df says, that it's taking up 1.53 TB.

I cannot figure out where does 0.16 TB go. On Netgear forums metadata has been mentioned, however btrfs fi df outputs metadata as a separate line, and only taking up 2GB.

How can I figure this out?

3
  • Thank you for all the ideas. I have run defrag, then scrub, then balance. After the defrag used space dropped to 1.43 TB. Don't ask me, it just happened. Scrub and balance didn't change it. So now the difference is 60GB, which is still more than I would attribute to metadata (which is said to be 2GB per btrfs fi df). So any other ideas?
    – mrQQ
    Commented Jul 2, 2015 at 7:40
  • 1
    I suggest you take a look at this question: unix.stackexchange.com/questions/107951/… and you'll see that question is about the same topic as your question and the answer given is also about the difference between allocated and really used space.
    – wie5Ooma
    Commented Jul 13, 2015 at 1:22
  • well, that indeed might be case, however, how do I verify that it indeed is the case? How do I see the size of a chunk and how many of them have been allocated?
    – mrQQ
    Commented Jul 14, 2015 at 17:13

1 Answer 1

1

This situation can be caused by file fragmentation. You can try to solve it by going to the terminal and then type:
sudo umount /dev/sdxy
and then
sudo btrfs filesystem defrag /dev/sdxy
In these commands sdxy is the correct designation of the partition with the problem. For example it might be something like this: 'sda5'. Make sure you check the correct designation before you try anything.

4
  • Uh? How does fragmentation cause extra disk space to be used in a non-negligible? A file uses the same amount of space no matter how many fragments it's split in. The metadata for a massively split file may be slightly larger, but to account for almost 10% of the disk space would mean extreme fragmentation of a very large number of tiny files, I'm not sure the figures would even be possible considering that tiny files can't be fragmented much. Commented Jun 28, 2015 at 22:38
  • I've found several reports on the internet about the same problem and they all suggest defragmentation. The issue has to do wth really used space and allocated space. There's a relation with the COW feature too. The explanation is complicated but defragmentation is presented as a working solution. According to reports the fragmentation can be dramatic which extremely increases the allocated space. The command used by asker measures the amount of allocated space.
    – wie5Ooma
    Commented Jun 28, 2015 at 23:01
  • Are you sure you or they weren't confusing defragmentation with rebalancing? Commented Jun 28, 2015 at 23:05
  • Well, I can't be sure of that of course but some reports mention balancing too as solution but I chose for defragmentation because it is easy to understand what it does. Since asker has a low reputation he/she is possibly a relatively inexperienced user therefore the easier solution might be more suitable.
    – wie5Ooma
    Commented Jun 28, 2015 at 23:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .