“Wrong” file usage report by df

Ever happened to find your root partition completelly full but du reporting a minor disk usage?

If you have a separate partition mounted at boot time sometimes can happen to the mount command to fail resoulting in your operations being executed on the wrong partition, maybe everything behaves correctly, you reboot or shut down the system and at the next boot the partition get mounted normally. What happened to the data wrote previously? They just doesn’t show up because are hidden by the mounted partition but still they eat up disk space.

How can you check? Just unmount the partition, if it’s in use you should close every program that has open files on it(lsof and fuser are your friends ) and check inside the folder where the partition should be mounted.

i.e. if I have something like this in fstab:

/dev/sda5    ext4    /home    options    0    0

You should log out from your account, stop the display manager, unmount the partition and check what’s inside /home folder. If files are there then you can backup them and delete from there so you’ll be able to manage them from a GUI

Or, to avoid unmounting the partition, just bind mount it somewhere else, using the example before:

# mount --bind / /mnt/
and check inside /mnt, you’ll find your root partition without the mount points

More Reading