Running /tmp partition makes great performance enhancements as soon as you store temprorary information, please be aware that you mustn’t store valuable data as a reboot will flush all the data inside.

/tmp & /var/tmp runs faster from RAM, to do so:

vi /etc/fstab
Switch to Insert mode by pressing I or INSERT button on keyboard and comment out /tmp partition if you already have one with a # and enter the information below:
tmpfs                   /tmp                    tmpfs   defaults,noatime,mode=1777 0 0
tmpfs                   /var/tmp                tmpfs defaults,noatime,mode=1777 0 0

save the file by pressing ESC and SHIFT ZZ or ESC + wq and type “mount -a” to apply the changes immediately. You can check the results by typing “df -h” and you will see something similar to below one:

Filesystem            Size  Used Avail Use% Mounted on
/dev/hdb5              50G  5.0G   43G  11% /
/dev/hdb1              99M   24M   71M  25% /boot
tmpfs                 1.5G     0  1.5G   0% /dev/shm
tmpfs                 1.5G     0  1.5G   0% /tmp
tmpfs                 1.5G     0  1.5G   0% /var/tmp
Please note that, all your data and sessions will be gone when you switch to/from ramfs.
IMPORTANT NOTE: This document is prepared for CentOS 5.6 and ment to work with other versions and distros.Never assume the directory structures exist in your system as written in the document. Never blindly follow security instructions — read, review, compare, apply as it fits your system.

Leave a Reply

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