# Disk free results not updated after removing files

**URL:** <https://linux-tips.com/t/disk-free-results-not-updated-after-removing-files/298>\
**Category:** Administration\
**Created:** [November 15, 2015, 11:40am UTC](https://linux-tips.com/t/disk-free-results-not-updated-after-removing-files/298 "2015-11-15T11:40:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaskoX](https://linux-tips.com/user_avatar/linux-tips.com/raskox/32/92_2.png) [@RaskoX](https://linux-tips.com/u/RaskoX)\
**Post date:** [November 15, 2015, 11:40am UTC](https://linux-tips.com/t/disk-free-results-not-updated-after-removing-files/298/1 "2015-11-15T11:40:56Z")

</div>

We have a web server which has %100 disk usage on some partitions because of the webserver logs.

When I delete some of the log files with **rm** command to free up disk space, nothing changed on output of the **df** command.

But, if I use file truncate pattern like `: > log_file_name`, specified log file is truncated and disk usage percentages in output of **df** command updated as expected.

Why disk free, disk usage numbers not updated after removing of files?

---

<div class="post-metadata">

**Author:** ![DrSlump](https://linux-tips.com/user_avatar/linux-tips.com/drslump/32/61_2.png) [@DrSlump](https://linux-tips.com/u/DrSlump)\
**Post date:** [November 15, 2015, 8:54pm UTC](https://linux-tips.com/t/disk-free-results-not-updated-after-removing-files/298/2 "2015-11-15T20:54:46Z")

</div>

**rm** command removes specified file name from the directory entries, so you can’t see that file name after remove. But it doesn’t actually delete the file contents.

Deleting file contents is the responsibility of kernel. If deleted file has any hard links or already opened by a process, its contents not removed.

You can check a file is already opened by a process or not with `lsof` command like below:

```auto
$ sudo lsof -n | grep filename

```

In your setup, webserver still keeps open file descriptors. If you restart the webserver, file contents will be deleted and **df** shows correct numbers.
