How to create a symbolic link to a folder on a Synology NAS

Have you ever had the need to have a folder in a different location on your Synology NAS but you don’t want or can’t move the folder from its original location? Instead, you only need a reference to the contents of that folder from a different location. That’s exactly what a symbolic link (aka symlink) is for, but unfortunately there’s no visual way to do it in DSM using File Station. Luckily, you can do it using command line via telnet.
 

Enable Telnet

First you will need to enable the telnet service on DSM:

Control Panel > Terminal & SNMP > Enable Telnet Service


 

Using mount command

Maybe your first option would be to use the ln command but I’m sorry to say that it will maybe not work properly because the access to symbolic links via Samba/FTP is disabled on the NAS for security reasons and I haven’t found a way to enable it. So the symbolic link might work in some cases, such as using an UPnP client or on the DS audio app, but not from the DS file app or on File Station.

Having said that, a better solution is to use the mount command. For using it we will access to the Synology NAS via your preferred Telnet/SSH client. I use the ssh command on a Mac Terminal window.

ssh admin@<NAS IP Address>

 
And then, assuming that the source folder you want to link is /volume1/music and the “symbolic link” folder you want to create is /volume2/share/music

mkdir /volume2/share/music
sudo mount --bind /volume1/music /volume2/share/music

 

Permanent solution

However, this symbolic link will only work until the NAS is restarted. If you want the folder to be mounted every time the NAS is restarded you should edit the /etc/rc.local file adding the mount command line.

sudo vi /etc/rc.local
sudo mount --bind /volume1/music /volume2/share/music
~ 
~ 
~ 
~ 
A quick cheat sheet in case you don’t know too much about how to use vi:

:x Exit, saving changes.
:w Save file.
:q Exit if no changes have been made.
:q! Exit and undo any changes made.

r Replace one character.
x Delete character to the right of cursor.
i Insert before cursor.
o Open a new line below current line.
dd Delete current line.

With Esc we can swap from command mode to input mode and viceversa.

Note: These steps have been tested on DSM 6.1.

 

0 Comments

Comments are closed