Jerry Schwartz wrote:
> I don't know Linux that well, but I know that HP-UX lets you do most
> anything to an open file, including deleting it. The file will continue to
> exist as long as it is open by at least one process.
Yes - that is standard Unix semantics; it should be that way on any
variety of Unix including Linux, BSD, and the commercial ones.
You can use this for any file system object (including FIFOs) to get an
automatic cleanup if your process(es) crash(es):
- Create the object (file, FIFO, ...),
- open it (from all processes that need it),
- delete it.
It will continue to exist as long as at least one process has it open,
but cannot be accessed by its name any longer (so no additional "open()"
call is possible).
It will still occupy space on disk, but will not be included in any "du"
output (because it is not accessible from any directory).
If "du" on the root directory of some file system (done by the root
user) reports less blocks than "df" on that file system, typically the
difference are the blocks of such deleted but still open files.
> If I remember
> correctly, this is all about the inode use count vs. the directory entry, or
> something like that. The file will actually be safe so long as it is not
> closed by the last user.
> Those files will go away as soon as they are closed, so the database should
> be dumped before shutting down mysqld.
Right on both items.
Joerg Bruehe, Senior Production Engineer
MySQL AB, www.mysql.com