NFS 相关操作指令

1、启动NFS服务器

为了使NFS服务器能正常工作,需要启动portmap和nfs两个服务,并且portmap一定要先于nfs启动。

#service portmap start         
#service nfs start

RHEL4和5是portmap 和 nfs,RHEL6以后改名叫作rpcbind 和 nfs-server 了

另外RHEL 7以后对服务的操作命令建议使用:systemctl [status|stop|start|restart] [serviceName] 

如:systemctl status rpcbind   、  systemctl restart nfs-server

2、查询NFS服务器状态

#service portmap status
#service nfs status

3、停止NFS服务器

要停止NFS运行时,需要先停止nfs服务再停止portmap服务,对于系统中有其他服务(如NIS)需要使用时,不需要停止portmap服务

#service nfs stop
#service portmap stop

4、重启portmap 和nfs 服务

#service portmap restart
#service nfs restart
#exportfs

5、设置NFS服务器的自动启动状态

对于实际的应用系统,每次启动LINUX系统后都手工启动nfs服务器是不现实的,需要设置系统在指定的运行级别自动启动portmap和nfs服务。

#chkconfig --list portmap
#chkconfig --list nfs

设置portmap和nfs服务在系统运行级别3和5自动启动。

#chkconfig --level 35 portmap on
#chkconfig --level 35 nfs on

6、服务器端使用showmount命令查询NFS的共享状态

#showmount –e       //默认查看自己共享的服务,前提是要DNS能解析自己,不然容易报错
#showmount –a IP    显示指定NFS服务器的客户端以及服务器端在客户端的挂载点
#showmount –d IP    显示指定NFS服务器在客户端的挂载点
#showmount –e IP    显示指定NFS服务器上的共享目录列表(或者叫输出列表)

7、显示已经与客户端连接上的目录信息

#showmount -a

8、客户端使用showmount命令查询NFS的共享状态

#showmount -e NFS服务器IP

 

 

 

posted @ 2017-05-14 15:50  当年亦如是  阅读(660)  评论(0编辑  收藏  举报