Debian GNU/Linux 下的tmpfs
时间:2006-01-16 来源:零二年的夏天
文章源自:摩托学园
簡單的說 tmpfs 是一套以使用記憶體為基礎的檔案系統,不同於 ramdisk 的最大差別在於, ramdisk 雖然也使用記憶體..但它的行為屬於 Block device ,所以使用前必須先 format ( mkfs ) ,而 tmpfs 使用上就很方便囉.. 直接 mount 即可。
#! /bin/sh
#
# mounttmpdir Mount /tmp after mounvirtfs exec-ed
#
# Version: @(#)mounttmpdir 0.01 24-Dec-2004 antony shen
#
# Script needs to be robust and continue when parts fail,
# so we're not setting the "-e" flag.
#set -e
PATH=/lib/init:/bin:/sbin
if [ -d /dev/shm ]
then
if [ ! -d /dev/shm/tmp ]
then
echo -n "Mounting /tmp under /dev/shm..."
mkdir /dev/shm/tmp
chmod 1777 /dev/shm/tmp
mount --bind /dev/shm/tmp /tmp
echo "OK.
fi
else
echo "Failed to find /dev/shm, unable to link /tmp under it!"
fi
接者,可以用 update-rc.d 指令:
update-rc.d mounttmpdir start 37 S .
將這個 init.d script 加到 rcS 裡面。就可以運作了。大家可以試試看。\\r
相关阅读 更多 +
排行榜 更多 +