title: java.io.IOException: Cannot create directory /home/dataflair/hdata/dfs/name/current during Hadoop installation
body: <p>I am installing hadoop . Everything went well but when i tried this command to format : </p>
  
  <pre><code>//Format the name node:
  $bin/hdfs namenode -format
  </code></pre>
  
  <p>I got the following errors : </p>
  
  <pre><code>&gt; 16/06/30 12:58:12 WARN namenode.NameNode: Encountered exception during
  &gt; format:  java.io.IOException: Cannot create directory
  &gt; /home/dataflair/hdata/dfs/name/current    at
  &gt; org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.clearDirectory(Storage.java:334)
  &gt;   at
  &gt; org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:546)
  &gt;   at
  &gt; org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:567)
  &gt;   at
  &gt; org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:148)
  &gt;   at
  &gt; org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:930)
  &gt;   at
  &gt; org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1368)
  &gt;   at
  &gt; org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1493)
  &gt; 16/06/30 12:58:12 FATAL namenode.NameNode: Failed to start namenode.
  &gt; java.io.IOException: Cannot create directory
  &gt; /home/dataflair/hdata/dfs/name/current    at
  &gt; org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.clearDirectory(Storage.java:334)
  &gt;   at
  &gt; org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:546)
  &gt;   at
  &gt; org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:567)
  &gt;   at
  &gt; org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:148)
  &gt;   at
  &gt; org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:930)
  &gt;   at
  &gt; org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1368)
  &gt;   at
  &gt; org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1493)
  &gt; 16/06/30 12:58:12 INFO util.ExitUtil: Exiting with status 1 16/06/30
  &gt; 12:58:12 INFO namenode.NameNode: SHUTDOWN_MSG: 
  &gt; /************************************************************
  &gt; SHUTDOWN_MSG: Shutting down NameNode at rahul-knoldus/127.0.1.1
  &gt; ************************************************************/
  </code></pre>
  
  <p>I have tried <code>sudo hdfs namenode -format</code>
  but its not working .</p>