Ubuntu – Large discrepancy between df and du

diskdisk-usagefilesystem

My / partition which holds everything (including /home), was suddenly using 100% of disk space. I removed a few files and now df shows

$ df -h /dev/sda1 
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       214G  149G   54G  74% /

However du shows:

$ sudo du -shxc /*
9.6M    /bin
66M /boot
4.0K    /cdrom
4.0K    /dev
16M /etc
26G /home
0   /initrd.img
0   /initrd.img.old
504M    /lib
3.5M    /lib32
4.0K    /lib64
0   /libnss3.so
16K /lost+found
92K /media
4.0K    /mnt
3.3G    /opt
du: cannot access ‘/proc/4708/task/4708/fd/4’: No such file or directory
du: cannot access ‘/proc/4708/task/4708/fdinfo/4’: No such file or directory
du: cannot access ‘/proc/4708/fd/4’: No such file or directory
du: cannot access ‘/proc/4708/fdinfo/4’: No such file or directory
0   /proc
346M    /root
1.9M    /run
13M /sbin
136K    /srv
0   /sys
36K /tmp
6.3G    /usr
1.1G    /var
0   /vmlinuz
0   /vmlinuz.old
37G total

I used sudo, only /proc cannot be accessed and knowing what is done on the machine, du seems to be right. However allocating disk space for more than the 54G df says are left indeed fails:

$ fallocate -l 55G test.img
fallocate: test.img: fallocate failed: No space left on device

I know about Difference between baobab and df/du and df shows all space taken, but du doesn't add up which seem to show the same problem, but there is no answer regarding how to solve it. I also know about Why do df and du show different output?, but the difference is very large here, I rebooted the machine, I checked /dev/sda1 while booted from a DVD so it should really not be there anymore.

Does anyone knows what is happening. I would really like my disk space back! 😉

System information:

$ uname -a
Linux hjort 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
LSB Version:    core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:core-4.1-amd64:core-4.1-noarch:security-4.0-amd64:security-4.0-noarch:security-4.1-amd64:security-4.1-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:    14.04
Codename:   trusty

Best Answer

My problem was identical to the on in this post https://serverfault.com/questions/57098/du-vs-df-difference

Sorry for the trouble. I had rsnapshot backups in /mnt/backup (by mistake) and then mounted the backup drive on top of them.

Related Question