auto mount 它是屬於 dynamic mount, 也就是說,當(dāng)你有使用這個 mount 的目錄
時, 系統(tǒng)才會自動的幫你把這個目錄mount進(jìn)來.
它不同於 static mount , 是在於 static mount 是在系統(tǒng)開機(jī)時, 便 mount 進(jìn)來
了,而且除非系統(tǒng)關(guān)機(jī),或是 root 把它 unmount 掉, 不然的話,你隨時打 mount,
都可以看到它有 mount 上.
使用 auto mount 的好處是,因為它是在你有用到該目錄時才做 mount 的動作,
所以用它來 mount NFS 的話,可以不必等對方的 server 起來, 你就能開機(jī),而且
auto mount 它有設(shè)定說,在一定時間內(nèi),如果該目錄沒被使用,則系統(tǒng)會自動將它
unmount 掉. 這樣又可減少因 mount NFS 而影響系統(tǒng)效率.
在 solaris 中,要設(shè)定 automount ,你可以去 man automount.
以下簡單說明如何設(shè)定 automount.
1. 修改 /etc/auto_master
這個檔是 automount 的主要設(shè)定檔,它里面有定義要 mount 那些目錄.
另外,它亦可以參考到另一個你自己設(shè)定的 automount 設(shè)定檔.
下面舉一個例子說明如何設(shè)定 ( auto_myconfig 是自己的設(shè)定檔)
% more /etc/auto_master
# Master map for automounter
#
+auto_master
/net -hosts -nosuid,nobrowse
/- /etc/auto_myconfig
/home auto_home -nobrowse
/xfn -xfn
% more /etc/auto_myconfig
/usr/local -rw,intr sparc:/usr/local
在 /etc/auto_myconfig 中,則是去 mount 一臺叫 sparc 它所 share 出來
/usr/local 的目錄, 并將它 mount 到自己機(jī)器的 /usr/local
ps. 如果你使用 automount 的話,在你自己的機(jī)器上,并不需要自己去建立
要 mount 的目錄, 以上面為例,你并不需要在 /usr 下建立 local 這
個目錄再做 mount. auto mount 它會自動幫你建立這個目錄,且?guī)湍?
mount 上去.
2. 改好了 auto mount 的設(shè)定檔之後,你必需重跑 autofs 才會使你修改的
auto mount 生效. 執(zhí)行方法如下:
% su
% cd /etc/init.d
% autofs stop
% autofs start
也就是說, 你要以 root 的身份,先讓 aufofs 停掉, 再讓它重新 start 就可
以了.
執(zhí)行完之後, 你就可以到你 mount 的目錄下打 ls 看看是否有 mount 進(jìn)來了.