SDB:Setting the Size of tmpfs and shmfs

Şuraya atla: kullan, ara


Symptom

By default, the virtual file system tmpfs is mounted to "/dev/shm" with half the available RAM.

Cause

The cause is a definition to this effect in the boot scripts.

Solution

SUSE LINUX older than 8.1 and SUSE LINUX Enterprise Server 7

Disable the following entries, approximately line 489, in the file /etc/init.d/boot or, for version 8.0, /etc/init.d/boot.swap:

 # mount shmfs is necessary (2.4 kernels)
 #
 #unset HAVE_SHM
 #while read dev type; do
 #    test "$type" = "shm" && HAVE_SHM=1
 #done < /proc/filesystems
 #if test ! -z "$HAVE_SHM"; then
 #    ECHO_RETURN=$rc_done
 #    test -d /dev/shm || mkdir /dev/shm
 #    echo -n "Mount SHM FS on /dev/shm"
 #    mount -t shm shmfs /dev/shm || ECHO_RETURN=$rc_failed
 #    echo -e $ECHO_RETURN
 #fi
 #unset HAVE_SHM
 

Instead, insert an entry in the file /etc/fstab and specify the desired size in the parameter "size". An example with 1G:

tmpfs /dev/shm tmpfs size=1g 0 0

SUSE LINUX since 8.1 and SUSE LINUX Enterprise Server 8

Insert the wanted value in /etc/sysconfig/kernel into the variable:

  SHMFS_SIZE="VALUE"

where VALUE is the size in bytes.
The change takes effect after the next reboot. <keyword>tmpfs,shmfs,mysap</keyword>