NFS客户端配置使用(2)

nfs客户端!

1,启动rpcbind

[root@NFS-WEB1 ~]# /etc/init.d/rpcbind start
Starting rpcbind:                                          [  OK  ]
[root@NFS-WEB1 ~]# chkconfig rpcbind on

或者把rpcbind放在rc.local中

2,尝试连接

[root@NFS-WEB1 ~]# showmount -e 10.0.0.52
Export list for 10.0.0.52:
/data 10.0.0.0/24
[root@NFS-WEB1 ~]# 

3,尝试挂载

[root@NFS-WEB1 ~]# mount -t nfs 10.0.0.52:/data /mnt
[root@NFS-WEB1 mnt]# ls /mnt/linuxea.txt 
/mnt/linuxea.txt
[root@NFS-WEB1 mnt]# 

查看

[root@NFS-WEB1 ~]# df -h
Filesystem       Size  Used Avail Use% Mounted on
/dev/sda2         18G  2.5G   15G  15% /
tmpfs            491M     0  491M   0% /dev/shm
/dev/sda1        283M   28M  240M  11% /boot
10.0.0.52:/data   18G  2.5G   15G  15% /mnt

[root@NFS-WEB1 ~]# mount
/dev/sda2 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
10.0.0.52:/data on /mnt type nfs (rw,vers=4,addr=10.0.0.52,clientaddr=10.0.0.53)

[root@NFS-WEB1 ~]# cat /proc/mounts 
rootfs / rootfs rw 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
devtmpfs /dev devtmpfs rw,relatime,size=490816k,nr_inodes=122704,mode=755 0 0
devpts /dev/pts devpts rw,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /dev/shm tmpfs rw,relatime 0 0
/dev/sda2 / ext4 rw,relatime,barrier=1,data=ordered 0 0
/proc/bus/usb /proc/bus/usb usbfs rw,relatime 0 0
/dev/sda1 /boot ext4 rw,relatime,barrier=1,data=ordered 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
vmware-vmblock /var/run/vmblock-fuse fuse.vmware-vmblock rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
10.0.0.52:/data/ /mnt nfs4 rw,relatime,vers=4,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.53,minorversion=0,local_lock=none,addr=10.0.0.52 0 0
[root@NFS-WEB1 ~]# 

4,开机挂载

[root@NFS-WEB1 mnt]# vim /etc/rc.local
/etc/init.d/rpcbind start
mount -t nfs 10.0.0.52:/data /mnt

这里是不能放在fstab中,因为nfs是先启动,网络是后启动,当启动时候先启动网络是挂载不上的!

web2挂载即可使用!

[root@NFS-WEB2 ~]# /etc/init.d/rpcbind start
Starting rpcbind:                                          [  OK  ]
[root@NFS-WEB2 ~]# chkconfig rpcbind on
[root@NFS-WEB2 ~]# vim /etc/rc.local 
[root@NFS-WEB2 ~]# cat /etc/rc.local
/etc/init.d/rpcbind start
mount -t nfs 10.0.0.52:/data /mnt
[root@NFS-WEB2 ~]# mount -t nfs 10.0.0.52:/data /mnt
[root@NFS-WEB2 ~]# cd /mnt/

在centos5中web2删除web1是需要指定nfsnobody的

1 分享

您可以选择一种方式赞助本站

支付宝扫码赞助

支付宝扫码赞助

日期: 2015-12-22分类: NFS

标签: nfs

发表评论