Gadgets, Computers and Nerdy Stuff
Properly Mounting DiskStation shares in OSX
Mounting shares (called “Shared Folders” on the DiskStation) in OSX is very easy. In Finder, click Go -> Connect to Server. Depending on whether your share is available as AFP (Apple Filing Protocol) or SMB (Samba), you enter afp://192.168.1.2 or smb://192.168.1.2 respectively.
Click Connect, then select the shares you want to share. Easy.
However, making OSX automatically re-mount the shares at startup is a little harder. Most articles on this subject tell you to drag the shared folders to your startup items. If you have 5 shared folders, this results in 5 open finder windows every time you reboot.
Luckily, there is a much better way. First, create a folder where you want your shares to appear. I use /Users/arjan/Shares.
Note: the following steps expect you to have superuser rights!
Edit the /etc/auto_master file:
mac% sudo vi /etc/auto_master
This file looks similar to this:
# # Automounter master map # +auto_master # Use directory service /net -hosts -nobrowse,hidefromfinder,nosuid /home auto_home -nobrowse,hidefromfinder /Network/Servers -fstab /- -static
Add the following line to this file:
/Users/arjan/Shares auto_smb
The result now looks like this:
# # Automounter master map # +auto_master # Use directory service /net -hosts -nobrowse,hidefromfinder,nosuid /home auto_home -nobrowse,hidefromfinder /Network/Servers -fstab # The /Users/arjan/Shares folder will contain my DiskStation shares /Users/arjan/Shares auto_smb /- -static
Save the auto_master file. Now create a new file /etc/auto_smb:
mac% sudo vi /etc/auto_smb
Add a line for every share in this file like so:
share_name -fstype=smbfs ://username:password@diskstation_ip/shared_folder_name
share_name: The name of the local folder (this is the name you’ll see in the Shares folder)-fstype=smbfs: Use Samba protocol (I’ll tell you how to use AFP in bit)username:password: The username and password you use to connect a DiskStation sharediskstation_ip: Enter your DiskStations IP number (or hostname)shared_folder_name: The name of the remote folder (the DiskStation share name)
My file /etc/auto_smb file looks like this:
docs -fstype=smbfs ://arjan:password@192.168.1.2/docs music -fstype=smbfs ://arjan:password@192.168.1.2/music photo -fstype=smbfs ://arjan:password@192.168.1.2/photo video -fstype=smbfs ://arjan:password@192.168.1.2/video
Now set the correct permissions for this file:
sudo chmod 600 /etc/auto_smb
And finally, restart the automount daemon:
sudo automount -vc
Voila: Your shares will automatically be mounted on every reboot, without obtrusive Finder windows.
AFP instead of SMB?
If you’d rather use AFP, all you need to do is change the /etc/auto_smb file a bit.
Instead of:
share_name -fstype=smbfs ://username:password@diskstation_ip/shared_folder_name
Use
share_name -fstype=afp afp://username:password@diskstation_ip/shared_folder_name
| Print article | This entry was posted by Arjan on March 20, 2010 at 15:53, and is filed under DiskStation, OSX. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |




about 2 years ago
This is awesome. Thanks. I hated having 6 finder windows open up everytime i had to reboot.
Do you know of a way to place the “shares folder” under the “places” in finder? i’ve tried to move it there as you’d normally do with other folders but that wont do.
Thanks
about 2 years ago
I have a problem with frequent connection loss. I have to manually disconnect and reconnect to my DS209.
Does this address this issue ?
about 2 years ago
Hi,
is there any way to make the mounts available to everyone. I.e. set the permission to access for all users.
Ehen I mount something like
/docs -fstype=smbfs ://arjan:password@192.168.1.2/docs
it mounts correctly but is accessible only to the root.
I searched the net but couldn’t find any hint what option to use to change the permissions.
about 1 year ago
Seems to work! Will test after sleep and after reboot. I went however about to edit with TextEdit, as I am inapt with Vi in this life…