[Top][All Lists]

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

df reporting and removing files (Re: (no subject))

From: Bob Proulx
Subject: df reporting and removing files (Re: (no subject))
Date: Tue, 17 Jul 2007 10:31:10 -0600
User-agent: Mutt/1.5.9i

Elmian Shabahang wrote:
> Hello,

In the future please include a meaningful subject line otherwise it is
likely that your message will be deleted without reading because it
looks too much like spam.

> Please find following information:
> /dev/vg00/lvol8       8.7G  7.7G  619M  93% /u01
> address@hidden u01]$ du -lkhs /u01
> 5.5G    /u01

You appear to be concerned that df reports 7.7G used but du does not
find it by traversing the filesystem?  Is that correct?

> Note that I have deleted a 2.2 GB file , and du don't update the output
> table.

That is perfectly okay.  The 'df' command reports information about
filesystem.  The 'du' command traverses directories and reports
information in directory hierarchies.  Those are two different things
and they may report different information.  In this case it means that
disk space is in use by processes but is not reachable by the
directory hierarchy.  Since you said that you removed the file from
the directory this information is verified.

The filesystem recovers disk space through garbage collection.  When
files are busy the disk space is in use.  When the reference count for
a file is reduced to zero then the filesystem recovers the disk blocks
associated with the file.

Removing files removes the directory pointer to that file but it does
not remove the file from use by running processes.  If a running
process has the file open then the reference count will be non-zero
due to use by that process and the filesystem will not be able to
reclaim that disk space until the process exits.

A typical example is a program writing a log file.  The log file may
grow to be quite large.  As long as the process is running the
reference count for that file will be non-zero.  Removing the file
from the directory will not free up the disk space.  In fact doing so
means that there is no no way to access that file again.  The only way
to reduce the reference count would be to kill the process that holds
the file in use.  To avoid this case it is better to truncate large
files to free up the disk space immediately instead of removing them.

Hope that helps.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]