Running du command reports infinity as disk usage

btrfsdisk-usagefilesystems

I'm trying to get the total size of what's stored in my home directory. To my surprise, it reports infinity after a few seconds:

/home/user $ du -sh .
Infinity

Huh? I'm pretty sure there are no recursive symlinks, but du should not follow symlinks anyways per default. I've also tried du -shx . so it won't cross device boundaries – with the same result.

I'm pretty sure I don't have infinite disk space or disk usage. 😉

The target filesystem is a btrfs subvolume with no snapshots. rsync syncs this directory to an external disk just fine every night, it has no problem with this "infinity." However, du reports the same there.

Answers to comments:

There are no mount points within my home directory:

$ mount|grep home
/dev/sda3 on /home type btrfs (rw,relatime,compress=lzo,space_cache,autodefrag)

Using the full path instead of . as parameter shows the same behavior.

There are no files bigger than 200GB:

$ sudo find -size +$((200*1024*1024)) | wc -l
0

Best Answer

I found this bug report where a user had the same issue on a btrfs system. It turned out that the problem came from a specific .xml file whose size was incorrectly reported as 16 exabytes.

In the case of the person who filed the bug, the issue was a filesystem corruption and the problem was solved by moving all files to /tmp (which was a tmpfs), deleting the originals and then copying them back again:

mkdir /tmp/foo &&
cp -rv ~/* /tmp/foo &&
rm -r ~/* &&
mv /tmp/foo/* ~/
Related Question