Jonathan <[email protected]> writes:
> On Thu, 25 Dec 2008 11:42:56 pm Daniel Pittman wrote:
[...]
>> Well, I can't explain why you got the warning, or if it is a genuine
>> warning or a bug, but I can perhaps shed some light on a corner of Unix
>> that might explain things:
>>
>> Under Unix, if a process opens a file, then deletes it, without closing
>> the file, it remains in existence until the process exits. It can, for
>> example, continue to write to the file.
>>
>> One of the traditional ways to run out of space on a Unix machine, and
>> to confuse the heck out of a new sysadmin, is based on this:
>>
>> You start a process that, for some reason, spews a huge amount of junk
>> out, such as bogus warnings or over-verbose logging, and send that to a
>> file.
>>
>> Then, the new admin notices the huge file after a while and deletes it,
>> but the process doesn't close the file — it continues to write it in the
>> background.
>>
>> Give it a little time and the admin starts to wonder why there is only a
>> few percent of disk space free, but nothing shows up using it with du(1)
>> and friends...
>>
>> Worse, a reboot cures this — because as soon as the daemon stops running
>> the file system will free the file, returning the disk space to the free
>> pool...
>
> Not my problem, but interesting! Is there then such a utility that
> shows actual disk usage and one which shows effective disk usage, ass
> mentioned by your email above.
df(1) will show you the free space in the filesystem, which will include
space used by deleted but in-use inodes. du(1), which walks
directories, will only show you files with some link left, somewhere.
You can use lsof(8) or the content of /proc/<pid>/fd to find deleted
files held open — though, keep in mind that things do this for
legitimate reasons, not just because something has gone wrong.
Regards,
Daniel
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html