Monday, January 21, 2013

Thumbnails on Synology NAS

After moving from DSM3 to DSM4.0, the NAS started creating thumbnails of images.
This consumes CPU power for ages: several days may be needed to create thumbs, with the disk continuously scratching and the CPU at 100%.
After 15days of processing I was still left with 20000+ images to process.
Peering through the forums I found that this was an issue everybody met and I was eventually pointed to a great script by Phillips312: synoThumbs.sh, which uses your PC CPU and RAM to create the thumbnails and then moves the thumbs to the proper "@eaDir" on the NAS.

This is the comment I left there, to list what I did to let it work:
This works for DSM4.0 and DSM4.1, both tested on my DS210j.

0. pause the thumbnails creation on the NAS (not actually needed)
1. in your linux box, install nfs-common
2. in your DSM control panel, go to NFS management and create the appropriate rules for your PC. In my case, the NAS is on 192.168.2.10. The PC is on 192.168.2.40. The rule I’ve created allows read/write access to 192.168.2.40. It works with “no mapping” and with “mapping to root account” as well. It didn’t work by mapping the hostname, I had to fill in the real IP address.
3. on your PC:
a) showmount -e 192.168.2.10 (to check that the PC ip address is correctly allowed to access)
b) sudo mkdir /mnt/photo
c) cd /mnt
d) sudo cp /path-to-the-script/synoThumbs.sh .
e) sudo chmod u+x synoThumbs.sh
f) sudo mount -o soft,intr,rsize=8192,wsize=8192 192.168.2.10:/volume1/photo /mnt/photo
g) ./synoThumbs.sh photo
4. the script seems to hang doing nothing, but I guess it is just looking through your files. After a while it will start showing thumbnails already created or creating the new thumbs.
5. relax, take your time and say thanks to Phillips312!!!!


Help on NFS found here.

Now, what I'm thinking of is to completely remove the photostation, which is terribly slow to browse. And all those thumbnails are taking a lot of space, too.
So, two interesting links on the subject:

http://forum.synology.com/enu/viewtopic.php?f=17&t=37379&start=150#p229956
1.I created a directory named Photographs under the Files directory.
2.I moved all my photos into this directory.
3.I turn off Media server long enough to change the properties of the “system created” Phot directory and made it hidden to my network places.
4.I restarted Media Server to allow the Diskstation to be seen as a UPnp device on the network again…. No More Coverting…. Hooray!

http://forum.synology.com/enu/viewtopic.php?f=17&t=52060&start=75

1) SSH in to the NAS as root (as previously in this thread)
2) Stop the thumbnailing service
Code: Select all
/usr/syno/etc/rc.d/S77synomkthumbd.sh stop

3) Disable the thumbnailing service app from running (it's a linux thing, this marks the file as not executable)
Code: Select all
chmod -x /usr/syno/bin/synomkthumbd

4) Optionaly, and at your own risk, go in to your files root directory and delete any previously generated thumbnail folders/directories from the whole directory tree
Code: Select all
cd /volume1/
find ./ -type d -name "@eaDir" -exec rm -rf {} \;

And before removing everything, this is what NERDlogger suggests:
Run the command below and it will “echo” the names of these “@eaDir” folders to the terminal. Then once you’re satistied that it’s working well (no weird filenames/characters/etc.), then replace the “echo” with “rm -rf” to actually remove those folders.
find . -name "@eaDir" -type d -print |while read FILENAME; do echo "${FILENAME}"; done