HDFS Under-Replicated and Missing Blocks: Diagnostic Guide
Diagnose and repair HDFS under-replicated and missing blocks using dfsadmin, fsck, and log checks before clients see FileNotFoundException.
17 Oct 2025, 18:39 UTC

Recognize the condition
HDFS stores each file as blocks, and each block is replicated across DataNodes according to dfs.replication, commonly set to 3. A block is under-replicated when fewer live copies exist than the replication factor. It is missing when the NameNode knows the block should exist but no DataNode reports a healthy replica.
You will typically see:
- Client jobs fail with
FileNotFoundExceptionor "No input paths specified" even though the path exists. - The NameNode web UI or
hdfs dfsadmin -reportshows a rising count of under-replicated blocks. hdfs fsckreportsCORRUPTorMISSINGblocks under a directory.
Common causes and diagnostic signals
| Observed signal | Likely cause | First check |
|---|---|---|
Dead DataNode in dfsadmin -report | DataNode process stopped, host unreachable, or disk failure | hdfs dfsadmin -report |
| Under-replicated block count increases | Rack imbalance, network partition, safe mode, or insufficient disk space | Compare dfs.replication with live replica counts |
CORRUPT or MISSING in fsck | Disk failure, block scanner detection, or replica loss across nodes | hdfs fsck /path -files -blocks -locations |
| NameNode stays in safe mode | Minimum replication threshold not met after startup or mass DataNode loss | hdfs dfsadmin -safemode get |
Ordered checks
Confirm the NameNode's cluster view. Run on a gateway node or NameNode host with HDFS client configuration, typically as the
hdfsOS user:
Check that "Live datanodes" matches the expected cluster size and note any "Dead datanodes." Record the under-replicated block count. Risk: the report reflects the NameNode's last heartbeat view and can lag a few minutes.sudo -u hdfs hdfs dfsadmin -reportInspect a specific path. Run as a user with read access to the directory, usually
hdfs:
Replacesudo -u hdfs hdfs fsck /user/hive/warehouse -files -blocks -locations/user/hive/warehousewith the failing path. Look for lines containingCORRUPTorMISSING. Risk:fsckis read-only but can be slow on large directory trees; run it during a maintenance window if the tree is very large.Check DataNode logs. On each suspect DataNode, review logs under
$HADOOP_HOME/logsfor heartbeat timeouts, JVM errors, or "no space left on device" messages.Check NameNode logs. On the NameNode host, look for safe-mode messages, replication stalls, or block manager errors under
$HADOOP_HOME/logs.Compare configured vs. actual replication. Open
hdfs-site.xmland confirmdfs.replication, then compare it with the replication values shown indfsadmin -report.
Fixes tied to findings
Dead or unresponsive DataNode
Restart the DataNode process or the host. If a disk failed, replace it and restart the DataNode. Do not manually delete block pool files; this can cause permanent block loss and NameNode inconsistency.
Disk full on DataNode
Free non-block space or add storage, then restart the DataNode. The NameNode should resume scheduling replicas once the node reports capacity again.
Safe mode blocking replication
Run hdfs dfsadmin -safemode get. If safe mode is on because minimum replication is not met, wait for DataNodes to return and blocks to replicate. Only use hdfs dfsadmin -safemode leave after the minimum replication threshold is satisfied; forcing it off early exposes under-replicated blocks to clients.
Unhealthy DataNode that will not recover
Decommission it so the NameNode replicates its blocks elsewhere:
sudo -u hdfs hdfs dfsadmin -decommission :
Replace : with the DataNode hostname and IPC port. This changes cluster state. To reverse it before completion, use hdfs dfsadmin -recommission :.
Rebalance after repairs
Run hdfs balancer as the hdfs user during a maintenance window. The balancer moves blocks across the network and disk, so avoid peak hours.
Missing blocks with no live replicas
If fsck confirms missing blocks and no DataNode can recover them, restore from backup or snapshot. Erasure-coded directories may recover missing cells if enough parity blocks remain, but this depends on the erasure coding policy.
Escalation criteria
- Blocks remain missing after the affected DataNode recovers and restarts.
- Corruption or missing blocks span multiple racks, suggesting a network or rack-aware placement failure.
- The NameNode cannot exit safe mode because minimum replication cannot be reached.
fsckconfirms data loss that requires backup restoration.
Verify the repair
Run hdfs dfsadmin -report again and confirm live DataNode count matches cluster size and under-replicated blocks is trending to zero. Run hdfs fsck /path -files -blocks -locations on the previously failing path and confirm no CORRUPT or MISSING entries remain. Re-run the affected client job to confirm input paths resolve.
Limitations
- Command names and output formats can differ between Hadoop 2.x and 3.x distributions; confirm the installed version before automating
dfsadminorfsck. dfsadmin -reportshows the NameNode's view, which may lag recent DataNode heartbeats.- Running the balancer or block scanner during peak hours adds network and disk load.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.