retroity
By:
retroity

Droplet Disk Space Slowly Filling?

March 19, 2018 188 views
Apache Linux Basics Ubuntu 16.04

Apologies if this is a noobish issue, but I've noticed that according to my graphs, my disk space is slowly filling up, at the rate of about 0.01% an hour. I know that rate is pretty slow, but I'm still confused as to why it's happening. For context, I'm using my droplet as a webserver, with apache, PHP, and Let's Encrypt. Could it have anything to do with Apache logs? Clearing them doesn't seem to do anything, but restarting the droplet brought the used disk space down from 6.08% to 5.88%.

1 Answer

It is most likely log files as you suspected.

If there is a running process, like Apache, that is writing to a log file, and you delete the log file the space will not be freed up. This is because though the links to the file are gone from your file system and you won't see them when you do a directory listing there is a still a running process that has a pointer to that file which is open.

That is why if you delete the log file and then reboot the running process, like Apache, the space is freed up.

Alternatively if you want to clear out space from a log file without restarting the application you can do:

# cat /dev/null > /path/to/log.file
Have another answer? Share your knowledge.