Skip to content

Instantly share code, notes, and snippets.

@bitonio
Last active July 6, 2020 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitonio/b1248a4aa1e137bae7d857effeaddcda to your computer and use it in GitHub Desktop.
Save bitonio/b1248a4aa1e137bae7d857effeaddcda to your computer and use it in GitHub Desktop.

AutoFS, macOS Catalina and Synology

July 2020

Since I upgraded to macOS Catalina, mounting SMB drive from my Synology NAS in the Finder many times gives me an error like this:

"The operation can’t be completed because the original item for SHARE_NAME"

This happens when you leave your Mac up and running for a while, going to sleep, waking it up. Apple did a great job at keeping the OS very stable even with a long period of time without rebooting. Except this file share over SMB that drives people nuts.

Workarounds

I have read many recommendation that didn't work for me:

  • Set the IPv6 config to local-link only
  • Change permission on /Volumes
  • Force the NAS to use SMBv2 at minimum

The only thing that worked was:

  • Restart the Finder ( → Force Quit... → Finder)
  • Alternatively, rebooting the machine always worked

Some folks took a more drastic approach enabling AFP protocol, the very same Apple started deprecating in the fall of 2013 with 10.9 / Maverick

Solution with autoFS

Since I need this fileshare more or less all the time, I decided to give a shot to autofs.

autofs ships with all macOS, it doesn't require any script to run to mount the shared folder or create the mount folder, it takes care of everything for you.

Follow the 3 steps below and you should be able to continue enjoying your NAS.

To edit/create file, you can use Terminal with text editor like vi or nano.

These file being system files, prefix your commands with sudo.

Step 1: edit your /etc/auto_master file

% sudo vi /etc/auto_master

Add one line at the end:

/-			auto_smb	-nosuid,noowners

Step 2: create /etc/auto_smb

% sudo vi /etc/auto_smb

Add this line (or multiple if you have multiple file shares):

/System/Volumes/Data/SHARENAME -fstype=smbfs,soft ://user:password@NAS-IP-HOSTNAME:/SHARENAME

And since we want to make sure your password stays secret, change the permmission on the file to keep it system only:

% sudo chmod 600 /etc/auto_smb

Step 3: get autofs to reload the new settings

You need this command only to test your settings are working fine, and anytime you change the 2 files above.

$ sudo automount -vc

Now chill out and enjoy hassle free SMB file share mount in Catalina

You should see you NAS share mounted, type mount to confirm, on my system it looks like this:

% mount
/dev/disk1s5 on / (apfs, local, read-only, journaled)
devfs on /dev (devfs, local, nobrowse)
/dev/disk1s1 on /System/Volumes/Data (apfs, local, journaled, nobrowse)
/dev/disk1s4 on /private/var/vm (apfs, local, journaled, nobrowse)
map auto_home on /System/Volumes/Data/home (autofs, automounted, nobrowse)
map auto_smb on /System/Volumes/Data/videos (autofs, nosuid, automounted, noowners, nobrowse)
//USER@NAS-IP-HOSTNAME/SHARENAME on /System/Volumes/Data/SHARENAME (smbfs, nodev, nosuid, automounted, nobrowse, mounted by USER)

When you boot your machine, autofs will automatically mount the volume, it usually takes a few seconds.

Appendixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment