I came across a variant of this today. Mysteriously, one of my data files disappeared (or didn’t make it when switching from another server). None of the restore / restore procedures will work unless you complete the same error that you indicated. Fortunately, I have a separate mongod that has a collection with the same name, since a cheap one hacked, I copied the (true, incorrect) data file to another server, and although I knew that I would not receive any data, the recovery tools (e.g. mongod --repair ) were able to work on their magic, but, as expected, they recovered some data from the file I copied, so I had to weed out some documents. Fortunately, it was the file "mycollection.1", which is only 128 MB.
I do not think this applies in your case, since the index of the missing data file referred to in the log is ridiculously high. Your journal essentially says that it cannot find /data/dbname/mycollection.8388701 . You said that your data set is only 400 GB, so an index that is high just doesn't make sense. You should only have about 200 data files, since by default most of them are 2 GB. What is the result of db.stats() (specifically the fileSize attribute)?
This mongolab entry helped me figure out the structure of the data file.
My advice is where you should start looking:
- run the
db.stats() command to get an idea of how big your data on disk actually is. - Does it make sense that your server is looking for a crazy high index data file? If not, the problem is not with storage, but with the extents and metadata of your collection / database.
- Do your repair tools work? If you have at least enough free disk space as the size of your data set (disk), try the
mongod --repair or db.repairDatabase() tools to start the repair. I assume this will not work as my recovery attempts crashed with the same invalid file index requested error. - Try to copy the “bad” file, as I did, which roughly corresponds to what the missing file will look like (bearing in mind that the size of the data file files is not the same, make every effort to combine it and try to repair). If this works, your data files will be cleared (but it takes up a lot of disk space).
We hope this helps you in the right direction.
source share