/

Linux: Troubleshooting \"No Space Left on Device\" Error

Linux: Troubleshooting “No Space Left on Device” Error

Recently, I encountered a perplexing issue on my Linux Ubuntu server. To investigate the problem, I accessed the server and checked the Apache error log located in /var/apache2/error.log. To my dismay, the log was inundated with numerous instances of the dreaded “No space left on device” error. Apprehension set in as I pondered how this could have happened.

To get a better understanding of the situation, I decided to run the df command, which confirmed my suspicions - the disk was completely full. Determined to find the root cause of this predicament, I began by reclaiming some disk space using the following command:

1
sudo apt-get clean

To further investigate the issue and identify which directory was hogging most of the disk space, I installed the ncdu utility with the following command:

1
sudo apt-get install ncdu

Executing ncdu from the root directory (/), I discovered that a specific folder accounted for a whopping 90% of the consumed disk space. I traced this back to one of my backup scripts, which was inadvertently writing the database logs in that folder before transferring them to another server. Each log file was approximately 80MB, and these were generated on a daily basis. Over time, the accumulation of these files resulted in several gigabytes of data, ultimately exhausting the available disk space.

To address the issue, I promptly removed all these unnecessary log files. Miraculously, this simple action resolved the problem, restoring the Linux server to its optimal functionality. And that concludes the tale of my encounter with the “No space left on device” error.

tags: [“Linux”, “troubleshooting”, “disk space”, “Linux server”, “error log”, “Apache”, “no space left on device”, “df command”, “ncdu utility”, “backup script”]