新聞中心
tmpfs是Linux/Unix系統(tǒng)上的一種基于內(nèi)存的文件系統(tǒng)。tmpfs可以使用系統(tǒng)的內(nèi)存或swap分區(qū)來存儲文件。由此可見,tmpfs主要存儲暫存的文件。

tmpfs默認(rèn)的大小是RM的一半,假如你的物理內(nèi)存是1024M,那么tmpfs默認(rèn)的大小就是512M。
tmpfs 的另一個主要的好處是它閃電般的速度。因為典型的tmpfs文件系統(tǒng)會完全駐留在內(nèi)存RAM中,讀寫幾乎可以是瞬間的。同時它也有一個缺點tmpfs數(shù)據(jù)在重新啟動之后不會保留,因為虛擬內(nèi)存本質(zhì)上就是易失的。
調(diào)整tmpfs是內(nèi)存的2倍(內(nèi)存1536):3072
查看磁盤分區(qū)情況:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 95G 5.0G 89G 6% /
tmpfs 747M 76K 747M 1% /dev/shm
/dev/sda1 190M 35M 145M 20% /boot
/dev/sda3 976M 1.4M 924M 1% /tmp
/dev/sr0 1.9G 1.9G 0 100% /media/CentOS-6.9-x86_64-LiveDVD
卸載tmpfs:
umount /dev/shm
進(jìn)程被占用,殺掉進(jìn)程:
fuser -km /dev/shm
再次卸載tmpfs:
umount /dev/shm
掛載tmpfs:
mount -t tmpfs -o size=3072m tmpfs /dev/shm
查看磁盤分區(qū)情況:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 95G 5.0G 89G 6% /
/dev/sda1 190M 35M 145M 20% /boot
/dev/sda3 976M 1.4M 924M 1% /tmp
/dev/sr0 1.9G 1.9G 0 100% /media/CentOS-6.9-x86_64-LiveDVD
tmpfs 3.0G 0 3.0G 0% /dev/shm
重新啟動后發(fā)現(xiàn),tmpfs仍回還原到內(nèi)存的一半,/etc/rc.local文件中手動加入remount命令
vi /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
mount -t tmpfs -o size=3072m tmpfs /dev/shm
重啟后,成功。
分享文章:CentOS6.9中調(diào)整tmpfs大小
URL標(biāo)題:http://www.5511xx.com/article/djgjpip.html


咨詢
建站咨詢
