Transferred from: http://www.2cto.com/os/201411/354888.html
Introduced
/dev/shm/is a device that uses the Tmpfs file system, which is actually a special file system. The default size in Redhat is half of physical memory , so that time is not MKFS formatted.
TMPFS is a memory-based virtual file system on the Linux/unix system. TMPFS can use your memory or swap partition to store the file (that is, its storage space in virtual memory, the VM consists of real memory and swap). Thus, TMPFS primarily stores staged files. It has the following 2 advantages: 1. The size of the dynamic file system. 2. TMPFS uses a VM-built file system, which is of course fast. 3. Data loss after reboot.
When deleting files in Tmpfs, TMPFS will dynamically reduce the file system and release the VM resources, Linux can put some of the program's temporary files in the TMPFS, the use of TMPFS faster than hard disk features to improve system performance. In practice, this file system is set up for application specific requirements, which can improve application read/write performance, such as placing the squid cache directory in/tmp, PHP session files in/TMP, socket files in/TMP, or using/TMP as cache device for other applications
Temporarily modify the/DEV/SHM size
#mount-o size=1500m-o nr_inodes=1000000-o noatime,nodiratime-o remount/dev/shm
Mount-t tmpfs-o size=20m tmpfs/tmp Temporary mount use
Boot-enabled configuration
You can define its size in/etc/fstab
Tmpfs/dev/shm tmpfs,defaults,size=512m 0 0
Tmpfs/tmp Tmpfs defaults,size=25m 0 0
After the modification, the execution of Mount-o REMOOUNT/DEV/SHM takes effect
Mkdir/dev/shm/tmp (The new directory under/dev/shm/is bound to/TMP, and/TMP uses the Tmpfs file system)
chmod 1777/dev/shm/tmp
Mount--bind/dev/shm/tmp/tmp
TMPFS file system under Linux (/DEV/SHM)