Optimising Operation of the Media Server
Q. How does the Twonky service work on the MyCloud?
A: [Twonky is installed as a Linux service. Like other such services, there is a service control file in the
This is called when the twonky service is invoked, and there are a number of options for the control of Twonky using an SSH root login:
service twonky start service twonky stop service twonky restart service twonky status
If you execute the
stop commands with Media Streaming turned on in the Dashboard, you are likely to confuse the Dashboard; you may get an
writeTwonkyContentDir.sh, which, as we’ll see later (Q: How do I stop MyCloud breaking the Twonky Server?), reads the
/etc/contentdir file and modifies the
twonkyserver.ini file to set the media search paths and types, and then starts the Twonky server.
[It is assumed that the MyCloud Dashboard uses these Twonky service calls to start and stop the Twonky server].
Q. Where is the Twonky database stored?
A: Since Twonky is a service running on MyCloud, it is not visible in the shared space, so you have to log in via SSH, and navigate around the MyCloud’s Linux file system.
Once you have logged in, use the
cd command to change directory to Twonky’s area:
Now see what’s there with a directory list:
Q. Where are the Twonky settings stored?
A: One of the files listed above is the Twonky configuration file:
This file contains all the settings that control how Twonky works.
Now, this is where some of the fighting occurs, because both MyCloud and Twonky can modify this file…
When you are happy that Twonky is working correctly, I’d recommend making a copy of the file in your
Public area, where it won’t be mangled by MyCloud firmware upgrades or restarts. For instance:
cp /CacheVolume/twonkymedia/twonkyserver.ini /shares/Public/twonkyserver.ini
If things go wrong, you can reinstate this file by swapping the source and destination.
Q. What do all the settings in Twonky’s configuration file do?
A: [Most of them are provided with comments that explain their purpose].
[There are some ‘magic numbers’ embedded in the configuration file that seem to cause problems, and I don’t know what changes those; I suspect that a firmware upgrade does it. If anyone can monitor these values before and after a MyCloud firmware upgrade and report any changes, I’d be obliged:
# UserID Please Do NOT change it manually
# twonky info for Media Feeds Please Do NOT change it manually
Q. How do I clear Twonky’s database and start again?
A: If Twonky doesn’t seem to be behaving correctly (not finding media correctly, or partially, or finding unwanted media), then it may be useful to clean up the database.
There are a number of escalating actions you can take. Starting with the mildest, and increasing in severity, these are as follows:
1. Initiate a library rescan, using either:
Settings|Media|DLNA Database|Rescan in the Dashboard, or
Settings|Advanced|Server Maintenance|Rescan Content Folders in the Twonky UI.
2. Initiate a library rebuild, using either:
Settings|Media|DLNA Database|Rebuild in the Dashboard, or
Settings|Advanced|Server Maintenance|Restart Server in the Twonky UI.
3. Finally, you can completely clear out Twonky’s working area. [This can be useful if you notice the
[Error] - LOG_SYSTEM: Error: 2 No such file or directory report in the Twonky logfile. I don’t know what causes this error, or whether it has serious consquences, but I have found it to be associated with periods of diffcult behaviour.]
Turn Twonky off using the
Settings|Media|DLNA Media Server|Media Streaming control in the Dashboard. Then SSH root login, and hide the entire Twonky working area:
mv twonkymedia twonkymedia_bak
Restart the Twonky Server using the Dashboard; it will re-create Twonky’s working area with a clean version with default settings. You can then use the Twonky UI to put your settings back in place. You might try doing this one-by-one, saving the settings and restarting the Twonky server from the Twonky UI each time, then checking the logfile after the Twonky UI has re-appeared.
Once you’re happy with the operation of the clean startup, you can delete the old Twonky working area:
rm -f -R /CacheVolume/twonkymedia_bak
-f -R flags mean ‘delete EVERYTHING from here down… yes, I mean it’. nb. it will only delete the Twonky database; it won’t delete any of your media. But do be careful that you type the command in correctly;
rm -f -R is a powerful command (
-f means force,
-R means recursive), and could do a lot of damage if you get it wrong…
Q. Where can I find debug log files for Twonky?
A: You can enable activity logging using the
Settings|Advanced|Logging control in the Twonky UI. You can also open the logfile from there.
Alternatively, the logfile is stored in Twonky’s area:
There’s also a MyCloud system logfile that records actions on the Twonky server, such as start and stop:
Q. How do I stop MyCloud breaking the Twonky Server?
A: Firstly, go to the
Settings|Firmware page in the Dashboard, and disable Auto Update: firmware upgrades completely destroy the
/CacheVolume/twonkymedia area, and replace it with new, default version, so you’ll be back to square one.
Secondly, don’t use the Dashboard to change the
Media Serving settings on any Shares; if you do this, it will overwrite any changes you make via the Twonky UI, setting any enabled shares back to ‘All Content Types’.
Thirdly, we can stop the problem of Media Streaming restarts overwriting the Twonky UI settings. Using an SSH root login, enter the following commands:
mv writeTwonkyContentDir.sh writeTwonkyContentDir.sh.old
This disables the script that MyCloud calls when it starts Twonky, which overwrites your settings.
Another way of fixing the settings is to leave this script alone, but change the file it uses as the source of the settings. Admittedly, this will still override any changes made via the Twonky UI. The file is found here:
Replace this with a single control line, with no line terminator, e.g.
This will select my earlier settings.
The format is a comma-separated list of shares and media search and aggregation control flags:
+ enable media searching on the share
- disable media searching on the share
A look for all media types
M look for music
P look for pictures
V look for videos
lower case letters enable aggregation of these media types.
The | terminates the media type string [you can search for multiple types in a share].
It is possible to modify the MyCloud’s user startup script to perform a number of useful tasks every time it reboots, such as stopping the indexing and thumbnailing services, and restoring the
twonkyserver.ini files from a location in User space. Here’s an example of the
Finally, NEVER USE THE ‘SHARE FILE’ FUNCTION. It will destroy the settings, reverting back to ‘All Content Types’ in the root of any share that has media sharing enabled. For absolutely no good reason, since remote file sharing and local media server are completely unrelated functions; the media server cannot be accessed outside the network. Sadly, once again, WD deny all responsibility for destroying your carefully-honed media server settings, with the pathetic excuse “Twonky may be part of our product, but it is a 3rd party software. We don’t provide support for third party products or software.”
Q: How can I change the location of the ‘Shared Media’ folders?
A: This brings us deep into the guts of the
twonkyserver.ini file… There are a number of settings that control where Twonky stores uploaded files and ‘
servermanaged’ media, [which are used for aggregation], and there is no control setting for them in the Twonky UI. To change the location of the folders we have to do an SSH root login and edit the
twonkyserver.ini file. The lines in question are as follows:
You can change these locations to suit your desired file system. For instance, you could create a single ‘
Shared’ folder in the your media share, with sub folders for the different media types, e.g. I use:
Or you could create a Shared sub folder within each of your main media folders, e.g.
However, if you choose that option, you will need to stop Twonky searching there, by adding
Shared to the list of ignored directories discussed above.
Q. Why does setting a Twonky access control password prevent the MyCloud from sleeping?
A: It has been reported that if a username and password are set using the
Settings|Advanced|Secured Server Settings control in the Twonky UI, that the MyCloud then never sleeps. [It appears that the MyCloud continues to interrogate the drive in some way, hoping to get status of the Media Server from Twonky, but Twonky won’t talk to it because it doesn’t have the required permission.].
I don’t think this is very important, since the MyCloud is mainly intended for home use, and the Twonky control UI isn’t visible external to your local network, and all users on your local network must be trusted*, since you’ve given them the network access code, [and they have access to the Public area, and could wreak havoc there…]
If you need to make your music library available to visitors who cannot be trusted, create a private share and put all your media under that, then enable media serving on that share, and get Twonky to search for media in that private share. DLNA ignores access control, so DLNA clients will be able to see the media on your private share, but visitors will not have access to your private share via network file access.
[However, if you feel that secured access to the Twonky UI is necessary, then I would suggest that you disable the Twonky server using the
Settings|Media|Media Streaming control, then SSH login as root, and start Twonky using the command:
service twonky start
You won’t get the media scan status in the Dashboard, but the Twonky Server and UI will be running.]
* Breaches of this trust should be punished in an appropriate manner…
Q. Can I replace Twonky with another Media Server?
A: Yes; forum users hvalentim and Nazar78 have posted good threads about this:
Kudos to them
It may also be possible to upgrade to the latest version of Twonky, by downloading the appropriate WDMyCloud zip file from
I haven’t tried this, and can’t give advice on how to install the newer version. You’re welcome to try it, and report back here… This thread might give some clues:
Note that you’ll have to buy a licence to allow this to run after a 30-day trial period. It’s currently about €15.