mount -t nfs -o intr,soft,retry=1 cm3nas1.taobaobackup.com:/vx/tbpe_bak01   /home/admin/data_backup


/home/admin/data_backup  这是本地已经建立好的挂载目录
同时添加到/etc/rc.local



Server端:
1./etc/exports格式:
           目录                     选项            
例:共享/share目录给192.168.0.x的用户
          /share                192.168.0.0/24 (rw)  

/mnt/sda4/share/a      192.168.23.129(rw)
设置共享目录/mnt/sda4/share/a,仅192.168.23.129主机允许访问此共享目录,具有读写权限


/mnt/sda4/share/b      192.168.23.129(rw) *(ro)
设置共享目录/mnt/sda4/share/b,192.168.23.129可以读写该共享目录,其他主机只可以读取该共享目录

/mnt/sda4/share/c       192.168.23.129(no_root_squash)
设置共享目录/mnt/sda4/share/c,仅192.168.23.129可以访问和读写,root登录时拥有root权限


/mnt/sda4/share/d      192.168.23.0/24(rw)
设置共享目录/mnt/sda4/share/d,仅有192.168.23.0/24网段的主机才可访问和读写此目录文件

/u01/db3    192.168.92.21(rw,sync,no_root_squash)

选项说明:
权限参数说明如下:
rw:read-write可读写的权限
ro:read-only只读权限
no_root_squash:登入NFS主机使用共享目录的用户,如果是用户root,对于此共享目录具有root权限,不建议使用。
root_squash:登入NFS主机使用共享目录的用户,如果是用户root,此用户权限将被压缩为匿名用户,其UID和GID都会被压缩为nobody(nfsnobody)系统账号的身份。
all_squash:不论登入NFS的用户身份为何,其身份都被转换成为匿名用户,即nobody。
Anonuid:anonymous;即nobody,可以自行设定此UID值,但此UID必须存在于/etc/passwd中。
Anongid:同anonuid,变成group ID即可。
sync:数据同步写入到内存与硬盘中
async:数据先暂存于内存中,而非直接写入硬盘


no_root_squash 信任客户端,对应 UID
noaccess 客户端不能使用


2.启动portmap服务:                                    
   service portmap start[restart]                    
3.启动NFS服务:
   service nfs start[restart]      

Client端:
client 要查看 Server 有提供哪些 NFS 服务,可以使用 showmount 这个指令。
# showmount -e  显示某台主机的/etc/exports所共享的目录数据
# showmount -a  显示当前主机与客户端NFS联机共享状态



1.启动portmap服务:                                    
   service portmap start[restart]                    
2.挂载服务器端的共享目录(假设服务器端192.168.0.1):  
   mount -t nfs 192.168.0.1:/share  /mnt/localshare  


如果修改/etc/exports文件之后无需重启nfs,只需重新扫瞄一次文件/etc/exports,并且重新将设定加载即可;
Exportfs:
-a:全部挂载(或卸载)/etc/exports 文件内的设置。
-r:重新挂载/etc/exports里的设置,同时同步更新/etc/exports及/var/lib/nfs/xtab的内容。
-u:卸载某一目录。
-v:在export时,将共享的目录显示在屏幕上。
重新挂载/etc/exports的设置:#exportfs–arv
全部卸载/etc/exports的设置:#exportfs–auv


查用的挂载
服务端:
[root@w017014.isv ~]# cat /etc/exports
/u01 192.168.17.0/24(rw,sync,no_root_squash)

客户端:
mount -t nfs -o noatime,soft,retry=1,intr 172.23.142.9:/nas/tbpe_bak01       /mount_point

mount -t nfs -o rsize=65536,wsize=65536,vers=3,noatime 192.168.50.3:/var/www/html/guoguobang/userres  /var/www/html/guoguobang/userres

mount -t nfs -o rsize=65536,wsize=65536,vers=3,noatime 192.168.60.1:/home/admin/nginx/htdocs/p_w_upload  /home/admin/nginx/htdocs/p_w_upload