[lug] Disk space lying??

Sean Reifschneider jafo at tummy.com
Sat Jun 15 16:34:42 MDT 2002


On Fri, Jun 14, 2002 at 10:55:31AM -0600, Shannon Johnston wrote:
>That's it! There is all of 680k in the chroot directory but "df" thinks
>it's full! What's going on?

If any processes have a file open when it's removed, the file remains
around until that process exits.  A really handy way to use file-system
storage but make sure it's cleaned up if your process dies for any reason
is:

   fp = open('/tmp/mytmpfile', 'r+')
   unlink('/tmp/mytmpfile')
   [do whatever you want with fp]

No matter what happens to the process, you KNOW you aren't going to leave
your temporary file around.

Sean
-- 
 No man has a natural right to commit aggression on the equal rights of
 another, and this is all from which the laws ought to restrain him. -- T.J.
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python



More information about the LUG mailing list