By following the steps below you will be switching off (not removing, it will still there to be used if needed) the default preinstalled Twonky DLNA media server in WD My CLoud and replacing it by the open source solution MiniDLNA (a.k.a. ReadyMedia).
THREE GOOD REASONS TO REPLACE TWONKY BY MINIDLNA
These instructions were applied and proved functional with WD firmware v03.04.01-230 on a WD My CLoud 3TB and Debian repositories as of 26/06/2014. Functionality of MiniDLNA (v 1.1.2) was tested on an LG TV 2013 Model.
UPDATE (11/JUL/2014): APPARENTLY FIRMWARE 4.00.00-607 NO LONGER SUPPORTS THE ABILITY TO SAFELY USE DEBIAN REPOSITORIES OUT THE BOX (a modified version with 64K sized memory pages is now used). You are instead invited to rebuild your own packages.
I assembled them here as a memo mostly for my own reference They may or may not work for you. In any case, use them at your own exclusive risk.
In any case be extremely careful while modifying system files. If you change stuff you should not you may render your device unusable altogether.
Do not touch/edit/change anything unnecessary just out of curiosity or for the sake of it!
If you feel uncomfortable with Linux or by using the command line likely it's better you stick with Twonky as it is.
STEP 0 - The below presupposes (prerequisites to be filled, all must match):
- You have SSH enabled in My Cloud.
- You have an SSH client installed in your PC (Windows users will find Putty handy).
- You know the local IP address of My Cloud so you can connect to it via SSH.
- Your My Cloud has access to the Internet.
- Your My Cloud is running a firmware version prior to release 4.00.00-607.
You should then be able to connect to MyCloud via SSH by using the My Cloud IP and standard port 22 with Username: root and Password: welc0me (provided you did not change it… Also notice “0” is number zero, not a capital o).
STEP 1 - Switch off standard (Twonky server) DLNA support in WD control Panel:
Menu “Settings” -> “Media” -> “DLNA Media Server” -> switch “Media Streaming” button to “OFF” position.
You won’t be needing two DLNA servers running simultaneously.
STEP 2 - Backup your sources.list:
cp /etc/apt/sources.list /etc/apt/sources.list.bak
STEP 3 - Add Debian SID (experimental) repository to source list so you get a more recent version of MiniDLNA:
echo deb http://ftp.us.debian.org/debian/ sid main >> /etc/apt/sources.list
STEP 4 - Update the sid packages list (be patient as it may take a while):
STEP 5 - Install MiniDLNA - When asked to continue the installation type y and hit enter (a number of dependencies will be included amounting to around 60MB):
apt-get install minidlna
STEP 6 - Stop MiniDLNA so you can edit the configuration files:
sudo service minidlna stop
STEP 7 - Edit the MiniDLNA’s startup script in /etc/init.d:
Look for the following line: PIDDIR=/run/$NAME
Add /var to the beginning of the path so it instead reads: PIDDIR=/var/run/$NAME
Note: Keyboard shortcuts to operate Nano editor are listed in the bottom of the window. “^” means press “Ctrl” key (+ given letter)
STEP 8 - Edit the configuration file /etc/minidlna.conf
Read the instructions supplied there and configure accordingly. Namely:
If you want to restrict a media_dir to a specific content type, you can
#prepend the directory name with a letter representing the type (A, P or V),
followed by a comma, as so:
Note: the above example adds the standard My Cloud Public Shared folders. You will want to add additional folders you may have created.
# Path to the directory that should hold the database and album art cache. Change to a folder you created somewhere in the large Public Data folder of My Cloud.
_ Note1: Very important to do this. Otherwise you will be filling the small OS partition.
Note2: The above example requires you to create a /programs/minidlna/cache
folders inside the Public Share Folders (you can use any file explorer for that matter).It can be anywhere else,
provided inside /DataVolume/shares/Public/_
Path to the directory that should hold the log file.
_ Note1: Very important, otherwise you will be filling the small OS partition. _
Note2: The above example requires you to create a /programs/minidlna/
folder inside the Public Share Folders. It can be anywhere else,
provided inside /DataVolume/shares/Public/
Note 3: Having a log file is actually OPTIONAL (you can skip it) but useful for debug purposes.
Note: Replace YOUR.WD.MYCLOUD.IP by whatever IP your My Cloud has on LAN (local network). I am assuming it is static (always the same, as configured/attributed by the router).
Automatic discovery of new files in the media_dir (uncomment/remove the initial # to make it active)
Note: Automatically searches for new files added without the need to restart the program.
STEP 9 - Add user minidlna to share group:
usermod -a -G share minidlna
Note: Critical, otherwise you will have Read/Write permission issues. Most notably with the “force-reload” option (see below).
STEP 10 - Move back your original sources.list:
mv -f /etc/apt/sources.list.bak /etc/apt/sources.list
STEP 11 - Start MiniDLNA:
service minidlna start
STEP 12 - Increase inotify watch limit (Optional)
If you have enabled inotify (see step 8.e, above) and should you ever stumble on errors about inotify file watch limit being reached (you may wish to do this preventively as well in case you anticipate having a really large number of files) try issuing the following command:
echo fs.inotify.max_user_watches=100000| sudo tee -a /etc/sysctl.conf && sudo sysctl -p
This will define and apply a maximum of 100000 files to be watched by adding the following line to /etc/sysctl.conf:
Reference: Increasing the amount of inotify watchers
BEAR IN MIND
You should turn firmware automatic updates off and backup configuration files in case you futurely update the NAS firmware and need to reinstall MiniDLNA.
The above works for files publicly accessible by everyone. Should you wish MiniDLNA to index and serve files included in directories of particular users you will need to tweak permissions.
service minidlna stop //stops daemon
service minidlna start //starts daemon
minidlnad //same as previous (starts daemon)
service minidlna force-reload //forces cleaning the database and starting fresh
Accessing the following URL in a browser will show a summary of indexed files and connected clients:
[Replace YOUR.WD.MYCLOUD.IP by whatever IP your My Cloud has on LAN (local network)]
List of files installed by package:
USEFUL DOCUMENTATION ELSEWHERE
While googling for documentation/help bear in mind that My Cloud is propelled by the Debian distribution (whose relatives include Ubuntu and Mint for instance). User experiences using minidlna in these is more likely to apply.