05 Nov 2022
Full /tmp Disk on Server Background

Clean Full /tmp Disk on Server

Dependent on your server environment, you may see your temp disk as full from a build up of outdated files. We recommend the fastest way of cleaning this full /tmp disk on server by utilizing tmpwatch inside your terminal in WHM.

It’s also important to note where the issue is coming from to prevent it from happening again. When your temp disk is full, it may result in your hosted files to be down or for your accounts to crash.

Solution To a Full /tmp Disk on Server

Within your terminal, you can install tmpwatch with the following command inside your terminal in WHM:

yum install tmpwatch

Run a command to see how many files are within your temp partitioned disk with the following command:

ls -1 /tmp | wc -l

After you’re sure that the drive is indeed full, we then recommend to clear files over a week old on this partitioned disk:

tmpwatch --mtime --all 168 /tmp

After this step, check your disk space to see if it has cleared up the disk partition. As the example “168” can be decreased to a lower number of hours. It’s recommended not to decrease the number below “12”.

Final Thoughts on a Full Disk Partition

It’s important to not have it happen again to avoid downtime. If you have many operations that aren’t being fulfilled within your hosting environment, it may be a good idea to upgrade your server for more resources.

Another work around would be to add a cron to clear outdated files on this partition every night. You can add tmpwatch to root’s crontab.

crontab -e

0 0 * * * tmpwatch --mtime --all 168 /tmp

Learn how to edit the root user’s crontab here.

Need additional assistance?

We’re always here to help if you run into any roadblocks. Feel free to reach out if you need help within your server environment or to learn more about our network.

Call us or schedule a free consultation!

Call: (920) 322-5675‬