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

Re: 'df' command says partition is full, when it isn't (can't create files, etc)

On Fri, Apr 04, 2003 at 07:58:30AM -0700, Sewell, Cassandra D (Cassandra) wrote:

> Then are we saying this is possibly a problem in Linux in general,
> and has never been fixed.

No, it's not a "problem" with Linux.  It's always been this way with
Unix, and it's not necessarily considered a problem.

In Unix if some process has a file open, and that file is subsequently
deleted, the process will continue to be able to use the file, and
when the process exits, space consumed by that file is deallocated at
this time.  The directory entry for that file is removed, so that no
new process can use this file, and this also means that the du command
won't find or see space consumed by that file.  However, the space is
still in use by the filesystem, so that the process can continue to
use the file.  This means that this disk blocks are still in use, and
this is reflected in the output of the df command.

Note that many Unix/Linux programs use this as a feature (it is
required by thej POSIX standard) for handling temporary files.  They
will open a temporary file for scratch space, and then delete it.
That way, they the program use the temporary file for its own
purposes, but the disk space is automatically reclaimed when the
program exits, either normally or abnormally.  So as much as you
probably hate it when programmers say, "it's a feature, not a bug", in
this case, this is absolutely the case.  This behaviour has been
around for over twenty five years --- it is older than Linux --- and
there are various Unix and POSIX standards specifications that
absolutely require that we function in this way.

You say that you had no applications running, but the space could have
been held open by a system daemon.  For example, if there was a very
large log file which you deleted, but the syslogd daemon was still
running, the space wouldn't be reclaimed until you restarted the
syslog daemon, since it was holding the file open and hence the space
was still in use.  I don't know if this is what you did, but I mention
it because it is absolutely classic mistake made by beginning Unix
system administators.

You say that you haven't seen this with other journaled filesystem,
but let me assure you that this particular behaviour is shared across
all Linux filesystems, and indeed across all Unix-compatible operating
systems.  I have also not heard of any other case where space has not
visible by du and which then "reappeared" when the system was rebooted
has been traced down to any thing other than this classic case of
system administrator confusion.

Is it possible that you've found a bug that no one else in the world
as reported and confirmed to date?  Quite possibly, but please
understand that the symptoms and cure which you reported correspond to
the a very common system administrator misunderstanding of how the
system works.

If you can replicate this problem, I suggest bringing the system down
to single user mode.  This will kill all off all processes without
remounting or rereading the filesystem.  I am 99.999% sure that you
will then find that all of the space has been reclaimed.

						- Ted

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