fs mounts: add nofail and mount-timeout to reduce shutdown hangs on nfs

This commit is contained in:
Colin 2023-06-15 10:08:54 +00:00
parent 17041384e9
commit 5562d60cbb

View File

@ -1,3 +1,6 @@
# docs
# - x-systemd options: <https://www.freedesktop.org/software/systemd/man/systemd.mount.html>
{ pkgs, sane-lib, ... }:
let fsOpts = rec {
@ -6,9 +9,11 @@ let fsOpts = rec {
"noatime"
"x-systemd.requires=network-online.target"
"x-systemd.after=network-online.target"
"x-systemd.mount-timeout=10s" # how long to wait for mount **and** how long to wait for unmount
"nofail" # don't fail remote-fs.target when this mount fails
];
auto = [ "x-systemd.automount" ];
noauto = [ "noauto" ];
noauto = [ "noauto" ]; # don't mount as part of remote-fs.target
wg = [
"x-systemd.requires=wireguard-wg-home.service"
"x-systemd.after=wireguard-wg-home.service"
@ -43,7 +48,7 @@ let fsOpts = rec {
# note: client uses a linear backup, so the second request will have double this timeout, then triple, etc.
nfs = common ++ [
# "actimeo=10"
# "bg"
"bg"
"retrans=4"
"retry=0"
"soft"
@ -52,14 +57,14 @@ let fsOpts = rec {
};
in
{
environment.pathsToLink = [
# needed to achieve superuser access for user-mounted filesystems (see optionsRoot above)
# we can only link whole directories here, even though we're only interested in pkgs.openssh
"/libexec"
];
fileSystems."/mnt/servo-nfs" = {
device = "servo-hn:/";
# fileSystems."/mnt/servo-nfs" = {
# device = "servo-hn:/";
# noCheck = true;
# fsType = "nfs";
# options = fsOpts.nfs ++ fsOpts.auto ++ fsOpts.wg;
# };
fileSystems."/mnt/servo-nfs/media" = {
device = "servo-hn:/media";
noCheck = true;
fsType = "nfs";
options = fsOpts.nfs ++ fsOpts.auto ++ fsOpts.wg;
@ -109,6 +114,12 @@ in
noCheck = true;
};
environment.pathsToLink = [
# needed to achieve superuser access for user-mounted filesystems (see optionsRoot above)
# we can only link whole directories here, even though we're only interested in pkgs.openssh
"/libexec"
];
environment.systemPackages = [
pkgs.sshfs-fuse
];