网络文件系统nfs、samba、autofs、iscsi
前言
本章主要学习网络文件系统nfs和samba,其中nfs主要是linux系统间的网络文件共享、samba主要是windows系统与linux系统之间的网络文件系统。autofs服务配合网络文件系统进行自动挂载卸载。iscsi服务负责共享磁盘分区。
一、NFS
Net file system
1.基本信息
dnf install nfs-utils.x86_64 -y 安装
nfs-server 服务脚本
/etc/exports 共享文件配置
2.启用
systemctl enable --now nfs-server
firewalld-cmd --add-service=nfs
firewalld-cmd --add-service=mountd
firewalld-cmd --add-service=rpc-bind
vim /etc/exports
重启服务,进入b虚拟机进行测试:
showmount -e 172.25.254.139
nfs启用成功。
挂载:mount 172.25.254.139:/westos_storage /media
3.nfs配置
ro | 只读 |
rw | 读写 |
anonuid=1000 | 指定用户为1000 |
anongid=1000 | 指定用户组为1000 |
sync | 更改外城保存后同步到服务器 |
async | 实时同步服务器 |
no_root_squash | root用户挂载不转换身份 |
vim /etc/exports
chmod 777 /westos_storage/
重启服务,进入b虚拟机中,可创建文件
指定创建文件身份:
vim /etc/exports
重启服务,进入b端测试,
root用户挂载且不转换身份:
vim /etc/exports
重启服务,进入b端
4.nfs+autofs
在b端虚拟机中进行
dnf install autofs-1:5.1.4-40.el8.x86_64 -y 安装插件
vim /etc/auto