Resize / remount /dev/shm not working

6,652

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.

Share:
6,652

Related videos on Youtube

Sohail Shaikh
Author by

Sohail Shaikh

Computing Science Graduate, Developer, Powerlifter.

Updated on September 18, 2022

Comments

  • Sohail Shaikh
    Sohail Shaikh over 1 year

    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?

    • Admin
      Admin over 10 years
      Is the OS 32bit?
    • Admin
      Admin over 10 years
      getconf LONG_BIT informs me that it's 64.
    • Admin
      Admin over 10 years
      Some distributions hard-code the size of /dev/shm in their startup scripts. Why do you want to reduce the size? It's not as if it consumed memory. The memory used for tmpfs isn't reserved, it's allocated for the files that are actually stored, and it gets swapped out with the rest.
    • Admin
      Admin over 10 years
      3Gb > 2Gb - I want to increase it. I was investigating performance issues previously and though now I'm quite sure that this is not the issue, I'd still like to increase it (apparently it's definitely not a bad idea). Perhaps it is hard-coded or something though... Hmm.
    • Admin
      Admin about 8 years
      From the manpage of mount the size= must be given in bytes and only accepts a % suffix. For me a mount -o remount,size=75% /dev/shm worked to increase the space.