[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: df and du disagree



David Wright said:
> 
> Bear in mind that du can also seriously underreport usage when run
> as a user because of permissions (whereas df is always right).

Besides files hiding `under' mount points, there is another type of file
that is invisble to du.  If a file which is opened by a process is
removed, it is not really removed from the disk.  As long as the process
keeps the file open, it is a valid file (to that process).  As soon as
the file is closed, the disk space is freed again.  Some programs use
this fact to make sure that temporary files are cleaned up even if the
program crashes: they open a scratch file, and immediately remove the
link from the disk.  Then the process has an open file that not even
root can read (unless with a disk editor), which disappears from the
disk as soon as it is closed.

Sometimes this technique causes hard-to-understand filled up /tmp
partitions if daemons have a leak towards a tmp file.  It then helps to
stop/start long running daemons to identify the problem.

HTH,
Eric

-- 
 E.L. Meijer (tgakem@chem.tue.nl)
 Eindhoven Univ. of Technology
 Lab. for Catalysis and Inorg. Chem. (SKA)


Reply to: