Linux

為什麼重新啟動後 NFS 拒絕權限?

  • December 16, 2013

我有 Ubuntu 和 CentOS 客戶端 nfsv3 安裝到 FreeBSD 盒子,在連接 nfs 客戶端時重新啟動。現在,客戶端在嘗試訪問掛載點時會被拒絕。

在我嘗試過的客戶端上

# umount /nobackup/dat
umount.nfs: /nobackup/dat: device is busy
umount.nfs: /nobackup/dat: device is busy

# fuser /nobackup/dat
Cannot stat file /proc/1660/fd/473: Stale NFS file handle
Cannot stat file /proc/1660/fd/475: Stale NFS file handle
Cannot stat file /proc/1660/fd/476: Stale NFS file handle
Cannot stat file /proc/1660/fd/478: Stale NFS file handle
Cannot stat file /proc/1660/fd/479: Stale NFS file handle
Cannot stat file /proc/14509/fd/1: Stale NFS file handle
Cannot stat file /proc/14674/fd/1: Stale NFS file handle
Cannot stat file /proc/14871/fd/1: Stale NFS file handle
Cannot stat file /proc/27872/fd/436: Stale NFS file handle
Cannot stat file /proc/27872/fd/444: No such file or directory

# umount -f /nobackup/dat
umount2: Device or resource busy
umount.nfs: /nobackup/dat: device is busy
umount2: Device or resource busy
umount.nfs: /nobackup/dat: device is busy

更新

現在我已經殺死了所有程序並成功解除安裝/nobackup/dat,但由於某種原因我仍然收到權限被拒絕錯誤。

# fuser -m /nobackup/dat 2>&1 | awk -F'/' '{print $3}' | xargs -n 1 kill
# fuser -m /nobackup/dat
# umount -l /nobackup/dat
# ll /nobackup/dat
ls: cannot open directory /nobackup/dat: Permission denied

# mount /nobackup/dat
mount.nfs: access denied by server while mounting (null)

問題

有什麼建議如何調試嗎?

問題是客戶端沒有意識到 nfs 伺服器消失了,所以他們仍在嘗試訪問上一次掛載文件系統時創建的文件句柄。

通常,重新啟動客戶端是使其重新掛載文件系統的可靠方法。但是,如果您不想這樣做,請先終止所有嘗試使用 NFS 文件系統的程序。之後,您可以嘗試“延遲解除安裝”

umount -l

您也可以嘗試重新掛載文件系統,使用

mount -o remount 

否則,舊文件句柄在某個時候超時,但我不知道需要多長時間。

成功擺脫陳舊的文件句柄後,重新掛載文件系統:

mount nobackup/dat

引用自:https://serverfault.com/questions/561642