How do I change the size of the available shared memory on Linux?

root@thor:/home/omry# df -h | grep shm
none                  3.9G  3.9G  1.6M 100% /dev/shm

evidently 4GB is not enough for what I am doing (I need to load a lot of data into shared memory - my machine got 8GB of RAM).


It's a function of the amount of installed RAM by default. It's typically 50% of your physical RAM. Changing sizes will probably require creating a new ramdisk or remounting the existing filesystem with different parameters.

See: http://centoshacker.com/kabir/tuning/tuning-tmpfs-filesystemdevshm-for-centos.html

  • I`m using ubuntu 11.04, and it does not appear to have the tmpfs line in fstab. so there is probably a different way to change that on ubuntu.
    – Omry
    Jul 17 '11 at 15:33
  • centoshacker.com looks dead/having problems - I get an http response but the content length is zero.
    – user78916
    Aug 2 '13 at 8:36

Modify one of the tmpfs-specific mount options on /dev/shm in /etc/fstab. See the Mount options for tmpfs section of the mount(8) man page for details.

  • see my comment to ewwhite
    – Omry
    Jul 17 '11 at 15:33
  • Entering it into /etc/fstab should override the default mount for /dev/shm. Jul 17 '11 at 15:35
  • Thanks, it worked. I have to accept the other question as an answer as it was the first one.
    – Omry
    Jul 17 '11 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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