Anatomy of a hard drive: what really goes on inside your PC's storage

The most valuable component inside your PC?

TODO alt text

Here's a thought: what's the most valuable component inside your PC? Valuable to you that is - not in terms of resale value.

PC kit doesn't really make for good family heirlooms, unless your grandfather bought an AdLib sound card in his final days and it was passed on to you.

But for most of us, the most valuable component is definitely the hard drive.

If a CPU blows up or a graphics card buys the farm, we can simply buy new ones. But if a hard drive says "goodbye cruel world", taking all of your vital files with it (and you don't have recent backups), well, no amount of money can fix that.

And yet, despite its importance, the humble hard drive doesn't get much attention.

We all have a tendency to focus on flashy things such as new distros and desktop environments, but there's a wealth of useful information to discover and learn about these devices.

For instance, there are many different strategies for splitting up the disk into different chunks (partitions), affecting security and performance. There are different types of filesystem you can use, and tricks you can employ to recover data if something goes wrong.

Anatomy of a Hard Drive

New technologies, such as SSDs, are changing the role of hard drives. If you've accidentally deleted a file, there's still a chance that you can recover it thanks to some cunning tools.

So far from being a boring box of bytes stuffed into a random space in your PC, the hard drive is actually a world of technology, with many options for customisation.

Our aim in this feature is to teach you everything that's worth knowing about hard drives - and a little bit more as well. We've also included a few bits you can cut out and stick on the wall next to your PC, in case you have an emergency.

Just to be on the safe side (for us and you!), a quick disclaimer: this guide covers making modifications to the structure of hard drive data. We absolutely recommend trying out commands and options for yourself, as it's the best way to learn, but only on a test machine (or in VirtualBox).

Don't experiment on your main PC, unless you want to risk losing data!

What are partitions?

A blank hard drive isn't much use to anybody; it needs some structure before it can start storing files. From a low-level perspective, drives are made up of sectors, which are very small units of data storage at fixed locations on the disk.

There can be many millions of sectors in a drive, and they are organised into meaningful groups at multiple levels. First off, at the foundation level, we have partitions (we'll look at filesystems later).

Essentially, a partition is a collection of sectors assigned to a specific storage task. Most brand new PCs ship with only Windows (sadly), so in their hard drives there is just a single, large partition that occupies almost the entire disk.

This appears as the C: drive when Windows boots up. Some machines have a second 'rescue' partition, containing a backup of the OS for when it needs to be reinstalled.

The purpose of partitions is to keep data areas separate from one another.

When you install Linux on a Windows PC, for instance, the Linux installer typically shrinks down the Windows partition to make room for Linux ones. At the end, you have a drive with multiple partitions, as in the diagram.

Windows knows it shouldn't mess around with unrelated Linux partitions, and vice-versa. The sizes of these partitions vary from system to system, depending on how much you allocate to each OS.