incloud开发文档 5.1.0 Help

NFS 配置

安装NFS服务

基于centos系统,在线安装NFS服务,执行以下命令:

yum install -y nfs-utils rpcbind

离线安装NFS服务

  1. 下载NFS服务安装包: Centos NFS-lib.tar

  2. 解压安装包:

tar -xvf nfs-lib.tar

执行以下命令安装NFS服务:

./install.sh

配置NFS服务

  1. 创建NFS共享目录:

mkdir -m 777 /nfs
  1. 编辑NFS配置文件/etc/exports ,添加如下内容:

/nfs *(rw,sync,no_root_squash)

如果修改了/etc/exports,需要重新激活配置文件:

exportfs -r
  1. 重启NFS服务:

systemctl restart rpcbind && systemctl enable rpcbind systemctl restart nfs-server && systemctl enable nfs-server

验证NFS服务

  1. 查看NFS服务状态:

systemctl status nfs-server
  1. 查看NFS共享目录:

showmount -e localhost
  1. 挂载NFS共享目录: 客户机可挂载,可不挂,如果部署k8s时支持NFS,那么客户端就需要挂载,挂载命令如下:

mount -t nfs share:/nfs /nfs

卸载客户端的挂载

umount -l /nfs

参数说明:

  • -l :立即卸载文件系统,忽略正在使用的文件或者程序。

  • /nfs :挂载的目录。

  • share:/nfs :NFS服务器的IP地址或者主机名。

  • localhost :本地主机名。

  • rw :读写权限。

  • sync :同步写入。

  • no_root_squash :不限制root用户的权限。

Last modified: 20 一月 2025