You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 18.04重启后NFS Kernel Server active(exited)状态故障求助

NFS服务重启后看似停止的排查与修复方案(Ubuntu 18.04)

Hey, let's figure out why your NFS service is acting up after the server reboot. That active (exited) status from systemctl status nfs-kernel-server tells us the startup script ran without errors, but there's no persistent daemon keeping the service running in the background. That's why it looks like it's stopped even though systemd marks it as "active". Let's walk through diagnosing and fixing this step by step.

先做基础排查

Start with these checks to pinpoint the root cause:

  • Verify dependent RPC services: NFS relies on rpcbind and rpc-mountd to function properly. Check their status with:
    systemctl status rpcbind
    systemctl status rpc-mountd
    
    If either shows inactive or failed, that's likely the culprit.
  • Check exports configuration for errors: A broken /etc/exports file can prevent NFS from loading correctly. Run these commands to validate and reload the config:
    exportfs -v
    exportfs -r
    
    If there's a syntax error (like missing commas, invalid permissions flags, or typos), exportfs will throw an error message pointing you to the issue.
  • Check NFS port listening: Use ss to see if NFS-related processes are actually listening on ports:
    ss -tulpn | grep nfs
    
    You should see entries for rpc.nfsd if it's running properly.
  • Dig into detailed logs: Use journalctl to get more context about what's happening during service startup:
    journalctl -u nfs-server.service --since "10 minutes ago"
    
    Look for any warning or error messages that might have been missed in the status output.

针对性修复方案

Based on the above checks, here are fixes for the most common issues:

1. RPC Mountd service is inactive or failed

If rpc-mountd isn't running, start it up and ensure it launches on boot:

systemctl start rpc-mountd
systemctl enable rpc-mountd
systemctl restart nfs-kernel-server

Then recheck the NFS service status—you should see active (running) now.

2. Invalid exports configuration

Fix any syntax errors in /etc/exports (like incorrect permission flags, missing brackets, or invalid client addresses). For example, a valid entry looks like:

/var/nfs/share *(rw,sync,no_subtree_check,no_root_squash)

After fixing, reload the config and restart the service:

exportfs -r
systemctl restart nfs-kernel-server

3. rpc.nfsd didn't initialize properly

Sometimes the rpc.nfsd daemon fails to register itself during startup. Manually start it with a thread count (8 is a common default) then restart the service:

rpc.nfsd 8
systemctl restart nfs-kernel-server

4. Service dependency ordering issue

If systemd is starting NFS before its dependent services are ready, you can adjust the service file to enforce correct ordering:

  1. Open the NFS service file for editing:
    nano /lib/systemd/system/nfs-server.service
    
  2. Ensure the After line includes both rpcbind.target and rpc-mountd.service:
    After=network.target rpcbind.target rpc-mountd.service
    
  3. Reload systemd and restart the service:
    systemctl daemon-reload
    systemctl restart nfs-kernel-server
    

验证修复

Once you've applied a fix, confirm everything is working:

  • Run systemctl status nfs-kernel-server—the Active line should show active (running).
  • List the exported shares locally with:
    showmount -e localhost
    
    You should see all your configured NFS shares listed.
  • Test from a client machine by mounting the share and verifying you can read/write to it.

内容的提问来源于stack exchange,提问作者user9492428

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 06:58:33