Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

CentOS/Debian NFS 版本不相容解決方案:指定 vers=3 掛載參數

編輯:關於 Linux

Debian 預設支援 NFSv4,CentOS 舊版預設 NFSv3。跨版本掛載時出現 NFS: bad mount option value specified: vers=4 錯誤。解決方法:在掛載指令加入 -o vers=3 或 nfsvers=3 強制使用 NFSv3 協定。

錯誤現象

mount -t nfs 192.168.0.100:/nfsroot /mnt
# NFS: bad mount option value specified: vers=4
# mount.nfs: an incorrect mount option was specified

解決指令

# 客戶端執行(強制 NFSv3)
mount -t nfs 192.168.0.100:/nfsroot /mnt -o vers=3
# 或
mount -t nfs 192.168.0.100:/nfsroot /mnt -o nfsvers=3

# 寫入 /etc/fstab 永久生效
192.168.0.100:/nfsroot  /mnt  nfs  vers=3,defaults  0  0

伺服端重新匯出

exportfs -r
# 重新讀取 /etc/exports 並匯出

NFS 掛載錯誤截圖

背景知識

  • NFSv4:單一埠口 (2049)、支援 ACL、狀態協定、idmapper 需配置。
  • NFSv3:需 rpcbind (111)、mountd、statd、lockd 多埠口,相容性較好。
  • Solaris 10 預設 NFSv4,Linux 客戶端常需降級至 v3。
  • 現代 Linux(RHEL 7+/CentOS 7+/Debian 8+)雙端預設 v4,通常無需指定。

驗證協定版本

# 查看目前掛載使用的版本
nfsstat -m
# 或
cat /proc/mounts | grep nfs
# 顯示 vers=3.0 或 vers=4.0
Copyright © Windows教程網 All Rights Reserved