What is /dev/shm and how to mount /dev/shm

Introduction:

This post will explain about the /dev/shm and you will also know how to mount /dev/shm in linux system.

/dev/shm is nothing but implementation of traditional shared memory concept. It is an efficient means of passing data between programs. One program will create a memory portion, which other processes (if permitted) can access. This will result into speeding up things on Linux. shm / shmfs is also known as tmpfs, which is a common name for a temporary file storage facility on many Unix-like operating systems. It is intended to appear as a mounted file system, but one which uses virtual memory instead of a persistent storage device. If you type mount command you will see /dev/shm as a tempfs file system. Therefore, it is a file system, which keeps all files in virtual memory. Everything in tmpfs is temporary in the sense that no files will be created on your hard drive. If you unmount a tmpfs instance, everything stored therein is lost. By default almost all Linux distros configured to use /dev/shm.

Usage:
/dev/shm is used to improve the performance of application software for eg. Oracle.
Generally speaking, IO intensive tasks that benefit from fast, No-HDD-read/write-space, such as video encoding, gaming, etc. can make extensive use out of shm.

Commands:

For temporary mounting

mount -o remount,size=5G /dev/shm

For permanent mounting

Paste the given below line in /etc/fstab. Here we are using the vi editor.

vi /etc/fstab
none      /dev/shm        tmpfs   defaults,size=5G        0 0

Save and close the /etc/fstab file.

mount -o remount /dev/shm

Verify the mounting.

df -Th

Posted

in

by

Tags:

Comments

One response to “What is /dev/shm and how to mount /dev/shm”

  1. er Avatar
    er

    mount: /dev/shm: mount point not mounted or bad option.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: