Saturday, January 8, 2011

Reset MediaTomb Database

My MediaTomb database seem confused and not displaying files specified by a directory I added. So I decided to reset the database.

Here is the information that I found:
http://sourceforge.net/apps/phpbb/freenas/viewtopic.php?f=27&t=696

Basically, just delete mediatomb.db, and mediatomb will recreate one when restarted.

1. Stop the server.
$ sudo /etc/init.d/mediatomb stop
 * Stopping upnp media server mediatomb                                                                     [ OK ] 

2. Delete the database file.
$ cd /var/lib/mediatomb/
$ ls
mediatomb.db  mediatomb.html
$ sudo mv mediatomb.db mediatomb.db.bak

3. Start the server.
$ sudo /etc/init.d/mediatomb start
 * Starting upnp media server mediatomb                                                                     [ OK ] 
$ ls
mediatomb.db  mediatomb.db-journal  mediatomb.db.bak  mediatomb.html

It created a brand new empty database.

10 comments:

  1. Simple, usefull, great!

    ReplyDelete
  2. Thanks, solves my corrupted db problem.

    ReplyDelete
  3. Hi, I have followed these instructions and the mediatomb.db does not re-create. Any suggestions?

    ReplyDelete
    Replies
    1. Does mediatomb fail, or does it work as before with undesired behaviour? Did you stop mediatomb before doing this (if not, it won't care that you renamed the file, it will just keep using it).
      I suggest you look in the /var/lib/mediatomb directory to see if the files are as expected (expected is, your 'mediatomb.db.bak' file is still there, and there's a newly created 'mediatomb.db'). If there's no new file and mediatomb is still working, it means that either you didn't stop and start it (in which case the modified time of the .bak may have advanced), or that your installation is actually storing the database elsewhere.

      Delete
  4. Tnx for the solution, it worked for me.

    In my case, this was the error in /var/log/mediatomb.log:
    ERROR: could not load correct lastID (db not initialized?)

    ReplyDelete
  5. Great help and worked perfectly

    ReplyDelete
  6. Still works, thanks for the simple solution.

    ReplyDelete
  7. WonderFull Socrateos this solves it THANKS

    ReplyDelete