1. 安装nfs工具,其实是mount需要mount.fs
否则会出现类似如下错误:
[root@stds ~]# mount -t nfs 192.168.7.1:/home/tong/Src /root/src mount: wrong fs type, bad option, bad superblock on 192.168.7.1:/home/tong/Src, missing codepage or helper program, or other error (for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program) In some cases useful info is found in syslog - try dmesg | tail or so.
安装:
[root@stds ~]# yum install nfs-utils
2. 挂载:
[root@stds ~]# mount -t nfs 192.168.7.1:/home/tong/Src /root/src [root@stds ~]# ls anaconda-ks.cfg src [root@stds ~]# ll src/ total 0 drwxr-xr-x. 1 1000 1000 54 Nov 10 21:02 BUILD drwxr-xr-x. 1 1000 1000 110 Dec 1 17:09 copyleft drwxr-xr-x. 1 1000 1000 54 Mar 6 2017 copyright drwxr-xr-x. 1 1000 1000 20 Oct 9 11:46 INSTALL drwxr-xr-x. 1 1000 1000 376 Dec 6 14:04 thirdparty
3. 开机自动挂载:
在 /etc/fstab 中,添加如下行
[root@stds ~]# tail -n1 /etc/fstab 192.168.7.1:/home/tong/Src /root/src nfs defaults,nofail,actimeo=3600 0 0