King Foo

King Foo

You are in:

King Foo > Blog > Linux > Change folders for Synology media server

Blog

Change folders for Synology media server

Posted by
/ / Leave a comment

When you enable the Synology Media Server on your NAS, there are 3 directories added to your file-system (video, music and photo) which will be used for the DLNA/UPnP media server to play the corresponding files.

I wasn’t very happy with these 3 directories because I wanted to categorize my media in other directories. In this post, I will post how I’ve resolved this problem.

First, enable SSH access to the NAS and log in.

My first idea to tackle this issue was to use of symbolic links

ln -s /volume1/MyMusicDirectory /volume1/music

I’ve re-indexed my files on the NAS and everything worked instantly. All the files in MyMusicDirectory where indexed so I was very happy…but not for long.
I noticed quickly that the new files I’ve placed in MyMusicDirectory weren’t auto-indexed by the NAS. I always had to re-index through the webinterface which can take hours when there is a lot of data to index so that was a big issue.
I figured out what the problem was: symbolic links will be considered as files and not as directories so the autoindexer wouldn’t follow the symbolic link.

Up to idea 2: mount –bind
I used mount –bind to create an unbreakable link which normally would be used as a directory by the NAS so the contents could be auto-indexed.


mount --bind /volume1/MyMusicDirectory /volume1/music

It worked!! YES!!
Till I’ve rebooted the NAS. The mount was gone and I had to manually add it again. Not something I want to do at every reboot.

Up to idea 3: changing fstab
The file /etc/fstab will be loaded at startup to mount the filesystem so I’ve added the following rule in the file:

/volume1/MyMusicDirectory /volume1/music bind defaults,bind 0 0

I saved the file and rebooted and it didn’t worked. The fstab file will be overridden at startup with Synology’s default fstab-file so the rule I’ve entered before was deleted.

And then idea 3: The solution
Create a file rc.local


touch /etc/rc.local

open the file and add the following line:


mount --bind /volume1/MyMusicDirectory /volume1/music

Now restart the NAS and you’re done.
The files in MyMusicDirectory will be auto-indexed by the media server.