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 share
  • diskstation_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