CentOS7掛載NFS

本文記錄CentOS7作爲客戶端掛載NFS文件共享(含開機自動掛載)

環境示例說明

NFS 服務端: nfs.server.exp(192.168.1.10/24)
NFS 客戶端: nfs.client.exp(192.168.1.100/24)

客戶端安裝必要的包

# yum install nfs-utils

配置客戶端

修改域名(可選)

# vim /etc/idmap.conf

...
# 填寫域名,此處是server.exp
Domain = server.exp
...

啓動設置rpcbind服務

nfs服務依賴rpc遠程過程調用服務

# systemctl start rpcbind
# systemctl enable rpcbind

準備掛載的目的路徑

自定義目的路徑,此處爲"/vol/data"

# mkdir -p /vol/data

掛載NFS共享目錄

服務端共享目錄名爲/nfsshare

# mount -t nfs nfs.server.exp:/nfsshare /vol/data

或者使用IP

# mount -t nfs 192.168.1.10:/nfsshare /vol/data

如果要指出掛載的NFS版本,添加相應的參數,如下:

# mount -t nfs -o vers=3 nfs.server.exp:/nfsshare /vol/data

配置自啓自動掛載

# vim /etc/fstab

...
nfs.server.exp:/nfsshare    /vol/data    nfs    default    0 0
...
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章