NFS:Network File System网络文件系统
6/16/2016 9:45:26 AM
实现linux系统之间资源共享。
下载安装nfs-kernel-server
可以通过netstat检查NFS端口(2049)是否打开,以及SUNRPC端口(111)是否处于监听状态。
为了能够方便的使用nfs,我将命令加入到.bashrc中:
alias nfs='sudo /etc/init.d/nfs-kernel-server'
- 配置服务器
#/etc/exports
# /source/nfs/rootfs: shared dir
# * : allow all the ip seg access
# rw: athourization
# sync : write data to hard disk and ram syncly
# no_subtree_check : do not check father menu athourization
# no_root_squash: if the visitor visit as the root in client,he will be the root
#
/source/nfs/rootfs *(rw,sync,no_subtree_check,no_root_squash)
手动启动或者关闭服务
NFS服务的守护进程,持续监听端口,独占运行。
用户可使用NFS初始化脚本手动启停NFS服务。
服务器端更改共享资源后,要重启NFS服务。
sudo /etc/init.d/nfs-kernel-server start //启动服务
----- stop //关闭服务
----- restart //重启
----- status //查看状态
- 客户端查看:
showmount [-dehv] NFSServername/IP //显示指定服务器的共享信息
showmount //查看本地共享的资源
- 挂载共享资源
mount -t nfs NFSsvrname/Ip:/shareddir /mnt/nfs
//将制定的服务器NFSsvrname或服务器ip下的分享目录挂在到本地的/mnt/nfs下
- 卸载共享资源
umount /mnt/nfs