14

'mount -a' works fine as a one-time action. But auto-mount of removable media reverts to settings that were in fstab at the last reboot.

How to make the OS actually reload fstab so auto-mounts use the new settings when media is connected?

Specific example seen with Raspbian (Debian) Stretch:

  • FAT-formatted SD card; configured fstab to auto-mount; rebooted; volume auto-mounts, but RO

  • Changed umask options in fstab; mount -a while media is connected, and volume is now RW

  • Unmount and re-insert the media; auto-mount works, but using the options in fstab from the last reboot, so volume is RO

  • Reboot; OS loads updated fstab; auto-mount works when media is connected, and volume is RW - how to get this effect without a reboot?

FWIW, the (updated) fstab syntax was:

/dev/sdb1   /Volumes/boot   vfat    rw,user,exec,nofail,umask=0000  0   0
0
15

I suspect this is caused by systemd’s conversion of /etc/fstab; traditional mount doesn’t remember the contents of /etc/fstab.

To refresh systemd’s view of the world, including changes to /etc/fstab, run

systemctl daemon-reload
3
  • Sigh. An auto-generated comment in the top of /etc/fstab reminding/advising people it has now been deprecated - and how to update systemd - would go a long way. – roaima Oct 25 '18 at 20:14
  • 1
    Thanks! You can imagine Google returned nothing but 'mount -a' hits for this query. Are there any unwanted side-effects when doing this on-the-fly re-gen of the tables? Doesn't seem to be. – RichardH Oct 25 '18 at 21:45
  • For more, see unix.stackexchange.com/a/236968/5132 and unix.stackexchange.com/questions/90723 . Note that the Debian service that used to run mount -a is nowadays masked. – JdeBP Oct 26 '18 at 0:03
5

To elaborate the answer from @Stephen Kitt: for example I have this entry in /etc/fstab:

vnetsvr-home:/etc/skel   /etc/skel    nfs4   sec=krb5p,noauto,x-systemd.automount,x-systemd.idle-timeout=10min   0   0

and only doing sudo systemctl daemon-reload doesn't reloaded the fstab. I have to do:

rpi ~$ sudo systemctl daemon-reload
rpi ~$ sudo systemctl restart remote-fs.target

To reload an entry to mount a local filesystem you should use:

rpi ~$ sudo systemctl daemon-reload
rpi ~$ sudo systemctl restart local-fs.target
2
  • This answer worked for me in regards to Ubuntu 16.04 while the accepted answer did not. – Dmitry Volosnykh Dec 30 '20 at 10:17
  • Even this answer does not help me when removing entries from /etc/fstab. So, I opt for the reboot. – Dmitry Volosnykh Dec 30 '20 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.