What I have done in the past when I make similar changes (e.g. This is common with improperly-rotated log files in /var/log, but I don't think it is the main issue here.
Next, there is the issue of the old contents of the /var/ directory on the root file system - if you did not erase it before you mounted the new /var file system over it, the files there are hidden from 'du' but still take up space which is reported correctly by 'df'.įinally, 'du' and 'df' will disagree if there are deleted files which are still being held open by some process (if you 'rm' an open file, it disappears from the directory listing immediately, and thus cannot be seen by 'du', but it is not actually removed from disk (or 'df') until the last open file handle is closed). ) - especially for the /var directory, that will cause problems since many log files are restricted to root-only access (audit, /var/log/secure, etc.)
I can see several reasons why you might be getting discrepancies between 'du' and 'df' output.įirst, you ran 'du' as a regular user, not as 'root' (sudo du.