I have been trying to recover my data store from the physical location. I was running MongoDB Community Version 4.0.10 and accidentally deleted the /bin directory. However, my MongoDB data was located at /var/lib/mongodb and had 105 files in it. According to the log generated while deletion, I got the confirmation that none of the files of the data directory was deleted.
So I copied the entire data from “/var/lib/mongodb” to my local machine and kept it in the same location, installed the same version of MongoDB, which is 4.0.10, but could not manage to retrieve the data.
After that, I have run the following command to see if I can repair the data:
sudo mongod --repair --dbpath /var/lib/mongodb
This process also did not help as I received the message “Aborted” affer I executed it. In the log file of MongoDB located at /etc/mongod.log, I have found a line that says:
read checksum error for 4096B block at offset 249856: block header checksum of 0x1c71aba3 doesn’t match expected checksum of 0x5881888d"}}
I am sure that none of the files in the server data directory has been deleted.
I have also used the following commands to give permissions to my local data directory:
sudo chown -R mongodb:mongodb /var/lib/mongodb sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
But I still could not recover the data. Can someone please help?