You are not logged in.

#1 2017-07-06 19:44:52

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Bullet proof NFS entries in /etc/fstab in case external HDD goes bad

I built a NAS running Arch on an old Intel Atom for my parents which uses an external HDD (USB).  Recently, the system was rendered unbootable due to HDD issues or USB cable issues and troubleshooting with my elderly folks over facetime sucked.  I believe the problem was due to either
1) the mount entries and no expected media (system level)
or
2) the mount entries and no expected media (nfs level)

Problem: I need some mount entries in /etc/fstab that will tolerate the HDD not being online when the system boots.

Proposed solution:

# cat /etc/fstab
...
LABEL=external    /mnt/nas      ext4 defaults,auto,nofail 0 2
/mnt/nas/audio  /srv/nfs/audio  none bind,nofail          0 0
/mnt/nas/docs   /srv/nfs/docs  none bind,nofail          0 0

Will this work?  I also read about using x-systemd.automount,noauto,nofail but haven't messed with that before and if my proposal will work as-is, that's fine.

For completeness:

1) nfs-server.service is enabled and has the corresponding mounts via:

# cat /etc/exports
/srv/nfs        192.168.1.0/24(ro,fsid=0,no_subtree_check)
/srv/nfs/audio  192.168.1.0/24(ro,no_subtree_check,insecure)
/srv/nfs/docs  192.168.1.0/24(ro,no_subtree_check,insecure)

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2017-07-08 18:36:34

chr0mag
Member
From: Vancouver, Canada
Registered: 2017-02-02
Posts: 94

Re: Bullet proof NFS entries in /etc/fstab in case external HDD goes bad

Have a look at the mountpoint export option in man exports. "This option makes it possible to only export a directory if it has successfully been mounted."

This should help mitigate NFS issues when the external HDD is unavailable.

Last edited by chr0mag (2017-07-08 18:48:54)

Offline

#3 2017-07-08 19:39:42

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Bullet proof NFS entries in /etc/fstab in case external HDD goes bad

chr0mag wrote:

Have a look at the mountpoint export option in man exports. "This option makes it possible to only export a directory if it has successfully been mounted."

This should help mitigate NFS issues when the external HDD is unavailable.

I saw the mp option in the man page, but since my strategy is to just use bind mounts from the real filesystem to /srv/nfs, I would think that the bind mounts would always be valid since they are on the local filesystem.  I am incorrect?

EDIT: Also just tried playing with the option on a local box and am finding that despite the fact that the export I defined is not a mountpoint, it is still exported.
Example:

# cat /etc/exports
/srv/nfs         10.1.10.0/24(ro,fsid=root,no_subtree_check)
/srv/nfs/ATV4    10.1.10.0/24(ro,no_subtree_check,insecure,mountpoint=/srv/nfs/ATV4)

On my filesystem, /srv/nfs/ATV4 is literally an empty directory:

% mountpoint /srv/nfs/ATV4
/srv/nfs/ATV4 is not a mountpoint
% showmounts -e
Export list for test:
/srv/nfs           10.1.10.0/24
/srv/nfs/ATV4      10.1.10.0/24

Perhaps I do not have the syntax correct or one of the other options I am defining is overriding?

Last edited by graysky (2017-07-09 10:58:11)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2017-07-10 01:51:00

chr0mag
Member
From: Vancouver, Canada
Registered: 2017-02-02
Posts: 94

Re: Bullet proof NFS entries in /etc/fstab in case external HDD goes bad

graysky wrote:

Also just tried playing with the option on a local box and am finding that despite the fact that the export I defined is not a mountpoint, it is still exported.

I just tried this on my machine and see the same behaviour.  I've got NFS running on my router using LEDE/OpenWRT and see the same thing there too. Perhaps I've misunderstood how the mountpoint/mp option works and it does something other than call the mountpoint command w/the path from /etc/exports?

graysky wrote:

Problem: I need some mount entries in /etc/fstab that will tolerate the HDD not being online when the system boots.

As temporary workaround, you could add noauto to your /etc/fstab and mount the external drive explicitly after a successful boot.  At least this will allow you to boot the machine and troubleshoot.

Offline

Board footer

Powered by FluxBB