2

I am trying to start a mongodb server with the database, that is located on portable drive. I know barely nothing about the internals of this particular database.

There are 647 database.N files, 2G each, and database.ns of size 16M.

I mounted the drive with mongodb user credentials:

$ sudo mkdir /var/lib/mongo-database
$ sudo chown mongodb:mongodb /var/lib/mongo-database
$ sudo mount -o umask=0022,gid=141,uid=130 /dev/sdc1 /var/lib/mongo-database

When I try to start the server, with, or without --repair and/or --upgrade option, I get the following error:

2016-05-03T21:32:48.117+0200 [initandlisten] preallocating a journal file /var/lib/mongo-database/journal/prealloc.0
2016-05-03T21:32:51.050+0200 [initandlisten]        File Preallocator Progress: 387973120/1073741824    36%
2016-05-03T21:32:54.043+0200 [initandlisten]        File Preallocator Progress: 775946240/1073741824    72%
2016-05-03T21:33:04.190+0200 [initandlisten] CMD: drop database.tmp.agg_out.58
2016-05-03T21:33:04.191+0200 [initandlisten] database Invariant failure getExtent( a )->xprev.isNull() src/mongo/db/storage/extent_manager.cpp 550
2016-05-03T21:33:04.196+0200 [initandlisten] database 0xedb3e9 0xe6fb3f 0xe4a0cc 0xc53bc8 0x72e452 0x73ed91 0x73f161 0x7460e6 0x72fe0d 0x8592f4 0x8541e6 0x855400 0x856424 0xb149c9 0x9a3b24 0x9a570c 0x682475 0x66b0f2 0x99a797 0x66a6cf 
 mongod(_ZN5mongo15printStackTraceERSo+0x39) [0xedb3e9]
 mongod(_ZN5mongo10logContextEPKc+0x21f) [0xe6fb3f]
 mongod(_ZN5mongo15invariantFailedEPKcS1_j+0x10c) [0xe4a0cc]
 mongod(_ZN5mongo13ExtentManager11freeExtentsENS_7DiskLocES1_+0x238) [0xc53bc8]
 mongod(_ZN5mongo8Database7_dropNSERKNS_10StringDataE+0x192) [0x72e452]
 mongod(_ZN5mongo12IndexCatalog20_deleteIndexFromDiskERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_i+0x91) [0x73ed91]
 mongod(_ZN5mongo12IndexCatalog10_dropIndexEPNS_17IndexCatalogEntryE+0x1d1) [0x73f161]
 mongod(_ZN5mongo12IndexCatalog14dropAllIndexesEb+0x2e6) [0x7460e6]
 mongod(_ZN5mongo8Database14dropCollectionERKNS_10StringDataE+0x29d) [0x72fe0d]
 mongod(_ZN5mongo7CmdDrop3runERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_7BSONObjEiRS6_RNS_14BSONObjBuilderEb+0x344) [0x8592f4]
 mongod(_ZN5mongo12_execCommandEPNS_7CommandERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_7BSONObjEiRS7_RNS_14BSONObjBuilderEb+0x36) [0x8541e6]
 mongod(_ZN5mongo7Command11execCommandEPS0_RNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb+0xe80) [0x855400]
 mongod(_ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi+0x5e4) [0x856424]
 mongod(_ZN5mongo11newRunQueryB5cxx11ERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_+0x6b9) [0xb149c9]
 mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x6b4) [0x9a3b24]
 mongod(_ZN5mongo14DBDirectClient4callERNS_7MessageES2_bPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xbc) [0x9a570c]
 mongod(_ZN5mongo14DBClientCursor4initEv+0xb5) [0x682475]
 mongod(_ZN5mongo12DBClientBase5queryERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_5QueryEiiPKNS_7BSONObjEii+0x3a2) [0x66b0f2]
 mongod(_ZN5mongo14DBDirectClient5queryERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_5QueryEiiPKNS_7BSONObjEii+0x57) [0x99a797]
 mongod(_ZN5mongo17DBClientInterface5findNERSt6vectorINS_7BSONObjESaIS2_EERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_5QueryEiiPKS2_i+0xbf) [0x66a6cf]
2016-05-03T21:33:04.196+0200 [initandlisten] 

***aborting after invariant() failure


2016-05-03T21:33:04.200+0200 [initandlisten] SEVERE: Got signal: 6 (Aborted).
Backtrace:0xedb3e9 0xeda3a5 0x7fa815c055a0 0x7fa815c05518 0x7fa815c070ea 0xe4a11e 0xc53bc8 0x72e452 0x73ed91 0x73f161 0x7460e6 0x72fe0d 0x8592f4 0x8541e6 0x855400 0x856424 0xb149c9 0x9a3b24 0x9a570c 0x682475 
 mongod(_ZN5mongo15printStackTraceERSo+0x39) [0xedb3e9]
 mongod() [0xeda3a5]
 /lib/x86_64-linux-gnu/libc.so.6(+0x355a0) [0x7fa815c055a0]
 /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7fa815c05518]
 /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7fa815c070ea]
 mongod(_ZN5mongo15invariantFailedEPKcS1_j+0x15e) [0xe4a11e]
 mongod(_ZN5mongo13ExtentManager11freeExtentsENS_7DiskLocES1_+0x238) [0xc53bc8]
 mongod(_ZN5mongo8Database7_dropNSERKNS_10StringDataE+0x192) [0x72e452]
 mongod(_ZN5mongo12IndexCatalog20_deleteIndexFromDiskERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_i+0x91) [0x73ed91]
 mongod(_ZN5mongo12IndexCatalog10_dropIndexEPNS_17IndexCatalogEntryE+0x1d1) [0x73f161]
 mongod(_ZN5mongo12IndexCatalog14dropAllIndexesEb+0x2e6) [0x7460e6]
 mongod(_ZN5mongo8Database14dropCollectionERKNS_10StringDataE+0x29d) [0x72fe0d]
 mongod(_ZN5mongo7CmdDrop3runERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_7BSONObjEiRS6_RNS_14BSONObjBuilderEb+0x344) [0x8592f4]
 mongod(_ZN5mongo12_execCommandEPNS_7CommandERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_7BSONObjEiRS7_RNS_14BSONObjBuilderEb+0x36) [0x8541e6]
 mongod(_ZN5mongo7Command11execCommandEPS0_RNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb+0xe80) [0x855400]
 mongod(_ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi+0x5e4) [0x856424]
 mongod(_ZN5mongo11newRunQueryB5cxx11ERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_+0x6b9) [0xb149c9]
 mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x6b4) [0x9a3b24]
 mongod(_ZN5mongo14DBDirectClient4callERNS_7MessageES2_bPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xbc) [0x9a570c]
 mongod(_ZN5mongo14DBClientCursor4initEv+0xb5) [0x682475]

I have tried to remove journal files, no luck. I have tried to remove database.ns file, as suggested here, but in this case mongo just does not see the database files and creates a default local database.

Is there any way to recover this database?

  • Which version of MongoDB are you using to restore the data? – Markus W Mahlberg May 7 '16 at 17:39
  • @MarkusWMahlberg 2.6.10, the latest in Ubuntu Xenial repos. – Aleksei Matiushkin May 8 '16 at 4:10
  • What filesystem is your portable drive using? – Stennie May 11 '16 at 19:15
  • @Stennie NTFS, but I made sure that mongodb user has r/w access to both files and directories, and, as I have mentioned, it was mounted under mongodb user. – Aleksei Matiushkin May 12 '16 at 3:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.