[OT] Hardlinks and directories

Sam Sharpe lists.redhat at samsharpe.net
Fri Feb 12 23:46:15 UTC 2010


On 12 February 2010 23:40, Suvayu Ali <fatkasuvayu+linux at gmail.com> wrote:
> On Friday 12 February 2010 09:19 AM, Mikkel wrote:
>> On 02/12/2010 09:29 AM, Bruno Wolff III wrote:
>>>
>>> lsof would allow you to find the processes that have the files open. And then
>>> you could kill those processes to release the space. It looks like you should
>>> be able to get size infomation of these files from lsof as well. So one
>>> could script looking for processes that have large files open.
>>
>> You might want to try using the +L1 and the -s options. It will
>> display the sizes of unlinked (deleted) files.
>>
>> lsof +L1 -s
>
> I am not entirely clear about this part, how does one end up with an
> un-named open file. To simulate the situation I tried to open a text
> file with an editor and then removed it with rm. But it doesn't show up
> in `lsof +L1' as I was expecting it to. Am I understanding this the
> wrong way?

Quite easily.

Crank up Apache, then delete /var/log/httpd/access_log - note that
when you do "lsof" you will still see that Apache still has the log
file open and it won't be properly deleted until you actually restart
Apache. This is why logrotate restarts a daemon after it rotates out
the logs.

--
Sam


More information about the users mailing list