Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am having a disk space problem on the root partition, so I went through unimportant logs and deleted what could be deleted.

One of the files "mysql-slow.log" was 32GB big, but when I deleted it, it never freed a space on the disk. I use df -h command to check.

Root partition is formatted ext4.

Thanks,

share|improve this question
add comment

2 Answers

up vote 11 down vote accepted

In Linux/Unix world file deletion does not necessarily immediately free the disk space, it merely unlinks the file from file system.

If there are processes having file handles open to file being removed (as is common with syslog daemon, and in MySQL case, that mysql-slow.log), the space is not freed until the holding process is asked to reopen the file handles (HUP, hangup signal), or the process is restarted.

If you don't know what process is actually holding the file open, use lsof -n | grep filename or if you want to see what marked-as-deleted-but-still-in-use files are present in system, lsof -n | grep deleted

share|improve this answer
add comment

df should update after restarting mysqld service.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.