Middle+
A 100GB block device mounted at /opt. df shows 100% used, du shows 95KB. Where does this discrepancy come from and how to find the cause?
sobes.tech AI
Answer from AI
Discrepancies between df and du are often due to df showing the total space used on the filesystem, including files that have been deleted but are still open by processes, while du only counts visible files.
In your case:
dfshows 100% usage — meaning all blocks are occupied.dushows only 95KB — meaning there are almost no visible files.
The reason could be that there are deleted but open files still occupying space.
To find the cause:
-
Use the command
lsof +L1 /opt— it will show open files with link count less than 1 (deleted but open). -
If such files are found, identify the process holding them and restart or terminate it to free up space.
-
Also, check for hidden files or mount points inside
/optthat might affect the count.
Thus, the main reason is deleted but open files that occupy disk space but are not visible through du.