Deleting millions of Twonky temp playlists with SSH

Hello everyone!

I have 2 TB MBL with  the 7.0.9 Twonky installed. Yesterday I noticed that my mediaserver was down and booting the drive didn’t help… though  this solved the problem.

When I went back to the MBL UI to enable twonky I noticed that my drive was using 780gb of space of which over 550gb were mysterious “other” files. The remaining ~230gb I can count for, they are media in my shared folders.

Coincidentally I found out that the space was taken up by twonky’s old database (/CacheVolume/twonkymedia/renamed_db/). In that directory there are so many files that I can’t list them using SSH which means I can’t delete them efficiently by using conventional “rm” commands. Using the “rm -r folder” the server prompts on every file which are named like this “7471725_temp_playlist.wpl”. The files I encountered have numbers from 4  to 7 digits. So there could be millions of these files? Using a perl code I found from some blog I managed to delete 2 gb in 4 hours… and this is supposed to be a fast method according to the writer:

perl -e ‘chdir “renamed_db” or die; opendir D, “.”; while ($n = readdir D) { unlink $n }’

Found also a  C code that might do the trick but MBL server doesn’t seem to have gcc to compile it.

So the questions:

  1. What is causing this temp_playlist buildup? 

  2. Is there a more efficient way to delete these files?

Galvatron wrote:

Hello everyone!
…Using the “rm -r folder” the server prompts on every file which are named like this “7471725_temp_playlist.wpl”. 

Can’t answer #1, but number #2:

rm -rf folder

the -rf (addition of the -f) means FORCE – it won’t ask you to confirm each file.

Thanks for the answer, rm -rf should work in most cases. I used the rm -f  on purpose to find out the contents of that folder. This rm -rf method doesn’t seem to be any faster than the perl code…

So far I’ve managed to remove 100 gb with rm -rf. The deleting process got a lot faster after disabling mediacrawler and twonkyserver from running.

Found out that all those .wpl files are refering to “radio.m3u” file in twonky-5 folder. I still don’t have any idea why twonky made these 8 million copies of that. During the startup scan twonky finds that renamed database folder and wants to create these 8 million .wpl again in the new /db folder

16:23:37:849  [Trace] - LOG_SCAN: db_add_update_dir_entry_impl : no /DataVolume/cache/millions_of_wpl_db/4152313_temp_playlist.wpl found in db

16:23:37:849  [Info] - LOG_SCAN: db_add_update_dir_entry_impl : adding file /DataVolume/cache/millions_of_wpl_db/4152313_temp_playlist.wpl

16:23:37:956  [Info] - LOG_SCAN: db_add_update_dir_entry_impl : processed

Had to add that folder to ignore list in /CacheVolume/twonkymedia/twonkyserver.ini file:

ignore this directory for scanning (can be a comma separated list)