Technical Anshu
Tutorials Blog
Ubuntu Fix

Share Missing After Sleep or Slow Networks The Automount Answer

A boot-time mount assumes the world is ready at boot: network up, server awake, right building. Laptops live differently - they sleep, they roam, Wi-Fi joins after login. Automount stops asking the share to exist at boot and simply creates it the moment you actually open the folder.

Technical AnshuUbuntu and WindowsStep-by-step guide
Watch the video for the complete process shown live, step-by-step

The pattern is familiar: the share is perfect all morning, the laptop sleeps over lunch, and the afternoon starts with a frozen file manager or a folder that is suddenly empty. Or the laptop boots at home, nowhere near the office PC, and the mount silently never happens. A normal fstab mount is a one-time event tied to boot and network state - it does not heal itself when the world changes. systemd automount changes the trigger: the folder sits there as a placeholder, and the first access mounts the share on demand. It is a small edit to the line you already have, and for laptops it is usually the end of this whole class of problems.

/etc/fstab options - normal mount vs automount (example)
Boot-time mount - one chance, at boot
options: credentials=...,_netdev,nofail,uid=1000,gid=1000
Automount - created on first access, any time
options: credentials=...,noauto,x-systemd.automount,x-systemd.idle-timeout=60,_netdev,uid=1000,gid=1000
✓ Same credentials file, same owner options - only the trigger changes
The two lines differ by three options. Everything you already fixed - password storage, ownership - carries over untouched.
1

Step 1 - Why Plain Mounts Go Stale or Never Happen

Three everyday events defeat a boot-time mount. Sleep and suspend drop and rebuild the network, leaving the mount pointing at a connection that no longer exists - the folder hangs or shows empty. A boot on a different network - home instead of office - means the server simply is not there when the mount is attempted, and nofail lets the boot proceed without it, permanently for that session. And a slow Wi-Fi that joins after login misses the _netdev moment entirely. In each case nothing retries. That missing retry is the whole problem.

  1. The share itself and your fstab facts are fine - re-creating the mount by hand works every time, which is the tell
  2. What you need is a mount whose trigger is use, not boot
2

Step 2 - Change the Line to an Automount

Edit sudo nano /etc/fstab and adjust the options of your existing line - same server, same mount point, same credentials.

  1. Add noauto - do not mount this at boot in the old way
  2. Add x-systemd.automount - create an automount unit that watches the folder and mounts on first access
  3. Add x-systemd.idle-timeout=60 - unmount again after sixty idle seconds, so the connection is dropped cleanly instead of going stale while the laptop sleeps (the number is seconds; raise it if you prefer a longer hold)
  4. Keep _netdev and your uid and gid - they still apply to the mount when it happens
  5. The finished line reads like the second example in the panel above
3

Step 3 - Reload and Watch It Work

Automount units are generated from fstab, so the reload matters here more than anywhere.

  1. Run sudo systemctl daemon-reload
  2. Unmount the old mount if it is active: sudo umount /mnt/SharedDocs - the folder now looks empty, which is the placeholder doing its job
  3. Trigger it: ls /mnt/SharedDocs - a short pause, then the files appear. That pause is the mount happening on demand
  4. Check the machinery if curious: systemctl status mnt-SharedDocs.automount shows the watcher, and the matching .mount unit shows active while you use it
  5. Reboot once and confirm the new behaviour end to end: log in, open the folder, files arrive - no manual step
4

Step 4 - Living With Automount, Honestly

Automount trades boot-time certainty for on-demand resilience, and two small behaviours come with it. The first open of the folder after a while takes a second or two while the mount happens - noticeable, not a fault. And a program that scans the folder the instant it starts can still occasionally win the race and report the folder empty; opening the folder once in Files before starting that program settles it. In exchange, sleep stops mattering, the wrong network stops mattering, and a server that was off at boot joins the moment you reach for it.

  1. Keep nofail thinking with you: an unreachable server now means the first access pauses and fails, instead of the whole boot stalling - the failure moved to the right moment
🔴 Which machines should stay on a plain boot mount? Desktops wired to the same network as an always-on server are genuinely fine with the original line - the boot assumptions are true for them every day. Automount earns its place on laptops and anything that sleeps, roams, or depends on a server with its own schedule. Choose per machine, not by fashion.

Watch the Complete Video Guide

Watch the video to see the permanent setup from the start - and consider the automount variant if your machine is a laptop.

Watch Full Video
Common Questions (FAQ)

Does automount reconnect the share by itself after sleep?

Yes - that is its purpose. Because the idle timeout lets the mount drop while the machine sleeps, the next time you open the folder the automount simply mounts it again, fresh, on whatever network you woke up on. There is no stale connection left to hang your file manager.

Will the idle timeout unmount the share while I am working in it?

No. The timeout counts idle time - the mount is released only after the folder has sat unused for the period you set, and open files keep it alive. If you find the pause on reopening annoying, raise the number in x-systemd.idle-timeout; the value is a comfort setting, not a correctness one.

Wi-Fi only connects after I log in. Is that why my boot mount kept failing?

Very likely. _netdev waits for the network to be online, but on many laptops the wireless connection is tied to the user session and joins after the mount was already attempted. The boot then finishes without the share, and nothing retries. Automount removes the race entirely - the mount waits for you, not for the boot sequence.

This guide is based on the Technical Anshu video on mounting a Windows share in Ubuntu - stuck on any step, ask in the video comments and you will get an answer.