当exports文件修改后,使用以下命令,不需要重启NFS服务,就可以重新挂载/etc/exports里面的设定:
exportfs -arv
3.先启动portmap服务:
service portmap restart
4.再启动NFS服务:
service nfs restart
如果之前没有先启动portmap服务,那么当启动NFS服务时会停在
Starting NFS daemon:
很长时间。
5.设置nfs、portmap开机自启动:
chkconfig --level 345 nfs on
chkconfig --level 345 portmap on

6.客户端也需要安装nfs-utils、portmap软件包,并启动portmap服务:
yum install nfs-utils portmap
service portmap restart
chkconfig --level 345 on
7.NFS服务端启动成功后,客户端可以利用showmount命令测试是否能连上服务端:
命令式:showmount -e [hostname|IP],showmount命令需要安装了nfs-utils软件包才有。
showmount -e 192.168.1.2
显示如下:
/home/nfsdir *
/home/share (everyone)
8.客户端建立挂载的文件夹:
cd /mnt
mkdir nfs1
mkdir nfs2
9.客户端使用mount命令挂载NFS共享文件:
mount -t nfs 192.168.1.2:/home/nfsdir /mnt/nfs1
mount -t nfs 192.168.1.2:/home/share /mnt/nfs2
命令式:mount - t nfs nfs服务器地址:目录共享 本地挂载目录点
10.客户端可使用df命令,mount命令查看挂载情况:
mount
192.168.1.2:/home/share on /mnt/nfs2 type nfs (rw,addr=192.168.1.2)
192.168.1.2:/home/nfsdir on /mnt/nfs1 type nfs (rw,addr=192.168.1.2)
11.客户端卸载NFS文件命令:
umount /mnt/nfs1
umount /mnt/nfs2
12.客户端可以设置系统启动时自动挂载NFS文件:
需要将NFS的共享目录挂载信息写入/etc/fstab/文件,以实现对NFS共享目录的自动挂载。rpcbind
vim /etc/fstab
在最后加入如
192.168.1.2:/home/nfsdir /mnt/nfsdir nfs defaults 0 0
13.查看当前主机RPC状态:
rpcinfo -p localhost
一个很纠结的错误
使用 mount -t nfs 127.0.0.1:/home/lzgonline/rootfs /mnt 和 mount -t nfs 192.168.1.9:/home/lzgonline/rootfs /mnt 本机挂载nfs则没有问题,然而使用 mount -t nfs 192.168.3.12:/home/lzgonline/rootfs /mnt 时却出现了问题,导致开发板无法通过nfs挂载启动,其中192.128.3.12 和 192.128.1.9(即nfs服务器)之间建立了映射(DMZ)关系。
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-39183-2.html
向美囯佬开炮
嫖娼