Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计提醒

nfs-storagenfs 存储

Agent Skill

nfs-storage 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

755

周安装

34

GitHub Stars

18

下载量

280
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:nfs-storage(nfs 存储)
来源仓库:https://github.com/bagelhole/devops-security-agent-skills
仓库路径:skills/nfs-storage
安装命令:
npx skills add https://github.com/bagelhole/devops-security-agent-skills --skill nfs-storage
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/bagelhole/devops-security-agent-skills --skill nfs-storage

简介

用于查找、检索和筛选相关信息。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

  • 适合根据关键词快速定位候选结果时使用。
  • 可集成到主流 Agent 工具中进行线索梳理。
  • 使用前应确认数据来源与维护状态。
  • nfs-storage 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

NFS Storage

Configure NFS servers and clients for network file sharing across Linux systems. Covers NFSv4 server setup, export options, client mounting, autofs for on-demand mounts, Kerberos security, performance tuning, and Kubernetes integration.

When to Use

  • Sharing directories between multiple Linux servers (web farms, build clusters)
  • Providing shared storage for containerized workloads (Kubernetes ReadWriteMany)
  • Centralizing home directories or application data across a fleet
  • Setting up a development environment with shared project files
  • Migrating from local storage to network-attached storage

Prerequisites

  • NFS server: nfs-kernel-server (Debian/Ubuntu) or nfs-utils (RHEL/CentOS)
  • NFS client: nfs-common (Debian/Ubuntu) or nfs-utils (RHEL/CentOS)
  • Network connectivity between server and clients (TCP/UDP 2049 for NFSv4)
  • Firewall rules allowing NFS traffic
  • For NFSv4 Kerberos: krb5-user and a functioning KDC

NFS Server Setup

Installation

# Debian / Ubuntu
apt update && apt install -y nfs-kernel-server

# RHEL / CentOS
dnf install -y nfs-utils

# Enable and start the NFS server
systemctl enable --now nfs-server

# Verify NFS is running
systemctl status nfs-server
rpcinfo -p | grep nfs

Export Configuration (/etc/exports)

# /etc/exports
# Syntax: <directory> <client-spec>(options)

# Share /data to a specific subnet with read-write access
/data 10.0.0.0/24(rw,sync,no_subtree_check,no_root_squash)

# Share /shared read-only to everyone
/shared *(ro,sync,no_subtree_check)

# Share /home to specific hosts
/home server01.example.com(rw,sync,no_subtree_check)
/home server02.example.com(rw,sync,no_subtree_check)

# Share /var/nfs/projects with root squash (default, map root to nobody)
/var/nfs/projects 10.0.0.0/24(rw,sync,no_subtree_check,root_squash)

# NFSv4 pseudo-root export (recommended for NFSv4)
/srv/nfs 10.0.0.0/24(rw,sync,fsid=0,crossmnt,no_subtree_check)
/srv/nfs/data 10.0.0.0/24(rw,sync,no_subtree_check,no_root_squash)
/srv/nfs/shared 10.0.0.0/24(ro,sync,no_subtree_check)

Export Options Explained

OptionDescription
rwRead-write access
roRead-only access
syncWrite data to disk before replying (safe, slower)
asyncReply before data is written to disk (fast, risk of corruption)
no_subtree_checkDisable subtree checking (improves reliability)
root_squashMap remote root (UID 0) to nobody (default, more secure)
no_root_squashAllow remote root to act as root on the server (use cautiously)
all_squashMap all remote UIDs/GIDs to nobody
anonuid=1000Map anonymous users to a specific UID
anongid=1000Map anonymous groups to a specific GID
crossmntAllow clients to traverse into sub-mounts
fsid=0Mark as the NFSv4 pseudo-root

Applying Export Changes

# Apply changes to exports (no server restart needed)
exportfs -ra

# Show current exports
exportfs -v

# Export a new directory on the fly (temporary, not persistent)
exportfs -o rw,sync,no_subtree_check 10.0.0.0/24:/tmp/share

# Unexport a directory
exportfs -u 10.0.0.0/24:/tmp/share

