One thing that fits your description is:
Your /tmp
directory getting used up by the applications running on your server and becoming full. The /tmp
directory gets emptied upon reboot... hence the reduced partition size.
To check the usage of the /tmp
directory please, run the following command in the terminal:
sudo du -hsc /tmp
To watch the usage of the /tmp
directory in real time, please run the following command in the terminal:
sudo watch du -hsc /tmp
To exit real time, please press Ctrl + C.
To empty the /tmp
directory without rebooting, please run the following command in the terminal:
sudo rm -rf /tmp/{*,.??*}
If you get an error like bash: /usr/bin/sudo: Argument list too long
, this means your /tmp
directory contains more files then rm
can handle at once. To overcome this please run the following command instead in the terminal:
sudo find /tmp/{*,.??*} -exec rm -rf {} \;
If you get errors during this operation like No such file or directory.
, please ignore them as files are being added and deleted by system all the time in the /tmp
directory.
If this solves your issue:
You can add a cronjob to run the empty command daily.
If this is not the case:
I recommend you investigate what is eating up your space by running the following command in the terminal:
sudo du -hca --time / | grep -E "^[0-9\.]*[G]"
This will list all the directories and files on your system with sizes more than 1G along with their modification dates.
To check for certain sizes:
For example to list only directories with 3G size, please use
the following command:
sudo du -hca --time / | grep -E "^[3][0-9\.]*[G]"
You can change the number [3] to check for directories with say 5G
size like so:
sudo du -hca --time / | grep -E "^[5][0-9\.]*[G]"
and so on.
Please, inspect the output with focus on recently modified ones and check if you see anything out of the norm.
You may need to continue monitoring and noting the size changes until you reach the moment where your partition is nearly full. You will then have a better understanding on what is causing this issue and will be able to make a decision.
/tmp
is normal. I recommend you investigate what is eating up your space by running in the terminalsudo du -hca --time / | grep -E "^[0-9\.]*[G]"
. This will list all the directories and files on your system with size more than 1G along with their modification dates. Inspect the output with focus on recently modified ones and let me know if you see anything out of the normal. Please do not post the whole output as it may contain some confidential info. the output will be a bit large. Best of luck – Raffa Aug 21 '19 at 17:57