Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


How to increase /tmp partition size

Most linux servers have a separate /tmp partition to prevent from filling up the root directory with temporary files. Temp partition has a fixed size but occasionally it can get overfilled, so no new information can be recorded. If this happens one can clear out /tmp periodically using some cron job, reconfigure application to store temporary files in some other directory or increase temp partition.
To increase /tmp it is necessary to create a virtual partition and mount it.

To do this on a server with cPanel/WHM installed please follow the steps here:

To do this on a server without cPanel let’s go through the following steps:

Stop Apache and MySQL services.


# /etc/init.d/httpd stop; /etc/init.d/mysql stop


Take a backup of /tmp


# cp -rp /tmp /tmp.bak


Create a partition of 2GB using the below command


# dd if=/dev/zero of=/usr/temp-disk bs=2M count=1024


Create the file system on it using the mke2fs command


# mke2fs -j /usr/temp-disk


Unmount the current /tmp partition


# umount /tmp


Mount the new /tmp filesystem using the below command


# mount -t ext3 -o rw,noexec,nosuid,loop /usr/temp-disk /tmp


Set the correct permission for /tmp


# chmod 1777 /tmp


To verify the partition, execute:


# mount


Restore the content of old /tmp.bkp directory


# cp -rp /tmp.bak/* /tmp


Start Apache and MySQL services.


# /etc/init.d/httpd start; /etc/init.d/mysql start


To make sure this partition is mounted automatically after every reboot, edit the /etc/fstab and replace /tmp entry line with the following one.


/usr/temp-disk /tmp ext3 rw,noexec,nosuid,loop 0 0


Here it is, the /tmp partition size has been increased. If any issues occur while doing this please do not hesitate and contact our support team.

By: Sileep Kumar M S

Save this article