Server Firewall Configuration

# UFW (Ubuntu)
ufw allow from 10.0.0.0/24 to any port nfs
ufw allow from 10.0.0.0/24 to any port 111   # rpcbind (NFSv3)

# firewalld (RHEL/CentOS)
firewall-cmd --permanent --add-service=nfs
firewall-cmd --permanent --add-service=rpc-bind
firewall-cmd --permanent --add-service=mountd
firewall-cmd --reload

# NFSv4 only needs TCP 2049 (no rpcbind or mountd)
firewall-cmd --permanent --add-port=2049/tcp
firewall-cmd --reload

NFS Client Configuration

Manual Mounting

# Install NFS client
apt install -y nfs-common        # Debian/Ubuntu
dnf install -y nfs-utils         # RHEL/CentOS

# Discover exports from the server
showmount -e nfs-server.example.com

# Mount an NFS share manually
mkdir -p /mnt/data
mount -t nfs nfs-server.example.com:/data /mnt/data

# Mount with specific NFS version and options
mount -t nfs -o vers=4.2,tcp,hard,intr nfs-server.example.com:/data /mnt/data

# Verify the mount
mount | grep nfs
df -hT /mnt/data

# Unmount
umount /mnt/data

Persistent Mounts via /etc/fstab

# /etc/fstab entries for NFS

# Basic NFSv4 mount
nfs-server.example.com:/data  /mnt/data  nfs4  defaults,_netdev  0  0

# Mount with performance and reliability options
nfs-server.example.com:/data  /mnt/data  nfs4  hard,intr,rsize=1048576,wsize=1048576,timeo=600,retrans=3,_netdev  0  0

# Read-only mount
nfs-server.example.com:/shared  /mnt/shared  nfs4  ro,_netdev  0  0

# Mount with specific UID/GID mapping (useful for containers)
nfs-server.example.com:/data  /mnt/data  nfs4  defaults,_netdev,uid=1000,gid=1000  0  0
# Mount all fstab entries
mount -a

# Test fstab entry without actually mounting
mount --fake -a -v

Mount Options Explained

OptionDescription
hardRetry NFS requests indefinitely (recommended for data integrity)
softReturn error after retrans retries (risk of data corruption)
intrAllow interruption of hard-mounted NFS requests
rsize=1048576Read buffer size in bytes (1 MB, max for NFSv4)
wsize=1048576Write buffer size in bytes (1 MB)
timeo=600Timeout in tenths of a second (60 seconds)
retrans=3Number of retries before error (soft) or message (hard)
_netdevWait for network before mounting (critical for boot)
noatimeDo not update access time (improves performance)
nconnect=8Use multiple TCP connections (kernel 5.3+, improves throughput)

Autofs (On-Demand Mounting)

# Install autofs
apt install -y autofs        # Debian/Ubuntu
dnf install -y autofs        # RHEL/CentOS

# Configure the master map
# /etc/auto.master or /etc/auto.master.d/nfs.autofs
/mnt/nfs  /etc/auto.nfs  --timeout=300

/etc/auto.nfs

# Format: mount-point  options  location
# Mounts will appear under /mnt/nfs/<mount-point>

data    -rw,hard,intr,rsize=1048576,wsize=1048576    nfs-server.example.com:/data
shared  -ro,hard,intr                                  nfs-server.example.com:/shared
home    -rw,hard,intr                                  nfs-server.example.com:/home/&

# Wildcard: mount any subdirectory from the server automatically
# /etc/auto.master entry:  /mnt/nfs  /etc/auto.nfs
*       -rw,hard,intr    nfs-server.example.com:/srv/nfs/&
# Enable and start autofs
systemctl enable --now autofs

# Test: simply cd into the mount point and it appears
ls /mnt/nfs/data    # Triggers auto-mount
# The share unmounts automatically after the timeout (300 seconds idle)

# Check autofs status
systemctl status autofs
automount -v    # Verbose debugging mode (foreground)

Performance Tuning

Server-Side Tuning

