BigData

How Hadoop Distributed File System Works

Irfan Sharief August 21, 2025 BigData
How Hadoop Distributed File System Works

Quick Summary

The Hadoop Distributed File System (HDFS) powers enterprise big data storage by breaking massive datasets into uniform 128 MB blocks and distributing them across server clusters. By pairing a central NameNode for metadata management with worker DataNodes for physical storage, HDFS provides continuous high-throughput data access tailored for heavy batch processing. Through automated rack-aware block replication and smart data locality, the system protects against hardware failures while eliminating network bottlenecks. Mastering these core architectural concepts enables technology professionals to build, manage, and scale highly resilient data infrastructure with confidence.

Introduction

Understanding how the Hadoop Distributed File System works is essential for any enterprise seeking to store and process massive datasets efficiently across distributed environments. The Hadoop Distributed File System (HDFS) works by breaking large files into smaller blocks, distributing replicated copies across a cluster of commodity DataNodes, and using a central NameNode to manage metadata, directory hierarchies, and block locations, delivering continuous high-throughput access and enterprise fault tolerance.

In this article, you will discover:

  • How the Hadoop Distributed File System breaks down and stores large enterprise datasets.
  • The master-slave architecture connecting the NameNode, DataNodes, and Secondary NameNode.
  • Data block partitioning, default block sizes, and rack awareness replication policies.
  • Fundamental engineering design principles driving HDFS throughput and resilience.
  • Step-by-step write and read operational flows between clients and cluster nodes.
  • Heartbeat mechanisms, block reporting, and automated self-healing procedures.
  • How data locality optimizes computational throughput alongside MapReduce and YARN.
  • A feature-by-feature comparison between HDFS and traditional file systems.
  • Essential HDFS CLI commands and practical system limitations.

How Does the Hadoop Distributed File System Work?

The Hadoop Distributed File System (HDFS) is designed to store multi-terabyte and petabyte-scale files reliably across clusters of commodity hardware. When a file is uploaded into HDFS, the system automatically splits the file into fixed-size blocks and distributes them across multiple storage nodes. The central NameNode manages all namespace metadata and tracks block locations, while worker DataNodes handle physical block storage, reading, and writing. Through automated data replication and rack-aware placement, HDFS ensures continuous data availability even during hardware and node outages.


HDFS Architecture: How NameNode and DataNodes Work Together

The operational structure of the Hadoop Distributed File System follows a master-slave architecture. This separation isolates metadata coordination from physical data storage, enabling rapid scaling across thousands of commercial servers.

The NameNode: The System Conductor

The cluster's master server is the NameNode. Its job is to manage the file system namespace—including the directory hierarchy, file ownership, permissions, and file-to-block mappings. The NameNode stores this critical metadata in memory for rapid lookups. Because the NameNode is the central point of coordination, all client operations such as opening, closing, and renaming files are directed through it. It also directs block replication and balances storage distribution across the cluster.

The DataNodes: The Data Repositories

DataNodes are slave nodes deployed across every worker machine in the cluster. They are primarily tasked with storing and retrieving physical data blocks. They execute read and write requests directly from clients based on instructions from the NameNode. DataNodes continuously communicate their status back to the NameNode to verify data integrity and hardware availability.

Secondary NameNode and Metadata Management

The Secondary NameNode is not a standby backup NameNode, but a helper service. It periodically merges the NameNode's memory state image (FsImage) with the edit log transaction file (EditLog). This process prevents the EditLog from growing excessively large, ensuring faster NameNode restarts and maintaining fresh metadata checkpoints.

Architecture Component Role / Designation Primary Responsibilities Storage Location
NameNode Master Node Manages namespace, directory tree, permissions, and block mapping locations. System Memory (RAM) & Disk (FsImage/EditLog)
DataNode Slave Node Stores physical data blocks, serves read/write requests, runs block reports. Local Host Hard Drives (Disk Storage)
Secondary NameNode Helper Service Checkpoints FsImage and EditLog to clean metadata transaction logs. Dedicated Machine / Separate Host Disk

How HDFS Stores Data: Blocks and Replication

HDFS abstracts physical hardware by dividing unstructured files into unified chunks known as blocks. These blocks are distributed across independent storage hosts to maximize parallel processing capabilities.

HDFS Block Size Configuration

The hadoop distributed file system default block size is 128 MB in common Hadoop 2.x and 3.x configurations (compared to 64 MB in legacy Hadoop 1.x environments). Administrators can configure block sizes per file or across the cluster via the dfs.blocksize parameter. Large block sizes minimize NameNode memory consumption by reducing metadata overhead and maximizing sequential disk transfer rates during batch analysis.

Replication Factor and Rack Awareness

To guard against data loss, the default replication factor in HDFS is set to 3 (configurable via dfs.replication). Rack awareness governs replica placement: HDFS places the first block on a local DataNode, the second on a node in a remote rack, and the third on a different DataNode within that same remote rack. This strategy protects against full rack failure while optimizing network bandwidth utilization during cross-rack reads.


