How to increase the size of /tmp partition

Posted on Tuesday, 21 of February of 2017
1245by Tech Supportlinuxinstallationsetupsecurityhttpcommand line

Sometimes, our applications needs more temporary storage, in our server.

This article shows how to increase the /tmp partition, in Linux Server.

1. Stop MySQL and Apache services

# /etc/init.d/mysql stop
# /etc/init.d/apache2 stop

2. Run

# df -h

3. If /tmp mount point exists

# cp -rp /tmp /tmp.bak

4. Create an empty file within /usr/temp-disk

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

5. Apply FS to the new file

# mke2fs -j /usr/temp-disk

6. If /tmp mount point exists

# umount /tmp

7. mount the FS in /tmp and apply the correct permissions

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

8. Check if the OS assumes the mount point

# mount

9. Edit FSTAB and apply the new TMP

# vim /etc/fstab

Insert at the end of the file:

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

Share or save this article