DEV Community

Al Ameen S
Al Ameen S

Posted on

HDD vs SSD: From Clicking Save to the Physics of Storing a Single Bit

Ever wondered what actually happens inside your computer when you click Save? Discover how HDDs use magnetism, how SSDs use electrical charge, and how both technologies preserve your data.

You write a few lines in a text editor, click Save, and close the application.

The next day, you open the file, and your text is still there.

But how did your computer preserve that information after the power was turned off?

The answer begins with digital data but ends with physics.

A Hard Disk Drive (HDD) stores information using magnetic patterns on rotating platters. A Solid-State Drive (SSD) stores information using electrical states in semiconductor memory cells.

Both devices perform the same fundamental job: storing data without requiring continuous power.

However, the physical mechanisms they use are very different.

To understand those differences, let's follow a file from the moment you click Save to the physical process that stores its data—and then retrieve it again.


1. What Happens When You Click Save?

Imagine creating a text file named notes.txt containing:

ABC
Enter fullscreen mode Exit fullscreen mode

Your computer represents these characters as bytes.

For example, using UTF-8 encoding:

  • A = 65 = 01000001
  • B = 66 = 01000010
  • C = 67 = 01000011

The computer does not need to understand the meaning of these characters to store them. It needs to preserve the encoded bytes and retrieve them later.

But how do these bytes reach the storage device?

From the Application to the Storage Device

When you click Save, several software and hardware components work together.

  1. Application: The text editor requests that the file be saved.
  2. Operating System: The operating system handles the file operation and coordinates access to storage.
  3. File System: The file system manages file names, directories, metadata, and the logical locations used to store file contents.
  4. Storage Driver and Interface: Storage commands and data are sent to the selected device.
  5. Storage Controller: The drive receives the request and manages the physical storage operation.

The operating system generally works with logical block addresses. Think of these as numbered locations that the storage device exposes to the computer.

The drive handles the details of locating those blocks on its physical storage medium.

This separation is important. The operating system does not need to know whether the storage device uses magnetism or electrical charge.

The same logical storage request can be handled by an HDD or an SSD.

Now let's look at what happens inside an HDD.


2. Inside an HDD: The Components

An HDD is a mechanical and electronic device. Its components work together to record and retrieve data from rotating magnetic surfaces.

Let's understand the major components.

  • Platters: Circular disks that hold recorded data.
  • Magnetic Coating: The recording layer where magnetic patterns are stored.
  • Spindle Motor: Rotates the platters at high speed.
  • Read/Write Head: Records magnetic patterns and detects them during reading.
  • Actuator Arm: Moves the heads to the required track.
  • Voice-Coil Actuator: Moves the actuator arm under electronic control.
  • Controller Board: Manages commands, positioning, data processing, and communication.
  • Cache, if present: Temporarily holds data to help manage storage operations.

The platter surface is organized into tracks and sectors.

A track is a circular recording path on the platter. A sector is a smaller addressable storage unit within a track.

The controller identifies the required location, positions the read/write head, and coordinates the platter's rotation.


3. The Physics of an HDD: How Magnetism Stores Data

To understand HDD storage, we first need to understand magnetism.

Certain materials can retain a magnetic state even after the external magnetic field that changed them is removed.

An HDD uses a magnetic recording layer containing extremely small regions. The drive records carefully controlled magnetic patterns in these regions.

At the logical level, computers represent information using bits: zeroes and ones.

The HDD's recording system encodes those bits into magnetic patterns that can later be detected and decoded.

An important detail: a real HDD does not simply use one universal rule such as "one magnetic direction means 1, and the opposite direction means 0."

It uses a recording code and carefully controlled magnetic transitions to represent information reliably.

How Does the Magnetic State Remain Stored?

When the write head creates a magnetic field, it changes the magnetic state of a tiny region on the platter.

Once the region has been written, its magnetic state can remain stable after the writing field is removed.

The drive does not need to continuously power the platter to preserve the recorded magnetic pattern.

This is why HDD storage is called non-volatile storage.

As engineers increase recording density, maintaining stable and distinguishable magnetic patterns becomes more challenging.

Some advanced HDDs use Heat-Assisted Magnetic Recording (HAMR). This technique briefly heats a tiny region during writing, making it easier to change its magnetic state and enabling higher recording densities.

How an HDD Writes Data

