Rebuild corrupt /tmp partition on cPanel

If you ever have your /tmp partition corrupted on a cPanel server you may face read-only errors while trying to write into the partition. That will also cause mysql, apache and other services to fail and stop working eventually. That’s why today we are going to show you how to re-create / rebuild corrupt /tmp partition with this quick fix.

How can I re-create or Rebuild corrupt /tmp partition?

On cPanel you can re-create and rebuild corrupt /tmp partition by following this simple steps.

1. Stop all services that are using /tmp

service httpd stop
service mysql stop
service exim stop
service cpanel stp

2. Umount /tmp partition

umount -l /tmp
umount -l /var/tmp

3. Remove corrupted partition

rm -fv /usr/tmpDSK

4. Re-create the /tmp partition

/scripts/securetmp

5. Verify it is mounted properly

df -ah

You should see something like:

[[email protected]:~]df -ah | grep tmp
/usr/tmpDSK     4.0G  189M  3.6G   5% /tmp
/tmp            4.0G  189M  3.6G   5% /var/tmp

6. Set write permissions

chmod 1777 /tmp -v

7. Test if you can create new files on the partition

touch /tmp/test
ls -alh /tmp/test

If you don’t see any errors, then that means the file was created successfull.

8. Start your service again

service httpd start
service mysql start
service exim start
service cpanel start

That’s all.

Do you know other methods to recreate or rebuild corrupt /tmp partition? Please let us know.

Further reading:

About the Author: Martin Keler

Leave a Reply

Your email address will not be published. Required fields are marked *