NFS
network file system 网络文件系统.
实现不同主机系统之间的共享 linux windows macos
安装、配置、nfs服务
1.安装
[root@nfs01 ~]# yum install nfs-utils -y
2.配置
1.要共享什么 /data
2.共享给谁 172.16.1.0/24
3.共享的权限 rw
[root@nfs01 ~]# cat /etc/exports
/data 172.16.1.0/24(rw)
3.根据配置创建目录
[root@nfs01 ~]# mkdir /data
[root@nfs01 ~]# chown -R nfsnobody.nfsnobody /data/
4.启动
[root@nfs01 ~]# systemctl start nfs
[root@nfs01 ~]# systemctl enable nfs
5.客户端测试
[root@web01 ~]# yum install nfs-utils -y
[root@web01 ~]# showmount -e 172.16.1.31
Export list for 172.16.1.31:
/data 172.16.1.0/24
[root@web01 ~]# mount -t nfs 172.16.1.31:/data /mnt
6.如果nfs意外中断
1.无法查看到挂载信息 mount
2.无法卸载挂载的设备 umount -lf
7.实现挂载开机自动
[root@web01 ~]# cat /etc/fstab
172.16.1.31:/data /mnt nfs defaults 0 0
[root@web01 ~]# mount -a
[root@web01 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
172.16.1.31:/data 100G 1.8G 99G 2% /mnt