Now let's follow the physical process when a file is saved to an HDD.

  1. Receive the Request: The controller receives the target logical address and data.
  2. Move the Head: The actuator positions the read/write head over the appropriate track.
  3. Wait for the Correct Location: The platter rotates until the target sector reaches the head.
  4. Create a Magnetic Field: Electrical current in the write element produces a controlled magnetic field.
  5. Change the Recording Material: The field changes the magnetic pattern in the target region.
  6. Complete the Operation: The drive handles the required checks and reports completion.

The physics connection is straightforward.

An electric current produces a magnetic field. That field changes the magnetic state of the recording material.

The drive converts electrical control into a persistent magnetic pattern.

How an HDD Reads Data

Reading data follows the reverse data path.

  1. The computer requests data.
  2. The controller identifies the internal location.
  3. The actuator moves the head to the required track.
  4. The platter rotates the target sector beneath the head.
  5. The read element detects the magnetic signal.
  6. The drive's electronics decode the signal and correct certain errors.
  7. The controller returns the data to the computer.

Modern HDDs use highly sensitive read sensors.

Changes in the magnetic field affect the sensor's electrical behavior, allowing the drive to detect very small recorded signals.

The electronics then convert the detected signal into digital information.

Notice the important difference: the read head senses the existing magnetic pattern. It does not need to rewrite the stored data.

Now that we understand magnetic storage, let's explore the technology that uses electrical charge instead.


4. Inside an SSD: The Components

Unlike an HDD, an SSD has no spinning platters or moving read/write heads.

Instead, it uses NAND flash memory and an electronic controller to store and retrieve data.

Let's look at the major components.

  • NAND Flash Chips: Store data even when power is turned off. Each chip contains a large number of memory cells.
  • Memory Cells: Store electrical states representing encoded information.
  • SSD Controller: Coordinates read and write operations, error correction, and internal maintenance.
  • Flash Translation Layer (FTL): Maps logical addresses received from the operating system to physical locations inside NAND flash memory.
  • Error-Correction System: Detects and corrects certain data errors to help maintain data integrity.
  • DRAM, if present: Temporarily stores mapping information and data to help manage storage operations.
  • Firmware: Controls the SSD's internal operations, including address mapping and memory management.
  • Host Interface: Connects the SSD to the computer through an interface such as SATA or PCIe/NVMe.

Among these components, the controller plays a particularly important role.

NAND flash memory has specific rules for writing, erasing, and reusing data. The controller manages these operations and ensures that the SSD can work efficiently.

To understand how an SSD physically stores information, we need to look inside a NAND flash memory cell.


5. The Physics of an SSD: How Electrical Charge Stores Data

An SSD stores information using NAND flash memory, a type of non-volatile semiconductor memory.

At the heart of NAND flash is a special semiconductor transistor.

A transistor is an electronic component that controls the flow of electrical current.

Many NAND flash designs use either a floating-gate or a charge-trap structure to store electrical charge.

The stored charge changes how the transistor responds to an applied control voltage.

More specifically, it changes the voltage required to make the transistor conduct.

This is known as the threshold voltage.

The SSD controller can measure the electrical response of a memory cell and determine which encoded state it represents.

How Can Charge Remain After Power Is Removed?

The charge-storage structure is separated from other parts of the cell by insulating material.

This insulation helps keep the stored electrical charge inside the memory cell, even when the computer is turned off.

When power is restored, the sensing circuitry can measure the cell's electrical behavior and determine the stored state.

Unlike ordinary RAM, NAND flash does not need continuous power to preserve its information.

This is why NAND flash is called non-volatile memory.

How Can One Memory Cell Store Several Bits?

A NAND flash cell can represent more than two electrical states.

By using multiple distinguishable threshold-voltage levels, a single cell can store multiple bits of information.

Different NAND technologies use different numbers of bits per cell.

SLC (Single-Level Cell)

  • Stores 1 bit per cell.
  • Represents 2 possible states.

MLC (Multi-Level Cell)

  • Stores 2 bits per cell.
  • Represents 4 possible states.

TLC (Triple-Level Cell)

  • Stores 3 bits per cell.
  • Represents 8 possible states.

QLC (Quad-Level Cell)

  • Stores 4 bits per cell.
  • Represents 16 possible states.

Storing more bits in each cell increases the amount of data that can fit into the same physical area.

However, as the number of states increases, the voltage levels become harder to distinguish reliably.

This creates trade-offs involving performance, endurance, and cost.


