• Eryn6844@piefed.blahaj.zone
    link
    fedilink
    English
    arrow-up
    10
    arrow-down
    1
    ·
    1 day ago

    can someone please tell me how to make .mount files start at boot for smb shares ffs? is the only thing systemd is failing for me.

      • Avid Amoeba@lemmy.ca
        link
        fedilink
        English
        arrow-up
        9
        ·
        1 day ago

        On modern systems, fstab entries are read by systemd and .mount files are automatically created for each entry. 😄

      • Björn@swg-empire.de
        link
        fedilink
        English
        arrow-up
        4
        ·
        1 day ago

        Systemd can use .mount files to make services and stuff depend on the availability of a mount. They can either be created by hand or are created automatically from fstab.

    • Zwuzelmaus@feddit.org
      link
      fedilink
      English
      arrow-up
      6
      ·
      1 day ago

      IIRC You simply write/change the fstab as in every system. Then you say “systemctl daemon-reload” once, and this (re)creates your .mount files. Then “mount -a” or whatever you need.

        • tinsukE@lemmy.world
          link
          fedilink
          English
          arrow-up
          4
          ·
          1 day ago

          I have a service that pings the server:

          cat <<EOF | sudo tee /etc/systemd/system/ping-smb.service
          [Unit]
          Description=Blocks until pinging 192.168.1.10 succeeds
          After=network-online.target
          StartLimitIntervalSec=0
          
          [Service]
          Type=oneshot
          ExecStart=ping -c1 192.168.1.10
          Restart=on-failure
          RestartSec=1
          
          [Install]
          WantedBy=multi-user.target
          EOF
          
          sudo systemctl enable ping-smb.service
          

          And then I make the fstab entry depend on it:

          x-systemd.requires=ping-smb.service
          
          • Avid Amoeba@lemmy.ca
            link
            fedilink
            English
            arrow-up
            3
            ·
            23 hours ago

            I had something similar when I used to mount an NFS share. I had a bash line that would loop ping and then mount once ping succeeds. Having a separate service that pings and making the mount dependent on it is probably the better thing to do. Should also work when put in Requires= in a .mount file.

    • caseyweederman@lemmy.ca
      link
      fedilink
      English
      arrow-up
      1
      ·
      22 hours ago

      My nfs mounts always add 1:45 to my boot even though I added _netdev to their lines in fstab. I don’t get it.

      • FauxLiving@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        19 hours ago

        Use

        _netdev,nofail,x-systemd.device-timeout=10s
        

        nofail doesn’t interrupt the boot and 10 seconds is a more sane timeout. You can also use

        x-systemd.automount
        

        And it will automatically mount the directory the first time it is accessed.