Dsik usage error

Sam Sharpe lists.redhat at samsharpe.net
Thu Jan 14 00:00:19 UTC 2010


2010/1/13 david walcroft <d_j_w46 at bigpond.net.au>:
> On 01/14/2010 09:20 AM, Sam Sharpe wrote:
>> 2010/1/13 William John Murray<bill.murray at stfc.ac.uk>:
>>>
>>>   Hello all,
>>>          Can anyone help me with a disk usage problem? I have a disk
>>> partition of 65GB in LVM; df says:
>>>
>>> /dev/dm-0             65570580  60494828   1744888  98% /
>>>
>>> However, if I use either du or Baobab they reckon the directories in it
>>> add up to 30Gb or so. As it is my root directory, and there are various
>>> others it is a little difficult to get the total, so I booted under
>>> liveUSB and saw exactly the same - 30Gb used.
>>>    So something is stealing half my disk. If I try to write more it is
>>> out of space.
>>>    Any ideas how I get my space back? fsck reports the disk is clean.
>>
>> I often find that it's files which are deleted, that are still held
>> open. e.g. rotated logs where the owning process has not been
>> reloaded.
>>
>> Try:
>>
>> lsof | grep deleted
>>
>> That should show up and deleted files still open.
>>
>> --
>> Sam
>
> Can you delete these files and If so,how

They disappear when the process holding them open dies. Often that's
as simple as "service httpd restart", but sometimes requires some
manual killing of whatever PID lsof tells you is holding them. Here's
a manufactured example for training purposes ;o)

[sam at samlap ~]$ sudo tail -f /var/log/messages > /tmp/list &
[4] 19925

[sam at samlap ~]$ sudo lsof | grep list
sudo      19925      root    1w      REG               0,18         0
  3287739 /tmp/list

... so we are writing to /tmp/list - lets delete it from underneath
the process ...

[sam at samlap ~]$ sudo rm /tmp/list

... what does lsof show now?

[sam at samlap ~]$ sudo lsof | grep list
sudo      19925      root    1w      REG               0,18         0
  3287739 /tmp/list (deleted)

... lets kill the process holding the file ...

[sam at samlap ~]$ sudo kill -9 19925
[4]+  Killed                  sudo tail -f /var/log/messages > /tmp/list

... now lsof doesn't have a (deleted) file ...

[sam at samlap ~]$ sudo lsof | grep list
[sam at samlap ~]$

--
Sam


More information about the users mailing list