# Increase the number of NFS daemon threads (default is 8)
# /etc/default/nfs-kernel-server (Debian) or /etc/sysconfig/nfs (RHEL)
RPCNFSDCOUNT=32

# Or set at runtime
echo 32 > /proc/fs/nfsd/threads

# Restart NFS to apply
systemctl restart nfs-server

# Tune NFS server read/write sizes in sysctl
# These are auto-negotiated but can be adjusted
echo 1048576 > /proc/fs/nfsd/max_block_size

# Kernel network buffer tuning (see performance-tuning skill)
sysctl -w net.core.rmem_max=134217728
sysctl -w net.core.wmem_max=134217728

Client-Side Tuning

# Use large read/write buffer sizes in mount options
mount -t nfs4 -o rsize=1048576,wsize=1048576,noatime nfs-server:/data /mnt/data

# Use multiple TCP connections (Linux kernel 5.3+)
mount -t nfs4 -o nconnect=8 nfs-server:/data /mnt/data

# Check current mount options and NFS statistics
nfsstat -c                    # Client NFS statistics
nfsstat -s                    # Server NFS statistics
mountstats /mnt/data          # Detailed per-mount stats

# Test NFS throughput with dd
dd if=/dev/zero of=/mnt/data/testfile bs=1M count=1024 oflag=direct
dd if=/mnt/data/testfile of=/dev/null bs=1M iflag=direct
rm /mnt/data/testfile

# Test with fio for more realistic workloads
fio --name=nfs-test --directory=/mnt/data --ioengine=libaio --direct=1 \
  --rw=randrw --bs=4k --numjobs=4 --size=1G --runtime=60 --group_reporting

Kubernetes NFS Integration

# nfs-pv.yaml -- Static PersistentVolume
apiVersion: v1
kind: PersistentVolume
metadata:
  name: nfs-pv
spec:
  capacity:
    storage: 100Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: nfs
  nfs:
    server: nfs-server.example.com
    path: /data
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nfs-pvc
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: nfs
  resources:
    requests:
      storage: 100Gi
# For dynamic provisioning, install the NFS CSI driver via Helm
helm repo add csi-driver-nfs https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts
helm install csi-driver-nfs csi-driver-nfs/csi-driver-nfs --namespace kube-system
# Then create a StorageClass pointing to your NFS server and share path.

Troubleshooting

SymptomDiagnostic CommandCommon Fix
mount: access deniedshowmount -e server, exportfs -vCheck /etc/exports, run exportfs -ra, verify subnet
mount hangsmount -v, check networkVerify firewall allows TCP 2049; use bg mount option
Stale file handlels /mnt/data returns stale errorUnmount and remount: umount -f /mnt/data && mount -a
Permission denied on filesls -la, check UID mappingMatch UIDs or use all_squash,anonuid=1000,anongid=1000
Slow NFS performancenfsstat -c, mountstats /mnt/dataIncrease rsize/wsize, add nconnect=8, tune NFS threads
Autofs not mountingsystemctl status autofs, automount -vCheck /etc/auto.master syntax, verify server is reachable
NFSv4 ID mapping wrongid username on both sidesEnsure matching domain in /etc/idmapd.conf
Boot hangs waiting for NFSCheck fstab optionsAdd _netdev and bg options to fstab entry
Docker volume mount failsdocker volume inspect, dmesgVerify NFS client packages installed on Docker host

Related Skills

  • linux-administration -- Server setup and network configuration
  • block-storage -- Underlying storage for NFS server data directories
  • performance-tuning -- Kernel and network tuning for NFS throughput
  • backup-recovery -- Backing up NFS-hosted data
  • object-storage -- Alternative storage model for cloud-native workloads

适合场景

01

研究助手

02

事实核查

03

知识库问答

04

带来源的搜索总结

能力概览

能力 1

组合搜索和大模型调用

能力 2

支持多来源检索和总结

能力 3

强调引用来源和事实核查

能力 4

适合研究型 Agent 流程

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

31.72%
按下载量换算89

Claude

31.85%
按下载量换算89

Cursor

18.58%
按下载量换算52

Gemini CLI

9.57%
按下载量换算27

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills