二、NFS客户端配置
A.手动加载(与上面服务器上的回环测试是一样的)
[root@zoro ~]# mount -t nfs 192.168.56.101:/dir /mnt
[root@zoro ~]# ls /mnt
t01 t02 t03 lost+found
(注:相当于windows里的磁盘映射,但下次开机后,需要重新加载)
B.设备自动加载
(注:进行该设置后,当访问服务器端的共享目录时,系统用自动加载服务器上的共享目录,如果一段时间(5分钟或10分钟)不操作,系统用自动卸载。)
1.设置挂载点
[root@zoro ~]# vim /etc/auto.master
#/misc /etc/auto.misc
/dir /etc/auto.misc
……
(注:为防止意外出现,操作前确保本地系统没/dir目录,设置后,会自动生成的)
2.配置文件的设置
[root@zoro ~]# vim /etc/auto.misc
#linux -ro,soft,intr ftp.example.org:/pub/linux
101dir -rw,soft,intr 192.168.56.101:/dir
……
(注:101dir表示用于访问目录,可以随便设置,最后客户端访问的/dir/101dir,就是服务器端的/dir目录)
3.重新加载autofs
如果已开启autofs,则重载,不必要restart
[root@zoro ~]# service autofs reload
Reloading maps
如果没有开启,则开启,
[root@zoro ~]# service autofs start
Starting automount: [ OK ]
4.访问服务器端的共享文件
以下命令,/dir是可能通过tab自动补充完整的,但101dir要手动输入,
[root@zoro ~]# cd /dir/101dir
[root@zoro 101dir]# ls
t01 t02 t03 lost+found
[root@zoro 101dir]# cat t01
T01
[root@zoro 101dir]# touch t04
touch: cannot touch `t04': Read-only file system
(以上操作,在进入远端共享目录时,反映比较很慢,不知道是否是网络原因;另外,发现有r权限,但没有w权限,有点奇怪,由于服务器端及客户端的配置都是rw,按理应该是可读可写的,未得解)
