title: MongoDB can not start after restart the system on Ubuntu 14.04 LTS
body: <p>I've installed mongoDB on ubuntu 14.04 according to the official installation guide: <a href="http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/" rel="nofollow">http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/</a></p>
  
  <p>I enter the terminal using "mongod" and everything is OK.</p>
  
  <p>But when I shut down my ubuntu and restart it, command 'mongod' just cannot start, one error happens below:</p>
  
  <pre><code>2015-01-30T15:47:51.582-0800 [initandlisten] allocator: tcmalloc
  2015-01-30T15:47:51.582-0800 [initandlisten] options: {}
  2015-01-30T15:47:51.583-0800 [initandlisten] exception in initAndListen: 10296 
  *********************************************************************
   ERROR: dbpath (/data/db) does not exist.
   Create this directory or give existing directory in --dbpath.
   See http://dochub.mongodb.org/core/startingandstoppingmongo
  *********************************************************************
  , terminating
  </code></pre>
  
  <p>After that, I tried to create the folder and chmod it using:</p>
  
  <pre><code>sudo mkdir -p /data/db/
  sudo chown `id -u` /data/db
  </code></pre>
  
  <p>but another error happened:</p>
  
  <pre><code>2015-01-30T16:01:43.855-0800 [initandlisten] allocator: tcmalloc
  2015-01-30T16:01:43.855-0800 [initandlisten] options: {}
  2015-01-30T16:01:43.859-0800 [initandlisten] journal dir=/data/db/journal
  2015-01-30T16:01:43.859-0800 [initandlisten] recover : no journal files present, no recovery needed
  2015-01-30T16:01:43.994-0800 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
  2015-01-30T16:01:43.994-0800 [initandlisten] ERROR: addr already in use
  2015-01-30T16:01:43.994-0800 [initandlisten] allocating new ns file /data/db/local.ns, filling with zeroes...
  2015-01-30T16:01:44.197-0800 [FileAllocator] allocating new datafile /data/db/local.0, filling with zeroes...
  </code></pre>
  
  <p>I also looked for /etc/mongod.conf,</p>
  
  <pre><code># Where to store the data.
  
  # Note: if you run mongodb as a non-root user (recommended) you may
  # need to create and set permissions for this directory manually,
  # e.g., if the parent directory isn't mutable by the mongodb user.
  dbpath=/var/lib/mongodb
  
  #where to log
  logpath=/var/log/mongodb/mongod.log
  
  logappend=true
  
  #port = 27017
  </code></pre>
  
  <p>where I found the default data storage folder is not /data/db</p>
  
  <p>I've tried other ways like</p>
  
  <pre><code>sudo service mongod stop
  sudo service mongod restart
  </code></pre>
  
  <p>But they simply do not work.</p>
  
  <p>May be there's another instance already run when the system starts, but how can I stop it?</p>