Files
nexus/wiki/concepts/NFS永久挂载.md

49 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: NFS永久挂载
type: concept
tags: [nfs, ubuntu, nas, fstab, mount]
---
## Definition
NFS 永久挂载是通过 /etc/fstab 配置使网络文件系统NFS在系统启动时自动挂载而非手动 mount 重启后失效。
## Problem
手动 mount 命令是临时的,重启后内核重置所有挂载状态。
## Solution
在 /etc/fstab 中添加 NFS 挂载条目:
```
192.168.3.17:/volume2/backup /mnt/nas_backup nfs defaults,timeo=900,retrans=5,_netdev 0 0
```
## Key Parameters
| 参数 | 含义 |
|------|------|
| defaults | 默认挂载选项rw, suid, dev, exec, auto, nouser, async |
| timeo=900 | 超时 90 秒(单位 1/10 秒) |
| retrans=5 | 超时后重试 5 次 |
| _netdev | 告诉系统这是网络设备,等网络就绪后再挂载(防止开机卡死) |
## 验证方法
```bash
sudo umount /mnt/nas_backup # 卸载当前挂载
sudo mount -a # 模拟开机自动挂载
df -h | grep nas_backup # 验证挂载成功
```
## 故障排查
- 重启后仍然失效systemctl enable remote-fs.target
- nfs-common 服务启动慢于 mount -a_netdev 参数解决
## 完整部署指南
[[如何在UbuntuServer上通过NFS挂载Synology NAS上的共享文件夹]] 包含:
- Synology DSM NFS 权限配置步骤截图
- NFS 永久挂载参数详解_netdev 为关键防开机卡死参数)
- rsync 备份脚本挂载检查逻辑
- 常见问题remote-fs.target 启用
## Connections
- [[Ubuntu服务器通过rsync实现日常增量备份]] — 应用场景
- [[rsync增量备份]] — 备份目标端挂载
- [[Synology NAS]] ← 提供 ← NFS 存储服务192.168.3.17:/volume2/backup