The following document shall outline the steps that need to be followed in order to clear a full partition.
It is usually the /var/directory that is the first to fill up. This is because it contains the system logs.
In certain cases, the /usr directory may however fill up first, due to Apache.
The first thing to do before clearing a full partition is to check the directory space available.
This can be done by a given user from the command line directly. One simply has to follow the outlined steps:
The ‘Du’ utility identifies the estimated size and Disk space occupancy of each directory/log file on the specified path, while the ‘-sh’ component makes sure it appears in a humanly intelligible format.
It is only after the results of the aforementioned command have been examined and it has been determined which directories are using the maximum amount of disk space that one can decide to clear the relevant ones. The following steps will allow one to Delete it Clear the necessary directories/files:
The above example relates to the output for the /var/www/html directory.
cat /dev/null > filename
tail -5000 filename > filename.new
mv filename.new filename
In the above command, the word, filename stands for the file to be deleted, while filename.new stands for the file to which to the most recent entries are to be saved.
Following the outlined steps should then enable a user to clear a full partition.
Once the process of clearing has been completed one should restart the service in order to ensure the smooth operation of the same.