2012年12月24日 星期一

[debian] How to move /etc into ramfs easily


> vi /etc/init.d/rcS

Add these lines before "exec /etc/init.d/rc S":

echo "* Initialize RAM /etc..."
[ ! -d /etc-model ] && mkdir /etc-model
mount --rbind /etc /etc-model
mount -n -t tmpfs none /etc
cp -a /etc-model/* /etc/

> vi /etc-model/init.d/umountfs

Add "/etc" in the line:
case "$MTPT" in |/proc|/dev/|..........|/etc)


基本上它運作的邏輯是: 開機時, rcS會自動把 /etc 掛成RAM,然後把舊的 /etc (位在/etc-model)copy進來。
所以之後要手動改系統預設的設定,都是要改 /etc-model 底下的。

沒有留言:

張貼留言