How to configure /dev/shm size of Linux?

/dev/shm is a nice in memory disk on Linux. The default size seems half of the physical memory’s size. How to configure shm size of Linux? And what’s the consequence?

To change the configuration for /dev/shm, add one line to /etc/fstab as follows.

tmpfs /dev/shm tmpfs defaults,size=8g 0 0

Here, the /dev/shm size is configured to be 8GB (make sure you have enough physical memory installed).

It will take effect next time Linux reboot. If you would like to make it take effect immediately, run

# mount -o remount /dev/shm
Leave a Reply

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