- 下載和配置
nfs
(server
)
- 關(guān)firewall
創(chuàng)建分區(qū)和掛載- 下載
nfs
yum install -y nfs-utils.x86_64
- 配置
vi /etc/sysconfig/nfs
RQUOTAD_PORT=875 LOCKD_TCPPORT=32803 LOCKD_UDPPORT=32769 MOUNTD_PORT=892
- 啟動
systemctl enable rpcbind
systemctl enable nfs-server.service
systemctl start rpcbind
systemctl start nfs
- 配置
vi /etc/exports
/home/nfsdir *(rw,sync,no_root_squash) /home/nfsdir1 *(rw,sync,no_root_squash) ...
注:注意
nfsdir
nfsdir1
目錄一定要先創(chuàng)建三圆;是不是分區(qū)根目錄篱瞎,掛不掛分區(qū)無所謂
- 修改了
/etc/exports
之后使之生效
使用以下命令重啟服務(wù):
systemctl restart rpcbind
systemctl restart nfs
或使用:exportfs -r
- 查看nfs掛載
showmount -e
注: 執(zhí)行showmount -e
報錯clnt_create: RPC: Program not registered
systemctl restart rpcbind
systemctl restart nfs
image.png
注:nfs
可以exports
任何目錄谭网,不一定是一個分區(qū)的根目錄博肋,它會自動去找本目錄所屬的分區(qū)低斋,并提供這個分區(qū)大小的存儲蜂厅。nfs
服務(wù)并不會自動創(chuàng)建exports
的目錄,所以需要手動創(chuàng)建目錄拔稳。
- 下載和掛載
nfs
(centos7
client
)
- 下載
nfs
yum install -y nfs_utils
- 啟動
systemctl enable rpcbind
systemctl enable nfs-server.service
systemctl start rpcbind
systemctl start nfs
- 掛載
mount -t nfs 192.168.0.200:/home/nfsdir /home/testnfsdir
- 解除掛載
umount /home/testnfsdir
- 開機(jī)自動掛載
vi /etc/fstab
... 192.168.0.200:/home/nfsdir /home/testnfsdir nfs defaults 0 0
- 掛載(
win7
client
)
- 掛載
mount -o anon mtype=soft lang=ansi 192.168.0.200:/home/nfsdir z:\