-1

I got an Ubuntu 15.04 Server with Apache,PHP and Mysql running , one day I got 100% Use in my disk using df -H. When I restarted the server with sudo shutdown -r now it now show 32% of usage, I think we have some temporal files that are not being deleted or something is using a lot of space.

What do you recommend me to check!?

  • Those are probably the log files of your webserver. Have a look in /var/log/apache2/ – vpx Oct 16 '16 at 18:47
  • Oh no not yet, Do they delete themselves when restarting the Server? I will take a look at them, I will give some time to see whats happening – Jose Carlos Tamayo Oct 16 '16 at 19:37

1 Answers1

2

There is a few common reasons for free disk space to increase when the system is rebooted.

  • Files which are currently held open by any running process will remain on the disk even if the last reference to the file is deleted. The file will remain until the last process holding it open has closed it or terminated. On a reboot all such files would finally be deleted.
  • It is a sensible practice to have a startup script clean out the contents of /tmp early during startup. This can also free up space.

Since both of the above involve files being deleted, it is difficult (sometimes impossible) to find out what exactly was taking up that disk space previously.

Since we'd be talking about files which have already been deleted the way to find out about it involves using a program which can read directly from the block device and that way bypass the file system. Moreover even if the inode and all the blocks of a deleted file could still be identified, that wouldn't tell you what name the file has, which makes it harder to figure out what those files were.

Having more than 50% of the total disk space freed up this way across a reboot is quite unusual. But it could happen if you had a large file or a large file in /tmp.

If a cleanup of /tmp is the reason, then you should not find any old files in /tmp. You can run find /tmp -mtime +0 -type f to find any files older than 24 hours. Additionally it would mean /tmp is not a separate file system. If you run df /tmp you will see whether /tmp is a separate mount point or part of your root file system.

kasperd
  • 29,894
  • 16
  • 72
  • 122