Linux: After deleting the file space is not released

Faced today with a problemkoy: minidlna stupid all day shipped to all processor 100 percent. I ignored this problem, but then I broke Samba, and none of the ball was not working. Looked, what is there with disk space:

df -h

And he showed me, that fundamentally there is no room!
Then I went to explore around the root, where what is not so.

cd /
du -h --max-depth 1

And found the problem: folder / var weighed 85GB! To be exact folder log. It sat minidlna.log file of all 85GB! And of course I deleted it using “rm -rf /var/log/minidlna.log”

But the place has not cleared. In general, file inode was still open and he still held the 85GB.

Solution

Run

lsof | grep deleted | grep minidlna.log

And we see a picture

chrome     3446       user  128u      REG              253,2              16400       2364626 /var/log/minidlna.log (deleted) 

We are interested in the figure 3446 (some shorter aydishnik). Next you need to find a link to the file in the / proc / * our aydishnik * / fd / * download link *. This is done by

ls -l /proc/3446/fd | grep minidla.log

Well, we get about this sort of thing:

lrwx------. 1 user unix 64 Feb 11 15:31 128 -> /var/log/minidlna.log (deleted)

Here we are interested in the file 128. Then zero out the file:

cat /dev/null > /proc/3446/fd/128

Well, properly, space available after this operation.

Loading

This entry was posted in Computers and tagged , , , , , , , . Bookmark the permalink. | Short link:  http://p1rat.ru/lezzz/GjZvh

One Response to Linux: After deleting the file space is not released

Leave a Reply