• F04118F@feddit.nl
    link
    fedilink
    arrow-up
    4
    ·
    13 hours ago

    /etc/systemd/system/mnt-nfs.mount

    [Unit]
    Description=Mount NFS Share
    
    [Mount]
    What=server:exported_path
    Where=/mnt/nfs_share
    Type=nfs
    Options=_netdev,auto,rw
    
    [Install]
    WantedBy=multi-user.target
    
    • The_Decryptor@aussie.zone
      link
      fedilink
      English
      arrow-up
      3
      ·
      7 hours ago

      And the reason you’ll want to do this is that it exposes FS mounts in the service dependency tree, so e.g. you can delay starting PostgreSQL until after you’ve mounted the network share that it’s using as a backing store, while letting unrelated tasks start concurrently.

      If all you want to do is pass some special mount flags (e.g. x-systemd.automount) then fstab is the way, after all it’s still systemd that’s parsing and managing it.

    • WhyJiffie@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      2
      ·
      10 hours ago

      oh! maybe it’s the perfect chance to ask. what do you do with your mounted shares so that processes trying to access it do not hang when the server is unreachable?

      mostly I would prefer if that directory read would just fail but anything is better, except unmounting.

      • kalpol@lemmy.ca
        link
        fedilink
        arrow-up
        2
        ·
        8 hours ago

        Add -o hard

        And if youre using nfsv3 add retrans=5

        Nfsv4 doesbt really need retrans but it still worls.

        That has worked perfectly for me.

        • WhyJiffie@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          1
          ·
          6 hours ago

          does retrains have any effect with hard? this is what man nfs says:

          If neither option is specified (or if the hard option is specified), NFS requests are retried indefinitely. If the soft option is specified, then the NFS client fails an NFS request after retrans retransmissions have been sent, causing the NFS client to return an error to the calling application.

          also, do you know what can I do with CIFS/SMB? I have most of my shares through samba :/

      • F04118F@feddit.nl
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        10 hours ago

        Good question!

        In the Home Operations Discord there’s some very smart people who solved this problem inside kubernetes by checking if their NAS is online (through a Prometheus exporter named node exporter) and then scaling down their workloads that use it, automatically, using KEDA (an autoscaler for kubernetes)

        Depending on how your processes are orchestrated, you might be able to do something similar?

        Source: https://github.com/onedr0p/home-ops/pull/9334/files

        • WhyJiffie@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          2
          ·
          6 hours ago

          well that’s also interesting, but I mainly experience this problem on my desktop. there was a plasma version when even the taskbar panel got frozen, and the kde file manager, double commander too for like a minute, every time they try to do anything with an unreachable network drive. and its even worse on my laptop so there I just don’t mount my shares anymore.

          I have been wondering how does windows do it, and programs made for windows, because this is a nonissue there (though windows has its fair share of problems with network shares though…). maybe they just learned to do all IO ops on a different thread…