Exception in initAndListen: 29 Data directory /data/db not found., terminating

Hi All,

I have installed MongoDB on Linux Centos 6.x. as soon as  I am starting it MongoDB server. I am getting Exception in initAndListen: 29 Data directory /data/db not found., terminating error message on the console as you can see below. 

[/mongodb/bin]$ ./mongod
2015-05-12T23:12:38.055+0530 I STORAGE  [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
2015-05-12T23:12:38.070+0530 I CONTROL  [initandlisten] dbexit:  rc: 100

Can anyone help me ?

Posted by Andy on 2015-03-28 07:11:14.0


Hi Andy,

You can do fix [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating by following given two steps.

1. You can create the D:\data\db\ directory and restart the MongoDB server.

2. You can create the data folder as per your choice and run the server with the path of your data folder and restart the 
MongoDB server 

i.e.  D:\MongoDB\Server\3.0\bin>mongod.exe  --dbpath  D:\MongoDB\Server\data​ 

D:\MongoDB\Server\3.0\bin>mongod.exe --dbpath D:\MongoDB\Server\data
2015-05-08T12:49:10.371+0530 I CONTROL  Hotfix KB2731284 or later update is not installed, will zero-out data files
2015-05-08T12:49:10.381+0530 I JOURNAL  [initandlisten] journal dir=D:\MongoDB\Server\data\journal
2015-05-08T12:49:10.391+0530 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed
2015-05-08T12:49:10.511+0530 I JOURNAL  [durability] Durability thread started
2015-05-08T12:49:10.513+0530 I JOURNAL  [journal writer] Journal writer thread started
2015-05-08T12:49:10.520+0530 I CONTROL  [initandlisten] MongoDB starting : pid=10844 port=27017 dbpath=D:\MongoDB\Server\data 64-bit host=MOBILE-JATIN
2015-05-08T12:49:10.521+0530 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2015-05-08T12:49:10.523+0530 I CONTROL  [initandlisten] db version v3.0.2
2015-05-08T12:49:10.524+0530 I CONTROL  [initandlisten] git version: 6201872043ecbbc0a4cc169b5482dcf385fc464f
2015-05-08T12:49:10.526+0530 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1m-fips 19 Mar 2015
2015-05-08T12:49:10.528+0530 I CONTROL  [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
2015-05-08T12:49:10.529+0530 I CONTROL  [initandlisten] allocator: system
2015-05-08T12:49:10.531+0530 I CONTROL  [initandlisten] options: { storage: { dbPath: "D:\MongoDB\Server\data" } }
2015-05-08T12:49:10.536+0530 I INDEX    [initandlisten] allocating new ns file D:\MongoDB\Server\data\local.ns, filling with zeroes...
2015-05-08T12:49:10.751+0530 I STORAGE  [FileAllocator] allocating new datafile D:\MongoDB\Server\data\local.0, filling with zeroes...
2015-05-08T12:49:10.753+0530 I STORAGE  [FileAllocator] creating directory D:\MongoDB\Server\data\_tmp
2015-05-08T12:49:10.901+0530 I STORAGE  [FileAllocator] done allocating datafile D:\MongoDB\Server\data\local.0, size: 64MB,  took 0.139 secs
2015-05-08T12:49:10.911+0530 I NETWORK  [initandlisten] waiting for connections on port 27017
2015-05-08T12:57:29.865+0530 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:60131 #1 (1 connection now open)


Good Luck !!

Posted by Navdeep on 2015-05-13 06:39:47.0