您的位置:首页 > 运维架构 > Linux

CentOS6.5 NFS挂载

2016-09-21 14:06 176 查看
1、创建NFS服务端
2、Linux客户端挂载Linux的NFS
3、Windows客户端挂载Linux的NFS

一、配置NFS服务端
1.查看是否有nfs-utils rpcbind服务
[root@nfsserver mnt]# rpm -qa nfs-utils rpcbind \\\\查看nfs、rpcbind服务是否安装
[root@nfsserver mnt]#yum grouplist \\\\查看安装的包组有哪些
[root@nfsserver mnt]yum install "NFS file server" -y \\\\安装nfs服务
[root@nfsserver mnt]yum install nfs-utils portmap rpcbind -y \\\\安装nfs服务
chkconfig rpcbind on \\\\配置rpcbind服务开机启动
chkconfig nfs rpcbind \\\配置nfs服务开机启动
2.配置后检查
chkconfig --list rpcbind
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
chkconfig --list nfs
nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off

[root@Donglq ~]# rpcinfo -p localhost \\\\查看本地启动哪些rpcbind端口

3.配置/etc/exports文件
[root@nfsserver mnt]# cat /etc/exports
###shared data for bbs by oldboy at 20160920
/data 192.168.0.0/24(rw,sync)
[root@Donglq ~]# /etc/init.d/rpcbind start \\\\启动rpcbind服务
[root@Donglq ~]# /etc/init.d/nfs start \\\\启动nfs服务
[root@Donglq ~]# /etc/init.d/nfs status \\\\启动服务后检查服务启动情况
[root@Donglq ~]# /etc/init.d/rpcbind status \\\\启动服务后检查服务启动情况
[root@Donglq ~]# showmount -e localhost \\\\服务端检查本地共享
Export list for localhost:
/data 192.168.0.252/24
4.显示以上结果证明NFS在server端已经配置成功

二、Linux客户端挂载Linux的NFS
在客户端查看NFS192.168.0.252是否能查询到共享目录
[[root@Donglq ~]# showmount -e 192.168.0.252
Export list for 192.168.0.252:
/data 192.168.0.252/24
上面结果是我配置好的
注:如果show不出来如上结果,查询物理是否连通

[root@Donglq~]#mount -t nfs 192.168.0.252:/data/mnt\\\\将NFS服务器0.252共享的/data共享到本地/mnt
[root@Donglq ~]#df -h \\\\查看挂载

Filesystem Size Used Avail Use% Mounted on
/dev/sda2 11G 1.1G 8.5G 11% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 190M 47M 134M 26% /boot
192.168.0.252:/data 274G 29G 232G 11% /mnt
进入/mnt查看共享的文件
[[root@Donglq ~]#cd /mnt
[root@Donglq mnt]# ll -li
total 28915320
13107203 -rwxr-xr-x 1 nobody nobody 3 Sep 20 10:49 12.txt
13107202 drwxr-xr-x 2 root root 4096 Sep 20 10:27 {1-5}
13107205 -rw-r--r-- 1 root root 0 Sep 20 10:31 1.txt
13107204 drwxr-xr-x 2 root root 4096 Sep 20 10:30 5
13107206 -rwxr-xr-x 1 nobody nobody 3420557312 Aug 16 2011 cn_windows_7_ultimate_with_sp1_x64_dvd_u_677408.iso

三、Windows客户端挂载Linux的NFS
已win7系统为例 开始->控制面板->程序和功能->打开或关闭windows功能->NFS服务器->NFS客户端
win+r >cmd
mount 192.168.0.252:/data G:
G: 现已成功连接到 192.168.0.252:/data
命令已成功完成。
解释: mount,是指令192.168.1.10你的linux主机IP/data你的共享目录G:你挂载的网络文件盘--注意,可能会与你的其他盘冲突,你可以随意更改
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Windows server NFS