Change folders for Synology media server

02. Jan, 2010

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.

 

17 Responses to “Change folders for Synology media server”

1.                                    Robert 17. Mar, 2010 at 7:10 am
I’m currently using a D-Link DNS-323 NAS. I am considering purchasing a Synology DS-409 as a replacement because I want higher network speeds and more disk space.
When it comes to configuring the media server in the DNS-323, you simply enable the uPnP AV Server in the web interface and then point to a SINGLE folder that contains your media files. In my case, my “media” folder contains a massive subfolder tree of mixed family jpgs and avis organized according to years and months. The photos and videos are NOT separated into distinct folders. For example, I might have a subfolder down the folder tree entitled “2008-02-04 – Disneyland Vacation”. In this folder are all the family pictures AND videos taken on the trip.
The DNS-323 nicely indexes the entire “media” folder and serves up all the photos when requested and/or all the videos when requested.
But the Synology Media Server requires me to separate my photos and videos; It wants all photos under the “photo” shared folder and all videos under the “video” shared folder. I don’t want to do this! I want to keep all media associated with a specific vacation or event in a single appropriately-named subfolder.
So I want both photos and videos to be served and properly indexed from a single “media” folder, just as the DNS-323 does. Can I accomplish this somehow using your “Idea 3: The solution”? I’m a DOS/Windows guy so I’m a little intimidated by your Linux/Unix commands.

2.                                    Rob 20. Mar, 2010 at 12:58 pm
Thanks for sharing this!
Do you know where the ‘ indexed data’ is stored?
I am looking for a solution to index my media via an external tool …

3.                                    Wim 20. Mar, 2010 at 2:27 pm
@Robert
If I find some time this weekend, I’ll take a look into this.
@Rob
The index is stored inside a postgres database. I don’t know if you can access this directly.
You can find postgres in /usr/syno/pgsql/bin/
The databases are stored in /var/database
The indexing takes place in /var/spool/syno_indexing_queue.tmp and /var/spool/syno_indexing_queue

4.                                    Tea Party Latest 12. Apr, 2010 at 4:30 am
Hello, nice writing.

5.                                    lightenup 12. Jun, 2010 at 3:34 pm
Perfect!! Worked like a champ on my DS210j! Just what I was looking for.
-LiGHT

6.                                    Adam 22. Jul, 2010 at 5:53 pm
Hi,
Did anyone get anywhere with Roberts request. I have the same issue whereby I want to keep both video and stills in the same folder but served up via the Video or Photo methods of DNLA. It’s a pity DNLA will not allow you see video in photo folders but hey!
Thanks, Adam

7.                                    m@nu 12. Aug, 2010 at 8:45 am
thanks for your article! i was facing the exact same problem with the symlinks.
since im relativly new to linux, i was happy to find your manual
i have one addition: i had to make the fresh rc.local file executable:
chmod 755 /etc/rc.local
after this, the bind was done after every restart successfully.

8.                                    Bjorn 20. Sep, 2010 at 8:03 am
Good post!
I have a DS107, and your mount solution works when I’m browsing the tree structure, but my files are not auto reindexed.
This is what I did in rc.local:
mount –bind /volume1/family/photos /volume1/photo/family
I was hoping that subsequently adding files in /volume1/family/photos would cause my DS107 to reindex – but this doesn’t happen – any ideas?

9.                                    Wicher 24. Oct, 2010 at 5:17 am
I’ve been struggeling with this problem for a while, but i finaly got it right. Because i’m a n00b, i didn’t understand how to edit the rc.local, and after that it still didn’t work. It seems that it takes a bit of time before you can execute these commands, so you need to put a pause in the rc.local file. Here’s how i did it:
Say you want the folder movies on your USB-disk to be in the video-folder.
# Create a folder movies (or any folder you like) in your video-folder.
# Use Putty to SSH to your Synology.
# Log in as root (username: root, pass: your usual admin password)
# Get to the dir etc:
cd /etc/
#create or edit the file rc.local:
vi rc.local
# press ‘i’ to get into insert mode. Insert the text below:
sleep 30
mount –bind /volumeUSB1/usbshare/movies/ /volume1/video/movies/
# Press ESC to get back into command-mode.
# save and quit the file, type
:wq and then het return.
#check your file (the text should be the two lines you’ve entered):
cat rc.local
Now reboot, use the web-interface to re-index your data, and it should work!

10.                                delProfundo 03. Nov, 2010 at 4:55 am
Thanks Wicher! I was sure my issue was the USB device coming up to speed you have ended my hair pulling!

11.                                keftmedei 06. Nov, 2010 at 1:16 am
Hi,
Thanks for the guide. I used this to set up my movie library on volume2. I.e:
mount –bind /volume2/Film_Tv /volume1/video
Media server indexing works fine as long as I add the files directly to /volume1/video. Not if I use the directory on volume2 for upload. This is fine though.
But my problem is that the movies won’t play on my playstation 3. I get the unsupported format message on every video file. The files show up but I can’t play them. Any ideas?

12.                                Wim 06. Nov, 2010 at 1:27 am
That’s weird. I can play almost every video without any problems.
Have you installed the latest firmware on your PS3 and are you looking on your PS3 in the video folder for the movies?

13.                                keftmedei 06. Nov, 2010 at 1:50 am
Yes it is weird. Yes I’m looking under videos on the ps3 and I have the latest firmware. I just hooked up my TV to the media server and the TV can play the files from the NAS without any problems.
I’v played those files on the ps3 before I copied it all from my computer to the NAS without problems. Now I wonder if there might be a problem with the mount of the video folder. I haven’t tried playing files from the video folder directly so I can’t be sure if that is the issue here.

14.                                keftmedei 06. Nov, 2010 at 2:18 am
I found the problem. There was a setting in the NAS that changed the MIME-types. I disabled it and now it works! Now I just want to be able to play mkv files and use subtitles..

15.                                Boboland 22. Dec, 2010 at 2:04 pm
Hi,
Have any1 tried this with an encrypted folder on the synology? Would you use the ordinary (ex. /volume1/movs) or the “strange” folder (ex. /volume1/@movs@) as ref?
Thanx,
Boboland

16.                                Boboland 23. Dec, 2010 at 3:26 pm
Hi,
Got it working. Needed to change the “sleep 30″ to “sleep 120″ as the box normally mounts my extra mounts before it mounts the encrypted folders.
Sleep 120
mount –bind /volume1/movs /volume1/video
Thanx

17.                                Karsten 05. Feb, 2011 at 12:15 am
I tried the mount -bind and at first it seemd to work. All is fine via DLNA and in Audiostation.
However, if I access the iTunes server, all files show up twice. Looking at the database shows, that it contains all files twice: once under ‘/volume1/music’ and once under ‘/volume1/Media/Audio’ (which is the directory I mounted under /volume1/music).
Does anyone know how to resolve this? How to tell the diskstation which folders to index and which not?
Cheers,
Karsten

Collé à partir de <http://web.archive.org/web/20110224174810/http://dev.eek.be/2010/01/change-folders-for-synology-media-server/>