home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!decwrl!pa.dec.com!nntpd2.cxo.dec.com!nntpd.lkg.dec.com!amber!cavedog.athena.lkg.dec.com!mamros
- From: mamros@athena.lkg.dec.com (Shawn Mamros)
- Newsgroups: comp.unix.ultrix
- Subject: Re: Two questions from Ultrix novice
- Message-ID: <790982@athena.lkg.dec.com>
- Date: 21 Jul 92 13:31:50 GMT
- References: <1992Jul20.150115.2701@ctr.columbia.edu>
- Sender: mamros@cavedog.athena.lkg.dec.com (Shawn Mamros)
- Reply-To: mamros@athena.lkg.dec.com (Shawn Mamros)
- Organization: Digital Equipment Corporation
- Lines: 34
-
-
- shenkin@avogadro.barnard.columbia.edu (Peter S. Shenkin) writes:
- >1. The "df" command is not properly displaying disk utilization. If I
- > add large files, the command properly tells me that more kbytes are
- > used and fewer are free; however, if I remove large files df exhibits
- > no change. The net effect is that as the system ages "used" eventually
- > gets to 100% according to df, despite the fact that there is plenty of
- > space on disk. Rebooting updates the display.
- >
- > What's broken, and how can I fix it?
-
- What's almost certainly happening here is that a process still has the
- file open when you remove it. The system can't reclaim the disk space
- which a file takes up until *all* references to the file are gone - not
- only all directory entries ("links") to the file, but also any open file
- descriptors to that file that a process may have. This is why rebooting
- "fixes" the problem - the process(es) which have that file open is/are no
- longer around.
-
- A classic example of this is a daemon process which maintains its own log
- file. Most daemons won't open/close a log file every time they want to
- write a new entry to it - they'll just open it once at startup time, and
- keep it open. When you remove the log file, the daemon still has it open,
- and the space the file takes up won't be made available until the daemon
- closes it or until the daemon is killed. Depending on which file it is
- (and which daemon is responsible), you might be able to SIGHUP the daemon
- and have it close the old log file and open a new one with the same filename,
- without having to stop the daemon altogether.
-
- Nothing is broken - that's just the way the filesystem is designed to work.
- It ensures programs that an opened file won't be wiped away from underneath it.
-
- -Shawn Mamros
- E-mail to: mamros@athena.lkg.dec.com
-