Could someone tell me how to mount my var session/cache folders to tmpfs? Also what would have to be done to unmount them if it does not work correctly? Could you please include the commands that are needed to stop/restart the needed service?

I know there are a lot of tutorials online to do this, however I am not sure if they apply to my system and each one I come across is a little different.

I am running:

  • CentOs 6 - 64Bit (v6.6)
  • Apache (2.4)
  • Percona (MySQL) (v5.6)
  • PHP 5.5.25 (via PHP-FPM)
  • Magento

1 Answer 1


vi /etc/fstab

tmpfs /path/to/var/cache tmpfs rw,uid=503,gid=503,size=2048M,nr_inodes=10k,mode=0755    0       0

mount /path/to/var/cache

Repeat above steps for var/session. Set size and nr_inodes as needed. Set uid and gid to user/group IDs of owner/group for these directories.

You can remove the tmpfs settings and re-create the directories if you need to undo it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.