Due to stupid negligence on my part I forgot to change the MongoDB path. As a result, my collections were stored in /var/lib/mongodb.

As I was filling my collections MongoDB hang. Then I realized that sda1 is full:

Filesystem      1K-blocks     Used Available Use% Mounted on
/dev/sda1       23571900  22350540       908 100% /

Typing du -h /var/lib/mongodb/ returns:

351M    /var/lib/mongodb/journal
20M     /var/lib/mongodb/diagnostic.data
16G     /var/lib/mongodb/

I cannot restart MongoDB. Typing sudo service mongodb start returns:

Failed to start mongodb.service: Unit mongodb.service not found.

I don't care about losing the collections I have created. I can easily recreate them.

Question: Can I manually delete the collection I see inside /var/lib/mongodb without breaking anything?

collection-0-5532744735691012757.wt   index-24-5532744735691012757.wt  _mdb_catalog.wt
collection-23-5532744735691012757.wt  index-32-5532744735691012757.wt  mongod.lock
collection-2-5532744735691012757.wt   index-3-5532744735691012757.wt   sizeStorer.wt
collection-31-5532744735691012757.wt  index-54-5532744735691012757.wt  storage.bson
collection-4-5532744735691012757.wt   index-5-5532744735691012757.wt   WiredTiger
collection-53-5532744735691012757.wt  index-58-5532744735691012757.wt  WiredTigerLAS.wt
collection-57-5532744735691012757.wt  index-61-5532744735691012757.wt  WiredTiger.lock
collection-64-5532744735691012757.wt  index-65-5532744735691012757.wt  WiredTiger.turtle
collection-6-5532744735691012757.wt   index-7-5532744735691012757.wt   WiredTiger.wt
diagnostic.data               index-8-5532744735691012757.wt
index-1-5532744735691012757.wt        journal
  • 1
    Do you want to complete remove your data or are you asking about removing individual files? Wiping your dbPath and restarting is fine; removing individual files will be problematic. – Stennie May 10 '18 at 13:34
  • I'm asking about deleting collection-53-5532744735691012757.wt for example. – Aventinus May 10 '18 at 18:47
  • 1
    Deleting individual files in a WiredTiger storage.dbPath is definitely a no. WiredTiger performs integrity checks on startup and mongod will be unable to start if there is a mismatch in the expected files or checksums. Recovering a compromised dbPath is not straightforward and definitely a situation to avoid. What are your versions of O/S and MongoDB? The service error is likely because the service is named mongod and not mongodb. Try: sudo service mongod start. – Stennie May 15 '18 at 12:54

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.