Linux – Resize / remount /dev/shm not working

fstabmountoracle-linuxshared memory

I've got a linux box dedicated to playing host to an Oracle server installation. It's got 4Gb RAM and by default, 50% (2Gb) has been allocated to /dev/shm. I want to change this to 3Gb, but I am unable to do so.

I've tried:

  • Changing the relevant line of /etc/fstab to:

    tmpfs     /dev/shm     tmpfs     size=3g     0 0
    
  • Trying to temporarily resize using mount

For whatever reason, it does not appear to resize. Even after a restart (to effect the /etc/fstab change) df -h shows /dev/shm as 2Gb still.

Am I doing something wrong?

Best Answer

Although I don't think it's causing the problem here, your fstab entry is not 100% complete - you're missing the defaults in the mount options field.

It should read:

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

That said, you will also need to change an init script for the fstab entry to take effect. See this bug report for more information, but basically you need to change /etc/rc.d/rc.sysinit

from

mount -f /dev/shm >/dev/null 2>&1

to

mount /dev/shm >/dev/null 2>&1

or add mount -o remount tmpfs to /etc/rc.local.

Note: Based on the age of the question, I'm assuming RHEL 6.x-aged Oracle Linux is the distribution in use.

Related Question