Brief analysis of/DEV/SHM

Source: Internet
Author: User

One,/DEV/SHM concept

    1. /DEV/SHM is a TMPFS file system, a temporary file system, is a memory-based file system, which means that files in/dev/shm are written directly into memory without taking up hard disk space.
    2. Under CentOS and Redhat, the/DEV/SHM directory is a link to the/RUN/SHM directory, under the Ubuntu system the Tmpfs file system corresponds to the/RUN/SHM directory, which can be viewed using the DF command) because/dev/shm/ This directory is not on the hard disk, but in memory, it is called TMPFS.
    3. In Linux distributions such as Redhat/centos, the default size is half of physical memory. The maximum size of physical memory +swap can be reached
    4. /DEV/SHM is not an immediate use of memory, but rather a method of consuming memory if needed. In the above example, the value of the/DEV/SHM setting is 20G, and we see that the data that has been written to 9.5G is used to consume 9.5G of memory.
Two, features


1. Dynamic File system
2.TMPFS file system will reside completely in memory RAM, read and write fast
3.TMPFS data will not be retained after reboot, such as reboot, reload, bind, etc will empty the contents of/DEV/SHM

Three,/dev/shm use


TMPFS is memory-based, speed is needless to say, hard disk and it can not compare. The automatic Memory management feature in Oracle uses/DEV/SHM. In addition, if the site dimension good use of TMPFS, there will be unexpected harvest.

Four,/DEV/SHM settings and modifications

For temporary mounting-

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

For permanent mounting,paste, the below given bolded line in/etc/fstab:

 
   
  
  1. vi /etc/fstab
  2. **none /dev/shm tmpfs defaults,size=5G 0 0**

Save and close The/etc/fstab file.

 
   
  
  1. > # mount -o remount /dev/shm

& Verify the mounting.

 
   
  
  1. # df -Th
Five, problem solving:


Sometimes you may encounter a situation where/DEV/SHM cannot unload

 
   
  
  1. # umount /dev/shm umount: /dev/shm: device is busy.


Treated with Fuser

 
   
  
  1. # fuser -km /dev/shm
  2. # umount /dev/shm
  3. # mount /dev/shm


fuser Command
-k:kill processes accessing the named file (kills all processes that are accessing the specified file)
-M indicates the file system or block device (in Mount state) where the specified file resides.
All processes that access the file system are listed.



From for notes (Wiz)

Brief analysis of/DEV/SHM

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.