![]() |
#1 |
Building Better Worlds
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 43
Karma: 53376
Join Date: Aug 2011
Location: SE Michigan
Device: PRS-600, 3G Kindle Keyboard, iPhone 5S, iPhone 6+, Paperwhite 2
|
corrupt metadata.db files
Hello.
Recently my metadata.db files in the main calibre library got corrupted. This includes the backup. I say corrupted, but it's possible they got tampered with by someone having access to my computer. Either way, all the ebook files are there, but calibre does not recognize them in it's library. (Think walking into a library, shelves full, but the computer saying no books in the building). ![]() ![]() ![]() ![]() I can 'add to library' but when I do that it creates duplicate folders and books. I don't want to move my books because they sync with an online backup (which also sync'd the metadata.db files, so I can't get them back from there either). How do I rebuild the library without 'copying' the books and having thousands of duplicate files? ![]() Naloomi |
![]() |
![]() |
![]() |
#2 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
@Naloomi Disable online backup synching, copy what you have to local storage - eg. elsewhere on your disk, another computer, server, usb stick etc
What online backup service are you using ? If its Google Drive then it might have done the 'tampering', see WARNING - Google Drive Incompatible with Calibre! Otherwise, use Library Maintenance->Restore database - it will build a fresh metadata.db from the metadata.opf files in the book folders Then run Library Maintenance->Check Library and resolve any anomalies in the second phase, hopefully there wont be any When you're happy with the rebuild you could restart the online synch - although if it were me I'd trash what I had on the online service and start over. Once you satisfied that all is OK, including your online backup & restore processes you can trash the local backup. BR Last edited by BetterRed; 02-22-2014 at 09:32 PM. |
![]() |
![]() |
![]() |
#3 |
Handy Elephant
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,737
Karma: 26785684
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Samsung Galaxy Tab S8 Ultra
|
If you are lucky there are updated opf-files together with the book-files. These opf-files contains backup metadata that calibre can use to reconstruct the database.
There are two possible methods: 1. Use the library maintenance tools to restore the database, as suggested by BetterRed above. 2. Create a new empty library with the same structure as the corrupt one (there is an option to du just that) and add the books in the old library to the new library, from subfolders, with one book per folder. Calibre will then scan the old library and add all the books, using the metadata in the opf-files. It can take a while, if the library is large... I would try 2 first, even if it is slower, because it creates a whole new library and leaves the old library as it is. Just in case there are more problems. But it means that you afterwards have to move the library to make the online backup work again. Most likely the culprit was the online backup software. Perhaps you have had the backup software working while you had calibre running? That may create either a corrupt backup or a corrupt calibre library. Last edited by Adoby; 02-22-2014 at 03:59 PM. |
![]() |
![]() |
![]() |
#4 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,057
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Rebuild is my first choice |
|
![]() |
![]() |
![]() |
#5 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
Does the restore/rebuild fix up the folder names to tally with the book id in the opf and hence new database book table, or renumber everything or...? BR |
|
![]() |
![]() |
![]() |
#6 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
In a virtual way of course. So id #'s should be totally ignored, as the whole library really is being rebuilt from scratch. EDIT: I'm wrong, shows what I get for assuming things. ![]() Last edited by eschwartz; 02-23-2014 at 02:18 AM. Reason: added quote |
|
![]() |
![]() |
![]() |
#7 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
I think you should make that post a response to mine - lest it confuse the OP
Does it really backup the library, the database yes - but RU sure it backs up the library, and if so where to - one of mine is fast approaching 800GB - not something I want copied willy nilly to some unknown location. BR Last edited by BetterRed; 02-23-2014 at 06:17 AM. |
![]() |
![]() |
![]() |
#8 | |
Building Better Worlds
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 43
Karma: 53376
Join Date: Aug 2011
Location: SE Michigan
Device: PRS-600, 3G Kindle Keyboard, iPhone 5S, iPhone 6+, Paperwhite 2
|
Library is large, close to 6400 e-books (I am at 6271 post problem).
I use Box, although due to the way it works I may end up having to switch to Dropbox (box does a popup for downloads that my Kindle doesn't accept, so getting books to my Kindle Keyboard 'on the go' is not possible without logging into my computer remotely and using 'send to kindle'. I hear that Dropbox does not do things this way, but have yet to test.) I have completed step 1 that BetterRed suggests (use Library Maintenance->Restore database - it will build a fresh metadata.db from the metadata.opf files in the book folders). It has resulted in some 'errors', but looking closely at them they are all the same error, just with many different books. Quote:
EDIT #1 - TONS of errors, but TBH, many/most of these errors were probably there to begin with. EDIT #2 - The PRIMAY KEY is the # at the end of the folder name, isn't it? That's what I'm seeing. Duplicate folders, 'same book' although they're in different folders. Example: Bob Builds Roads (666) Bob Builds THE Roads (666) Same book (made up), same 'KEY', but different folders thus the errors, right? Naloomi Last edited by Naloomi; 02-23-2014 at 12:37 AM. |
|
![]() |
![]() |
![]() |
#9 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#10 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
And how many is a 'multitude' - are you saying that it was OK up to 6271. That error is 'unusual' as its the sort of thing that theoretically can't happen, I advise to wait for Kovid to respond - you could him a give him a nudge via a PM referring him to your thread. BR |
|
![]() |
![]() |
![]() |
#11 | |
Building Better Worlds
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 43
Karma: 53376
Join Date: Aug 2011
Location: SE Michigan
Device: PRS-600, 3G Kindle Keyboard, iPhone 5S, iPhone 6+, Paperwhite 2
|
Quote:
As I mentioned in Edit #2, it seems to be because the PRIMARY KEY. If I'm right, the PRIMARY KEY in the database is that # that follows book title. And a spot check has confirmed that each time that I have checked the books with the error they have a 'duplicate' folder with the same # after the folder name. I just did a search (8279, the Ruth Plumly Thompson book, is Yankee in Oz) for the book referenced with # 8279. I found it, as a PDF, in a different directory (Unknown Author). When I open the directory, that folder has the Tag # of 8279. Lets confirm this further. L. Frank Baum\The Scarecrow of Oz (8296) (This one has the error). Calibre Library\Unknown\Oz 9. The Scarecrow of Oz (8296) Eloise Jarvis McGraw\Merry Go Round In Oz (8277) (Has the error) Calibre Library\Unknown\Oz 40. Merry Go Round In Oz (8277) Ugh. So it appears I have duplicates that were never found in my 'find duplicate' purge months ago. BetterRed, thank you for all your help so far on this. Naloomi |
|
![]() |
![]() |
![]() |
#12 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
@eschwartz - I think it uses the old book numbers - just restored my test library (35 books), the book folders appear to have the original numbers appended
Code:
E:\Calibre Libraries\Test\Unknown\Here is a bear (122)\metadata.opf E:\Calibre Libraries\Test\Unknown\A Tale of Forbidden Love (114)\metadata.opf E:\Calibre Libraries\Test\Tony Marx\What Happened to Obama 2 (30)\metadata.opf E:\Calibre Libraries\Test\Tony Marx\Unknown (121)\metadata.opf E:\Calibre Libraries\Test\tester\test (93)\metadata.opf E:\Calibre Libraries\Test\Rubbish\Test PDF (120)\metadata.opf E:\Calibre Libraries\Test\Maya Angelou\His Day Is Done_ A Nelson Mandela T (131)\metadata.opf E:\Calibre Libraries\Test\Marx, Tony\Wither the Tea Party (132)\metadata.opf E:\Calibre Libraries\Test\Lauren St John\Fire Storm (95)\metadata.opf E:\Calibre Libraries\Test\IMF\Greece_ First and Second Reviews (12)\metadata.opf E:\Calibre Libraries\Test\GLENDA JACKSON\Unknown (72)\metadata.opf BR Last edited by BetterRed; 02-23-2014 at 03:01 AM. |
![]() |
![]() |
![]() |
#13 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,353
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The restore process is designed to restore from corruption of metadata.db, not the rest of the files/folders. Therefore, it requires the rest of the files folders to be in an uncorrupted state to work.
If both metadata.db and the rest of the files/folders are corrupted, your best bet is to use the add books from subfolders, one per folder technique with a new library. |
![]() |
![]() |
![]() |
#14 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
Move the \Calibre Library\Unknown\ folder out of the \Calibre Library\ folder with a file manager (Windows Explorer, Finder, Nautilus, whatever) and then rerun the database restore. If you still get errors then run the Library Maintenance->Check Library function, the second phase will tell you of discrepancies, you can save the results to the clipboard. That should get you a place where you can resolve the discrepancies and hopefully end up with a clean library. If it looks beyond repair - then you'll have to add all the books into a fresh library as suggested by Adoby & Kovid. ------- What operating system are you using, and how long have you been using calibre ? This is Windows only - I have a memory cell telling me that one could get a duplicate book number on a folder if you changed the author or title of a book whilst you had a format file open in a program that locked the file. The programs I know of that lock the files are Word for DOC, RTF, DOCX etc files, also XChange & Nitro for PDF files. But Kovid fixed that some time ago - early last year or maybe 2012. Does that ring any bells? I stress this is a Windows issue, Linux and OS/X don't provide any file locking mechanism. Once you get the library back together I suggest you run the Check Library function now and again - I do it weekly, doesn't take long, just ran it on my 7482 'book' media library in < 2mins. I don't have a super fast computer. BR Last edited by BetterRed; 02-23-2014 at 02:49 AM. |
|
![]() |
![]() |
![]() |
#15 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Metadata corrupt when sending files to free.kindle.com | olgs | Amazon Kindle | 2 | 09-03-2011 02:54 AM |
Re-importing Library after corrupt metadata.db | samhain | Library Management | 3 | 03-07-2011 01:57 PM |
DR1000 Files don't show up in Irex - corrupt SD? | mcarro | iRex | 3 | 03-01-2011 06:39 AM |
My Metadata file seems corrupt | gandor62 | Calibre | 3 | 03-27-2010 08:40 PM |
corrupt metadata.db and redoing library | Dopedangel | Calibre | 6 | 01-01-2010 04:49 PM |