Design Principles Behind How HDFS Works

The design of HDFS differs significantly from standard storage platforms, focusing on fault resilience and massive throughput for batch processing:

  • Failure is the Rule: With thousands of nodes in a cluster, hardware failure is expected. HDFS automatically detects host failures and recovers data without operator intervention.
  • High Throughput Over Low Latency: Optimized for batch processing sequential streaming reads rather than sub-second random access lookups.
  • Sequential Access is Ideal: Engineered to read continuous streams of massive datasets at high speeds.
  • Shift Computation to Data: Executing code on the server hosting the physical data eliminates network congestion caused by moving terabytes of raw files over switches.

HDFS Write Operation

The write operation flow in HDFS ensures data is streamed securely across replicated nodes before completing transactions:

  1. Write Request: The client sends a file creation request to the NameNode.
  2. Metadata Verification & Allocation: The NameNode verifies permissions, checks for duplicate file names, and returns a list of target DataNodes for block storage.
  3. Pipeline Streaming: The client writes data blocks directly to the first DataNode, which streams data to the second DataNode, propagating through the replication pipeline to the third DataNode.
  4. Acknowledgement: Once all replicas write successfully to disk, acknowledgement packets travel back up the pipeline to the client, confirming a successful write operation.

HDFS Read Operation

Reading data from HDFS prioritizes speed and topological network proximity to achieve high performance:

  1. Location Request: The client sends a request to the NameNode containing the target file path.
  2. Metadata Retrieval: The NameNode returns the locations of the DataNodes holding replicas for each block, sorted by proximity to the client.
  3. Direct Node Streaming: The client connects directly to the closest DataNode holding the requested block to stream data.
  4. Sequential Reconstruction: The client reads all remaining blocks in sequence from appropriate DataNodes and reconstructs the complete file stream.

Heartbeat and Block Report

NameNodes maintain active oversight of cluster health through periodic signals sent by worker nodes:

  • Heartbeats: DataNodes send heartbeats (default every 3 seconds) to signal operational health. If a DataNode fails to send a heartbeat within 10 minutes, the NameNode marks it as dead.
  • Block Reports: Every 6 hours, DataNodes transmit a complete report listing all physical blocks stored on their local disks to synchronize the NameNode's memory mapping.
  • Automated Re-replication: When a DataNode is marked unresponsive, the NameNode identifies all affected blocks and automatically re-replicates them onto healthy DataNodes to maintain the target replication factor.

How HDFS Replication Provides Fault Tolerance

Fault tolerance in HDFS relies on continuous software-driven monitoring rather than high-cost hardware redundancies like RAID arrays. By storing multiple identical block copies across distinct machines and physical racks, HDFS guarantees uninterrupted service during host crashes, network partitioning, or total rack outages. If data corruption is detected via checksum verifications during a read operation, the client automatically requests an uncorrupted block copy from another replica node while the system repairs the damaged file segment seamlessly in the background.


How Data Locality Works in HDFS

Data locality minimizes network overhead by processing data directly on the server where it resides. When a processing job is scheduled, the execution framework queries the NameNode for target block locations. The task scheduling engine assigns execution tasks using three priority levels:

  • Node-Local: Tasks run on the exact DataNode holding the target data block (highest speed, zero network latency).
  • Rack-Local: If local compute capacity is saturated, tasks run on a node inside the same physical rack (low network latency).
  • Off-Rack: If the local rack is unavailable, tasks execute on a node in a different rack, transferring data across main switches (highest network overhead).

HDFS vs Traditional File Systems

To understand why enterprise organizations adopt distributed file storage, it helps to compare HDFS against conventional storage systems:

Feature Hadoop Distributed File System (HDFS) Traditional File Systems (POSIX / NTFS)
Hardware Base Clusters of low-cost commodity servers. Single high-end server or SAN/NAS array.
Data Volume Scale Petabytes to Exabytes; optimized for huge files. Gigabytes to Terabytes; optimized for small files.
Data Access Pattern High-throughput streaming reads (Write once, Read many). Low-latency random reads and in-place writes.
Redundancy Model Software-based cross-node/cross-rack block replication. Hardware RAID controllers and mirroring.

How HDFS Works with MapReduce and YARN

HDFS provides the resilient storage foundation within the Hadoop ecosystem, operating in tandem with compute frameworks. While HDFS manages storage, YARN (Yet Another Resource Negotiator) manages cluster resources and schedules execution tasks across nodes. MapReduce executes distributed computation by dividing work into Map and Reduce stages. YARN leverages HDFS block location metadata to schedule Map tasks directly on the DataNodes hosting target blocks, completing processing workflows without unnecessary network data transfers.

Professionals looking to build operational big data skills can advance their expertise through specialized training programs like the Big Data and Hadoop Certification and Hadoop Administrator Certification.


Basic HDFS Commands

Hadoop administrators and developers interact with HDFS using Command Line Interface (CLI) operations syntax. Below are essential HDFS commands:

