nfs安裝與配置(debian)
好吧,這個(gè)錯(cuò)誤浪費(fèi)了我今天幾個(gè)小時(shí)的時(shí)間,必須把它記錄下來(lái)。
問(wèn)題是這樣的,在啟動(dòng)更新了portmap,exportfs,一些沒(méi)問(wèn)題后,在做/etc/init.d/nfs-kernel-server restart 出現(xiàn)
/etc/init.d/nfs-kernel-server start
Exporting directories for NFS kernel daemon
exportfs: /etc/exports [1]:
Neither 'subtree_check' or 'no_subtree_check' specified for export
"foobar".
Assuming default behaviour ('no_subtree_check').
NOTE: this default has changed since nfs-utils version 1.0.x
.
Starting NFS kernel daemon: nfsd
Not starting: portmap daemon is not running (warning).
警告提示portmap is not running
好吧,檢查一下portmap
/home/mnt/index# ps aux | grep portmap
daemon 31478 0.0 0.0 2052 624 ? Ss 13:59 0:00 /sbin/portmap
portmap的狀態(tài)已經(jīng)是running,在googling后,發(fā)現(xiàn)網(wǎng)上有人說(shuō)是
This is the problem, portmap is not actually running, causing rpc.statd
看來(lái)問(wèn)題還是出現(xiàn)rpc上,最主要的進(jìn)程rpc.mountd無(wú)法啟動(dòng)
好吧,接下來(lái)打開(kāi)/etc/init.d/nfs-kernel-server這個(gè)啟動(dòng)腳本進(jìn)行查看
# See if portmap or rpcbind are running
(cat </dev/null >/dev/tcp/localhost/111) 2>/dev/null
RET=$?
if [ $RET != 0 ]; then
echo
log_warning_msg "Not starting: portmap daemon is not running"
exit 0
fi
看來(lái)問(wèn)題就出來(lái)這個(gè),什么叫“/dev/tcp/localhost/111”,還是googling,網(wǎng)上有人說(shuō)
I find that this is a bashism, but the init-script is marked as a bash script at the
top:
!/bin/bash
再man Bash,發(fā)現(xiàn)
Bash, as packaged for Debian, does not support using the /dev/tcp and /dev/udp files
應(yīng)該很清楚了,如果按照這里的分析,那么我們需要對(duì)上面的這個(gè)啟動(dòng)腳本進(jìn)行一下修改就可以完成我們的目的,最直接的就是把exit 0注釋掉,另外說(shuō)一點(diǎn),這個(gè)腳本也有些寫(xiě)得不大合理,既然是log_warning_msg,一個(gè)warning,就不應(yīng)該直接的exit 0