[comp.unix.questions] Strange Unix file system object

pvo1478@neptune.uucp (Paul O'Neill) (04/17/89)

>From article <668@mccc.UUCP>, by pjh@mccc.UUCP (Pete Holsberg):
>>
>> I run a pair of 3B2/400 (SV R3.1) computers and just noticed a strange
>> ...

I sometimes get behind in my mail.  :-)
Right now there's 1.6 Mb in my /usr/spool/mail file.
I read the stuff w/ mailtool on a SunOS 4.0 machine.

I noticed that compiles were failing w/ write error: / file system is full
and traced it down to this:

When the mailtool is fired up, df shows 1.6 Mb less space in /.  OK, I
thought there's some temporary file in /tmp holding all this garbage.
But ls couldn't find anything in /tmp, and du couldn't find anything in 
/tmp, as a matter of fact du of all directories in the root partition
doesn't turn up anything 1.6 Mb in size.  Hmmmm.

``ofiles'' (thank god for ofiles) shows Mail has an open inode, 1788, 
on the root file system.  But "find / -inum 1788 -xdev -print" shows
nothing.

So, what is this bizarre object?  Ofiles and df know about it.
du, ls, and find don't know about it.

Thanx,


Paul O'Neill                 pvo@oce.orst.edu
Coastal Imaging Lab
OSU--Oceanography
Corvallis, OR  97331         503-754-3251

bernsten@phoenix.Princeton.EDU (Dan Bernstein) (04/17/89)

In article <10016@orstcs.CS.ORST.EDU> pvo1478@oce.orst.edu (Paul O'Neill) writes:
  [Starts Mail on a 1.6 MB mailbox]
  [df suddenly shows 1.6 MB less space in a file system]
  [there's no file system entry for a 1.6 MB file]
> ``ofiles'' (thank god for ofiles) shows Mail has an open inode, 1788, 
> on the root file system.  But "find / -inum 1788 -xdev -print" shows
> nothing.
> 
> So, what is this bizarre object?  Ofiles and df know about it.
> du, ls, and find don't know about it.

The kernel won't free the filesystem space for a file until (1) it has
zero hard links and (2) it is accessed by zero processes. It wouldn't
be a good idea to delete an opened file just because its last directory
entry disappears: what information do you give to the process reading
the file? So the kernel quite naturally waits until Mail closes the file
before deleting it.

Probably your Mail program removes the old file after it's opened it;
then it makes a new mailbox file. I'd advise using a mail reader with
a more conservative approach to file handling.

---Dan Bernstein, bernsten@phoenix.princeton.edu