April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Bloging on Open Source,Linux,BSD and Internet World What is /dev/shm and how to mount /dev/shm

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

Introduction:
/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.

Useage:
/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 below given bolded line in /etc/fstab:

#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

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>