Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

What Is a Disk Cache? How It Works

· 7 min read · Home Tech

In this article
  1. Background: Why Disk Caching Exists
  2. How a Disk Cache Works
  3. Hardware vs. Software Disk Cache
  4. Choosing a Drive with the Right Cache
  5. Common Problems and Misconceptions
  6. How to Clear or Adjust the Disk Cache
  7. Alternatives and Related Technologies
  8. Frequently Asked Questions

A disk cache is a small amount of fast memory (usually RAM or flash) that stores recently read or written data from a hard drive or SSD, so the next time that data is needed it can be served without waiting for the slower disk. In short: it speeds up storage by keeping frequently used data close at hand. Disk caches exist in two main places: inside the drive itself (a hardware cache) and in the operating system (a software cache). Both work on the same principle but are managed differently.

Background: Why Disk Caching Exists

Storage drives are far slower than the rest of a computer. A typical hard drive has a mechanical arm that must physically move to read data, which takes milliseconds; an SSD is faster but still slower than RAM. The CPU and RAM can process data in nanoseconds, so every time the system has to wait for the disk, it wastes time. Disk caching was invented to bridge this speed gap. By storing copies of frequently accessed data in faster memory, the system can avoid the slow disk read altogether.

The concept dates back to the early days of computing, when mainframe systems used small amounts of high-speed memory to hold frequently used disk blocks. Modern operating systems, like Windows, macOS, and Linux, all include a software disk cache as part of their file system management. Hard drives and SSDs also have their own small hardware cache (often 8MB to 256MB on consumer drives) that works independently of the OS.

How a Disk Cache Works

When you open a file, the operating system first checks its cache. If the data is there (a cache hit), it returns it immediately. If not (a cache miss), it reads from the disk, stores a copy in cache, and returns it. The same happens on writes: data is written to cache first and then lazily flushed to disk, which lets the system report the write as complete before it actually hits the storage medium.

The cache is managed by an algorithm that decides what to keep and what to evict. The most common is LRU (Least Recently Used): the least recently used data is discarded when the cache is full. Other algorithms include LFU (Least Frequently Used) and adaptive replacements. The size of the cache is dynamic in software – the OS uses free RAM as cache, shrinking it when applications need memory.

For example, when you boot a computer, the OS loads frequently used system files into cache. On subsequent boots, those files are read from cache, which is why a second boot is often faster than the first. Similarly, a database server that repeatedly queries the same rows benefits from caching those rows in memory.

Hardware vs. Software Disk Cache

There are two distinct layers of disk caching:

  • Hardware cache (drive buffer): A small amount of RAM on the drive itself. It stores data that the drive has recently read or is about to write. On a hard drive, it helps smooth out the mechanical delays; on an SSD, it helps with write bursts and wear leveling. You cannot change its size – it is fixed at the factory.
  • Software cache (OS page cache): The operating system uses a portion of system RAM to cache disk data. This is much larger than the hardware cache (often hundreds of megabytes to several gigabytes). It is managed automatically and requires no user configuration. On Windows it is called the “system cache”; on Linux it is the “page cache”.

Both work together: the OS cache is checked first, then the drive’s hardware cache, then the actual disk medium.

Choosing a Drive with the Right Cache

When buying a hard drive or SSD, you will see cache size listed in the specifications. For hard drives, a larger cache (64MB or more) generally improves performance, especially for random reads and writes. For SSDs, the cache size matters less because the NAND flash itself is fast; however, some SSDs use a portion of the drive as a pseudo-SLC cache to boost write speeds temporarily. That is not the same as the DRAM cache on the drive’s controller.

For most users, the OS software cache is far more impactful than the drive’s hardware cache. So when choosing a drive, focus on the type (HDD vs. SSD), interface (SATA vs. NVMe), and reliability, rather than obsessing over the cache size. A drive with a small cache can still perform well if the OS cache is large and the workload is not extremely random.

Common Problems and Misconceptions

One common misconception is that clearing the disk cache will speed up your computer. In reality, the cache is there to speed things up; clearing it forces the system to re-read from the disk, making things slower temporarily. Windows’ “Disk Cleanup” does not clear the system cache – it removes temporary files, which is different.

Another issue is data loss on sudden power failure. Because writes are cached in RAM and flushed later, a power cut can lose data that the system thought was saved. To mitigate this, many systems use a write-back cache with a battery backup or a write-through cache that writes directly to disk. On consumer drives, the write cache is usually enabled by default; disabling it in the drive’s properties (Device Manager > Disk Drives > Policies) can reduce the risk but also reduces performance.

If you notice slow performance, the problem is often not the cache but insufficient RAM. When the OS cache uses too much memory, it can cause “thrashing” – constantly swapping data between RAM and disk. Adding more RAM is the best fix.

How to Clear or Adjust the Disk Cache

You generally do not need to manually clear the disk cache. The OS manages it automatically. However, if you want to free up RAM that is being used for cache, you can:

  1. Restart the computer – this clears the cache.
  2. Close memory-hogging applications – the OS will automatically shrink the cache to give memory to apps.
  3. On Windows, you can use the built-in “Empty Standby List” tool (requires admin) to force-clear the cache, but this is not recommended for normal use.

To disable the write cache on a drive (for safety reasons, such as using an external drive that you unplug without “ejecting”):

  1. Open Device Manager (right-click Start > Device Manager).
  2. Expand “Disk drives”, right-click your drive, and select Properties.
  3. Go to the “Policies” tab.
  4. Uncheck “Enable write caching on the device” and click OK.

Note: This can reduce performance, so only do it if you are having data corruption issues or you frequently unplug external drives without using the “Safely Remove Hardware” option.

Disk cache is not the only way to speed up storage. Alternatives include:

  • RAM disk: A portion of RAM is treated as a disk drive. It is extremely fast but volatile – data is lost when power is off.
  • SSD caching (e.g., Intel Optane, Apple Fusion Drive): A small SSD is used as a cache for a larger HDD. This gives the speed of an SSD for frequently used data while keeping the capacity of an HDD.
  • NVMe over TCP: For network storage, caching can be done on the client side to reduce latency.
  • File system journaling: Not a cache, but related – it logs changes to prevent corruption after a crash.

For most home users, simply using an SSD as the main drive is a better solution than relying on caching. SSDs are fast enough that the cache has less impact, and they have no moving parts, so they are more reliable.

Frequently Asked Questions

Is a bigger disk cache always better?

Not necessarily. A larger cache helps up to a point, but once the cache covers the working set of your typical workload, adding more does little. For hard drives, 64MB is usually enough; for SSDs, the cache size is less important than the controller and NAND type.

Does clearing the disk cache speed up my computer?

No. Clearing the cache removes the data that would make future reads faster. It can temporarily slow down your system until the cache is rebuilt. If you are low on memory, the OS will automatically shrink the cache.

Can I see how much disk cache is in use?

Yes. On Windows, open Task Manager (Ctrl+Shift+Esc) and go to the Performance tab. Under “Memory”, you will see “Cached” which is the amount of RAM used for the system cache. On Linux, use the free -h command to see the “buff/cache” column.

Does a disk cache wear out an SSD?

No, the cache itself does not cause wear. However, the write amplification from caching can slightly increase the number of writes to the SSD, but modern SSDs have wear leveling and a long lifespan, so this is not a practical concern for typical use.

Why does my external drive lose data if I unplug it without ejecting?

That is because the OS uses a write-back cache: it tells you the file is saved, but the data is still in RAM waiting to be written to the drive. When you unplug, that data is lost. Always use “Safely Remove Hardware” to flush the cache.