Linux 存储与 NFS 服务配置

Linux 存储与 NFS 服务配置

Jackson Lv3

本文介绍 Linux 系统中的 NFS 服务配置及文件存储管理的相关内容。

NFS 服务配置

基础安装

1
2
3
4
5
dnf -y install rpcbind nfs-utils
systemctl start rpcbind
systemctl start nfs-server
systemctl enable rpcbind
systemctl enable nfs-server

配置文件

编辑 /etc/exports:

1
2
/share1 *(sync,ro) 192.168.x.x(sync,rw,no_root_squash)
/share2 192.168.x.0/24(sync,ro)

权限说明

  • rw/ro: 读写/只读权限
  • sync/async: 同步/异步写入
  • root_squash: root用户权限压制
  • no_root_squash: 保留root权限

备份策略

备份要点

  1. 创建备份目录
  2. 配置NFS共享
  3. 设置自动挂载
  4. 配置定时任务

下载工具

NFS工具包
备份脚本示例


1
2
3
#!/bin/bash
date="$(date +%F)"
cp /etc/passwd /mnt/pass_$date

  • Title: Linux 存储与 NFS 服务配置
  • Author: Jackson
  • Created at : 2022-09-22 14:05:34
  • Updated at : 2025-02-18 00:23:40
  • Link: https://839738.xyz/posts/fdea95f5.html
  • License: This work is licensed under CC BY-NC-SA 4.0.