you are viewing a single comment's thread
view the rest of the comments
[–] 9 points 8 months ago (15 children)

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.

  • source
  • hideshow 15 child comments
  • [–] 19 points 8 months ago (3 children)

    I dont know what you are doing, but I have my smb shares simply in fstab and never heard of any .mount file

  • source
  • parent
  • hideshow 3 child comments
  • [–] 4 points 8 months ago (3 children)

    Network not ready by time the mount is executed?

  • source
  • parent
  • hideshow 3 child comments
  • [–] 2 points 8 months ago (2 children)
  • [–] 4 points 8 months ago (1 child)

    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
    
  • source
  • parent
  • hideshow 1 child comment
  • [–] 3 points 8 months 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.

  • source
  • parent
  • [–] 1 point 8 months ago (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 4 points 8 months 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.

  • source
  • parent