Command Syntax Purpose / Description
hdfs dfs -ls /path Lists files and directory contents stored in HDFS.
hdfs dfs -mkdir /path Creates a new directory inside HDFS.
hdfs dfs -put localfile /path Uploads a file from local storage into HDFS.
hdfs dfs -get /path/file localfile Downloads a file from HDFS to local storage.
hdfs dfs -rm /path/file Removes a specific file from HDFS storage.
hdfs dfs -du -h /path Displays disk space usage for directories in human-readable format.
hdfs dfs -cat /path/file Prints file contents directly to standard console output.

Limitations of HDFS

Despite its architectural strengths, HDFS exhibits specific limitations in modern computing setups:

  • Small Files Problem: Every file, directory, and block metadata entry in HDFS consumes approximately 150 bytes of RAM on the NameNode. Storing millions of small files overwhelms memory capacity.
  • High Latency Access: HDFS is optimized for high-throughput batch execution rather than sub-second, low-latency queries.
  • No Random In-place Writes: HDFS supports a "write-once, read-many" access pattern. Arbitrary modifications or in-place edits to existing file contents are not supported.

Conclusion

Understanding how the Hadoop Distributed File System works provides the architectural foundation necessary for managing modern big data infrastructure. By decoupling metadata coordination from physical block storage, implementing rack-aware software replication, and leveraging data locality, HDFS delivers scalable, fault-tolerant analytics. Expand your technical skillset and master enterprise big data execution with iCertGlobal's industry-aligned Big Data and Hadoop Certification program.

Frequently Asked Questions

What is the role of a block in the Hadoop Distributed File System? ▾
A block is the smallest unit of data that HDFS stores. Unlike conventional file systems, HDFS blocks are large (typically 128 MB), which helps reduce the number of metadata entries the NameNode must manage and optimizes for large, sequential file reads.
How is data written to HDFS? ▾
When a client wants to write a file, it first communicates with the NameNode to get permission and a list of DataNodes to write to. The client then streams the data to the first DataNode, which in turn streams the data to the second, and so on, creating a pipeline for data replication.
Is the Hadoop Distributed File System suitable for all types of data? ▾
No, HDFS is specifically designed for batch processing of large, static datasets. It is not suitable for scenarios that require frequent, random updates to files or for storing a large number of small files, as this can overload the NameNode.
Can I access HDFS from outside the Hadoop cluster? ▾
Yes, HDFS provides a file system shell and a web interface for basic file management. It also offers a Java API and other client libraries that allow external applications to interact with the file system for read and write operations.
How does HDFS work? ▾
HDFS works by splitting large files into blocks and distributing them across multiple machines in a Hadoop cluster. The NameNode manages file metadata and block locations, while DataNodes store the actual data. Replication improves fault tolerance, allowing the system to remain available when individual nodes fail.
How does HDFS read and write data? ▾
HDFS reads and writes data through coordination between clients, the NameNode, and DataNodes. For reads, the client obtains block locations from the NameNode and retrieves data directly from suitable DataNodes. For writes, the NameNode allocates blocks, and DataNodes store and replicate the data through a pipeline.
What is the default block size in HDFS? ▾
The default HDFS block size is typically 128 MB in modern Hadoop configurations. However, administrators can change this setting, and individual files can use different block sizes. Larger blocks help reduce metadata overhead and support efficient sequential reading of large datasets.
What is the default replication factor in HDFS? ▾
The default HDFS replication factor is 3, meaning each data block is generally stored as three copies across DataNodes. This improves fault tolerance because data remains available if a node fails. Administrators or applications can configure a different replication factor based on storage capacity and reliability requirements.
What is the role of the NameNode and DataNode? ▾
The NameNode manages HDFS metadata, including file names, directory structures, permissions, and block locations. DataNodes store the actual data blocks and handle read and write requests. They also report their status to the NameNode, which coordinates replication and responds to node failures to maintain data availability.
What is the role of the NameNode and DataNode? ▾
The NameNode manages HDFS metadata, including file names, directory structures, permissions, and block locations. DataNodes store the actual data blocks and handle read and write requests. They also report their status to the NameNode, which coordinates replication and responds to node failures to maintain data availability.
iCert Global Author
Irfan Sharief

Irfan Sharief is the CEO and founder of iCert Global, an edtech leader delivering industry-recognized certification training in PMP, PRINCE2, ITIL, Lean Six Sigma, Agile/Scrum, and CEH across global markets. His learner-first approach—focused on affordability, outcomes, and strong post-training support—has helped thousands of professionals upskill with confidence. Based in Bengaluru and an alumnus of Brindavan College, Irfan writes about the certification economy, career pivots, and practical playbooks for workforce advancement.

Write a Comment

Your email address will not be published. Required fields are marked (*)


Still have questions? Schedule a free counselling session

Our experts are ready to help you with any questions about courses, admissions, or career paths. Get personalized guidance from industry professionals.

Book Free Session

Book Free Session