6. How an SSD Writes Data

Now that we understand how a flash memory cell stores information, let's follow the process of writing data to an SSD.

  1. Receive the Request: The SSD receives the logical address and data from the computer.
  2. Find Suitable Space: The controller selects available physical space in NAND flash memory.
  3. Apply Programming Voltages: The memory circuitry applies controlled electrical voltages to change the charge stored in the cells.
  4. Set the Required States: The cells are programmed to represent the encoded data.
  5. Check and Protect the Data: The controller verifies the programmed states and uses error-correction mechanisms to help protect the data.
  6. Update the Address Mapping: The Flash Translation Layer (FTL) records the new physical location associated with the logical address.
  7. Complete the Operation: The controller reports completion according to the SSD's caching and persistence behavior.

At the physical level, programming NAND flash can involve effects such as quantum tunneling or hot-electron injection, depending on the memory design.

Quantum tunneling allows particles to pass through a very thin energy barrier under suitable conditions.

Flash memory uses carefully engineered electric fields and insulating layers to control the movement of electrical charge.

The result is a change in the electrical state of the memory cell.


7. Why Does an SSD Need Pages and Blocks?

NAND flash memory is organized into two important structures: pages and erase blocks.

  • Page: A unit used for reading and programming data.
  • Erase Block: A group of multiple pages that must be erased together.

This organization creates an important limitation.

A programmed page generally cannot be freely overwritten in place.

When existing data needs to be changed, the SSD often writes the updated data to another available page and changes the address mapping.

The old page is then marked as invalid when it is no longer needed.

But what happens to all those invalid pages?

Garbage Collection

The SSD controller uses a process called garbage collection to reclaim storage space.

If an erase block contains both valid and invalid pages, the controller must first preserve the valid data.

It can then erase the entire block and make the space available for new writes.

Wear Leveling

The controller also uses wear leveling to distribute write and erase operations across the flash memory.

This helps prevent certain memory areas from wearing out much faster than others.

TRIM

Another important feature is TRIM.

When the operating system deletes a file or releases storage space, it can send TRIM information to a compatible SSD.

This informs the controller that certain logical blocks no longer contain data that needs to be preserved.

The controller can use this information to manage available storage space more efficiently.


8. How an SSD Reads Data

Reading data from an SSD is different from writing it.

Instead of changing the electrical state of the memory cells, the SSD senses their existing states.

The process works as follows:

  1. The computer requests a logical block of data.
  2. The controller consults the Flash Translation Layer (FTL) to locate the corresponding physical flash location.
  3. The memory circuitry selects the required NAND location.
  4. The sensing circuitry measures the electrical responses of the memory cells.
  5. The controller interprets the stored states and applies error-correction mechanisms.
  6. The requested data is returned to the computer.

The important point is that reading does not require rewriting the stored data.

The SSD senses the existing electrical states, decodes them, and converts them back into digital information.

No storage head needs to move, and no platter needs to rotate.

The SSD still has processing and memory-access delays, but it avoids the mechanical waiting associated with an HDD.


9. Why SSDs Often Feel Much Faster

Imagine opening an application on your computer.

The application may need to load hundreds of small files from different storage locations.

These files could include application resources, configuration files, libraries, and other required data.

An HDD may repeatedly move its read head and wait for the platter to rotate to the correct position before accessing each location.

An SSD works differently.

It accesses NAND flash locations electronically, without mechanical head movement or rotational waiting.

Depending on the drive's design and workload, it can also use multiple NAND channels and memory dies to perform operations in parallel.

This is why SSDs generally perform much better for random reads and often make computers feel more responsive.

Three Important Storage Performance Terms

1. Latency

Latency is the time taken to complete an individual storage operation.

Lower latency means the computer spends less time waiting for a response from the storage device.

2. Throughput

Throughput describes how much data a storage device can transfer within a given period.

It is commonly measured in MB/s or GB/s.

3. IOPS (Input/Output Operations Per Second)

IOPS measures how many individual read or write operations a storage device can complete per second.

It is particularly useful when evaluating workloads involving many small storage requests.

Sequential Access vs. Random Access

There is an important difference between reading one large file and reading thousands of small files scattered across a storage device.

Sequential Access: Data is read or written in a continuous sequence. HDDs can perform reasonably well in this type of workload because the head can remain near the required recording area.

Random Access: Data is requested from different storage locations. HDDs must repeatedly reposition their heads and wait for the required sectors to rotate underneath them.

