title: Hadoop: Error while copy file local directory to Hdfs
body: <p>When i try to copy directory of 3 files in hdfs i get following errors</p>
  
  <pre><code>     hduser@saket-K53SM:/usr/local/hadoop$ bin/hadoop dfs -copyFromLocal /tmp/gutenberg /user/hduser/gutenberg
  12/08/01 23:48:46 WARN hdfs.DFSClient: DataStreamer Exception: org.apache.hadoop.ipc.RemoteException: java.io.IOException: File /user/hduser/gutenberg/gutenberg/pg20417.txt could only be replicated to 0 nodes, instead of 1
  12/08/01 23:48:46 WARN hdfs.DFSClient: Error Recovery for block null bad datanode[0] nodes == null
  12/08/01 23:48:46 WARN hdfs.DFSClient: Could not get block locations. Source file "/user/hduser/gutenberg/gutenberg/pg20417.txt" - Aborting...
  copyFromLocal: java.io.IOException: File /user/hduser/gutenberg/gutenberg/pg20417.txt could only be replicated to 0 nodes, instead of 1
  org.apache.hadoop.ipc.RemoteException: java.io.IOException: File /user/hduser/gutenberg/gutenberg/pg20417.txt could only be replicated to 0 nodes, instead of 1
  </code></pre>
  
  <p>My fsck output is</p>
  
  <pre><code>hduser@saket-K53SM:/usr/local/hadoop$ bin/hadoop fsck -blocks
  FSCK started by hduser from /127.0.0.1 for path / at Wed Aug 01 23:50:49 IST 2012
  Status: HEALTHY
  Total size: 0 B
  Total dirs: 10
  Total files:    0 (Files currently being written: 2)
  Total blocks (validated):   0
  Minimally replicated blocks:    0
  Over-replicated blocks: 0
  Under-replicated blocks:    0
  Mis-replicated blocks:      0
  Default replication factor: 1
  Average block replication:  0.0
  Corrupt blocks:     0
  Missing replicas:       0
  Number of data-nodes:       0
  Number of racks:        0
  FSCK ended at Wed Aug 01 23:50:49 IST 2012 in 3 milliseconds
  
  
  The filesystem under path '/' is HEALTHY
  </code></pre>
  
  <p>Also when i try to format namenode i get following error</p>
  
  <pre><code>hduser@saket-K53SM:/usr/local/hadoop$ bin/hadoop namenode -format
  12/08/01 23:53:07 INFO namenode.NameNode: STARTUP_MSG: 
  STARTUP_MSG: Starting NameNode
  STARTUP_MSG:   host = saket-K53SM/127.0.1.1
  STARTUP_MSG:   args = [-format]
  STARTUP_MSG:   version = 1.0.3
  STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-   1.0 -r 1335192; compiled by 'hortonfo' on Tue May  8 20:31:25 UTC 2012
  
  Re-format filesystem in /app/hadoop/tmp/dfs/name ? (Y or N) y
  Format aborted in /app/hadoop/tmp/dfs/name
  12/08/01 23:53:09 INFO namenode.NameNode: SHUTDOWN_MSG: 
  SHUTDOWN_MSG: Shutting down NameNode at saket-K53SM/127.0.1.1
  </code></pre>
  
  <p>Any help would be appreciated..</p>