How to increase /tmp partition? In case your server isn’t built with a /tmp partition OR you need to increase the disk space of the partition for some reason, you will have to create a virtual partition and have to mount it on /tmp.
The following steps will guide you to create a virtual partition:
1) To create a partition of 2GB, use the below dd command:
dd if=/dev/zero of=/home/tmp-dir bs=1024M count=2
2) Once the partition is created, you need to create the file system on it using the mke2fs command
mke2fs -j /home/temp-dir
3) Now, the partition is ready to be used but you need to mount it on /tmp directory.
mount -t ext3 -o loop /home/temp-dir /tmp
Here, we have used ‘loop’ while mounting /home/tmp-dir partition because we are not mounting an actual block device but to make a file accessible as a block device.
verify the partition, execute
5) To make sure this partition is mounted automatically after every reboot, edit the /etc/fstab file and replace the /tmp line with the following
/home/tmp-dir /tmp ext3 rw,nodev,nosuid,noexec 0 0
Hope, this helps.