this post was submitted on 20 Feb 2026
117 points (73.1% liked)

Technology

81710 readers
3835 users here now

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related news or articles.
  3. Be excellent to each other!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, this includes using AI responses and summaries. To ask if your bot can be added please contact a mod.
  9. Check for duplicates before posting, duplicates may be removed
  10. Accounts 7 days and younger will have their posts automatically removed.

Approved Bots


founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Eryn6844@piefed.blahaj.zone 6 points 2 days ago (7 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.

[–] Eggymatrix@sh.itjust.works 13 points 2 days ago (2 children)

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

[–] avidamoeba@lemmy.ca 5 points 2 days ago (1 children)

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

[–] Eryn6844@piefed.blahaj.zone 3 points 2 days ago

i am making them in salt-stack systemd templates/pillars. i will see what i miss when i do a fstab one.

[–] bjoern_tantau@swg-empire.de 2 points 2 days 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 4 points 2 days 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.

[–] avidamoeba@lemmy.ca 4 points 2 days ago (1 children)

Network not ready by time the mount is executed?

[–] Eryn6844@piefed.blahaj.zone 2 points 2 days ago (1 children)
[–] tinsuke@lemmy.world 1 points 2 days ago (1 children)

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
[–] avidamoeba@lemmy.ca 3 points 2 days 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.

[–] hesh@quokk.au 4 points 2 days ago (1 children)

Can you see if its trying and failing by using journalctl?

[–] Eryn6844@piefed.blahaj.zone 1 points 2 days ago

no matter what i do it only does on try.

[–] Eryn6844@piefed.blahaj.zone 3 points 2 days ago

thanks everyone.

[–] caseyweederman@lemmy.ca 1 points 2 days ago (1 children)

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 2 points 2 days 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.