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

tmpfs默認(rèn)的大小是RM的一半,假如你的物理內(nèi)存是1024M,那么tmpfs默認(rèn)的大小就是512M。
tmpfs 的另一個(gè)主要的好處是它閃電般的速度。因?yàn)榈湫偷膖mpfs文件系統(tǒng)會(huì)完全駐留在內(nèi)存RAM中,讀寫幾乎可以是瞬間的。同時(shí)它也有一個(gè)缺點(diǎn)tmpfs數(shù)據(jù)在重新啟動(dòng)之后不會(huì)保留,因?yàn)樘摂M內(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
重新啟動(dòng)后發(fā)現(xiàn),tmpfs仍回還原到內(nèi)存的一半,/etc/rc.local文件中手動(dòng)加入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大小
網(wǎng)站路徑:http://fisionsoft.com.cn/article/djgjpip.html


咨詢
建站咨詢
