One,/DEV/SHM concept
- /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.
- 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.
- 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
- /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-
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
Five, problem solving:
Sometimes you may encounter a situation where/DEV/SHM cannot unload
# umount /dev/shm umount: /dev/shm: device is busy.
Treated with Fuser
# fuser -km /dev/shm
# umount /dev/shm
# 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