SSDs avoid these mechanical delays because they access flash memory electronically.

This is one of the main reasons SSDs offer a significant advantage in everyday computing tasks.

Are All SSDs Equally Fast?

No. Different SSDs can have very different performance characteristics.

For example:

  • SATA SSDs: Use the SATA interface, which has lower bandwidth than modern PCIe interfaces.
  • NVMe SSDs: Use the NVMe protocol over PCIe, allowing much higher data-transfer performance.

However, the interface is not the only factor that determines speed.

The SSD controller, NAND flash type, number of memory channels, capacity, firmware, and workload can all influence actual performance.

An SSD's advertised maximum speed does not necessarily represent its performance in every real-world situation.

The type of workload matters just as much as the storage technology itself.


10. HDD vs SSD: The Key Differences

HDDs and SSDs serve the same purpose: storing data even when the computer is turned off.

However, they use different physical mechanisms to store and retrieve information.

1. Physical Storage

HDD: Stores data as magnetic patterns on rotating platters.

SSD: Stores data as electrical states in NAND flash memory.

2. Moving Parts

HDD: Contains spinning platters and moving read/write heads.

SSD: Has no moving storage parts.

3. Writing Data

HDD: Uses a magnetic field to change patterns on the recording surface.

SSD: Uses controlled electrical conditions to program flash memory cells.

4. Reading Data

HDD: Detects magnetic signals from the platter and converts them into digital data.

SSD: Senses the electrical behavior of flash cells to recover the stored data.

5. Access Speed

HDD: Must move its head and wait for the platter to rotate to the required location.

SSD: Accesses flash memory electronically, avoiding mechanical seeking and rotational delays.

6. Noise

HDD: May produce audible noise from its motor and moving components.

SSD: Operates silently during normal storage activity.

7. Shock Resistance

HDD: More vulnerable to physical shock, especially while operating.

SSD: Generally more resistant to physical shock because it has no moving storage parts.

8. Cost per Gigabyte

HDD: Usually costs less per gigabyte, making it suitable for large storage requirements.

SSD: Usually costs more per gigabyte, although prices vary by capacity and model.

9. Endurance and Failure

HDD: Can fail because of mechanical wear, head or motor problems, and electronic faults.

SSD: Flash cells have finite write endurance, and the controller or other electronic components can also fail.

Neither technology is guaranteed to last forever.

Actual reliability depends on the device, workload, operating conditions, and usage.


11. Which Storage Technology Should You Choose?

The choice between an HDD and an SSD depends on what you need from your computer.

Choose an SSD When:

  • You want faster operating system startup.
  • You frequently open applications and development tools.
  • You work with many small files.
  • You need better random-access performance.
  • You prefer silent operation and better resistance to physical shock.

Choose an HDD When:

  • You need large storage capacity at a lower cost per gigabyte.
  • You store large media collections.
  • You maintain archives and backups.
  • Maximum access speed is less important than storage capacity and cost.

Why Not Use Both?

You do not always need to choose one technology over the other.

A practical setup can use both:

  • SSD: Operating system, applications, development tools, and active projects.
  • HDD: Large media collections, archives, and additional storage.

This combines the responsiveness of an SSD with the economical capacity of an HDD.

Regardless of which storage technology you choose, always maintain separate backups of important data.

No storage device is a substitute for a backup.


Conclusion: Same Data, Different Physics

When you click Save, your computer turns an application-level request into storage commands.

The operating system organizes the file, and the storage device converts those commands into physical operations.

An HDD uses electrical current to create magnetic fields that change a recording surface. A read sensor detects the resulting magnetic patterns and converts them back into digital data.

An SSD uses controlled electrical conditions to change the charge stored in semiconductor cells.

Its controller maps logical addresses to physical locations, reads the cells' electrical states, corrects errors, and manages the special rules of NAND flash memory.

Both devices preserve information without continuous power, but they achieve this through different physical mechanisms.

An HDD stores data magnetically. An SSD stores data through electrical states in flash memory.

Understanding that distinction explains their internal components, their performance differences, and why both technologies continue to serve different storage needs.


Further Reading

For readers who want to explore storage technology in more detail:

Technical note: The diagrams in this article are simplified explanatory models. Actual HDD recording codes, read-head designs, NAND cell structures, controller algorithms, caching behavior, and durability characteristics vary by device and generation.

Top comments (0)