note 101637 added to function.unlink
| From: | dexen dot devries at gmail dot com | Date: | Fri, 31 Dec 2010 09:28:45 +0000 |
| Subject: | note 101637 added to function.unlink | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-175365@lists.php.net to get a copy of this message | ||
Deleted a large file but seeing no increase in free space or decrease of disk usage? Using UNIX or
other POSIX OS?
The unlink() is not about removing file, it's about removing a file name. The manpage says:
``unlink - delete a name and possibly the file it refers to''.
Most of the time a file has just one name -- removing it will also remove (free, deallocate) the
`body' of file (with one caveat, see below). That's the simple, usual case.
However, it's perfectly fine for a file to have several names (see the link() function), in the
same or different directories. All the names will refer to the file body and `keep it alive',
so to say. Only when all the names are removed, the body of file actually is freed.
The caveat:
A file's body may *also* be `kept alive' (still using diskspace) by a process holding the
file open. The body will not be deallocated (will not free disk space) as long as the process holds
it open. In fact, there's a fancy way of resurrecting a file removed by a mistake but still
held open by a process...
----
Server IP: 195.114.0.19
Probable Submitter: 89.228.5.182
----
Manual Page -- http://www.php.net/manual/en/function.unlink.php
Edit -- https://master.php.net/note/edit/101637
Del: integrated -- https://master.php.net/note/delete/101637/integrated
Del: useless -- https://master.php.net/note/delete/101637/useless
Del: bad code -- https://master.php.net/note/delete/101637/bad+code
Del: spam -- https://master.php.net/note/delete/101637/spam
Del: non-english -- https://master.php.net/note/delete/101637/non-english
Del: in docs -- https://master.php.net/note/delete/101637/in+docs
Del: other reasons-- https://master.php.net/note/delete/101637
Reject -- https://master.php.net/note/reject/101637
Search -- https://master.php.net/manage/user-notes.php