Storage
Where data stays when the power is off: hard drives, solid-state drives, SATA and NVMe, M.2, flash media, and how capacity is counted.
Storage versus memory
A storage device keeps data when the power is off: the operating system, applications, documents and photos. That property is called non-volatile. Random access memory (RAM), described on the Memory page, is volatile: it is much faster, but it forgets everything when the computer shuts down.
The two work together. When you open a program, the processor loads it from storage into RAM and works on it there; when you save a file, it is written back to storage. That is why users mix the words up ("my computer has 512 GB of memory" usually means storage), and why a technician asks which one they mean. A slow drive makes everything that loads from it slow: booting, opening programs, searching files.
Hard disk drives
A hard disk drive (HDD) stores data magnetically on one or more rigid disks called platters, which spin on a central spindle. A read/write head for each platter surface sits on an actuator arm that swings across the platter. The head floats on a thin cushion of air (or helium, in many large drives) a few nanometers above the surface, and never touches it during normal operation. Data is laid out in concentric tracks, divided into sectors.
Spindle speed and seek time
Every random read costs two mechanical delays. The seek time is how long the arm needs to move to the right track, typically several milliseconds. Then the drive waits for the sector to come around: the rotational latency, on average half a revolution. That second delay depends only on the spindle speed in revolutions per minute (RPM):
for rpm in (5400, 7200, 10_000, 15_000):
turn_ms = 60_000 / rpm # one full revolution, in milliseconds
average_ms = turn_ms / 2 # on average the sector is half a turn away
print(f"{rpm:>6} RPM one turn {turn_ms:5.2f} ms average wait {average_ms:.2f} ms")
5400 RPM one turn 11.11 ms average wait 5.56 ms 7200 RPM one turn 8.33 ms average wait 4.17 ms 10000 RPM one turn 6.00 ms average wait 3.00 ms 15000 RPM one turn 4.00 ms average wait 2.00 ms
Add a seek and a random read takes roughly 5 to 15 ms on a hard drive, against well under a millisecond on a solid-state drive. A drive can therefore do only on the order of a hundred random operations per second. Sequential transfers, where the head stays on neighboring tracks, are much better: a modern 7200 RPM drive typically reads 150–280 MB/s, highest on large, recent drives and on the outer tracks.
- 5400 RPM: quiet and cool; older laptops and low-power bulk storage.
- 7200 RPM: the usual desktop and network-attached storage (NAS) drive.
- 10,000 and 15,000 RPM: enterprise server drives, usually with a Serial Attached SCSI (SAS) interface. Solid-state drives have largely replaced them.
Sizes: 3.5 inch and 2.5 inch
Hard drives come in two widths. 3.5-inch drives are used in desktops, NAS devices and servers; they hold the most data and are the cheapest per terabyte. 2.5-inch drives are used in laptops and in dense server bays; 2.5-inch SATA solid-state drives use the same size, so they fit in the same bay. A 2.5-inch drive in a desktop needs a simple mounting bracket.
Why hard drives fail
Anything with motors and moving arms wears out. Spindle bearings wear, the actuator can fail, and a knock while the drive is running can make a head touch the platter (a head crash) and scratch the magnetic surface. Typical symptoms are clicking or grinding noises, a drive that is not detected, very slow file access, and read errors. A laptop hard drive is especially at risk when the laptop is moved or dropped while running; this was one of the main reasons laptops moved to solid-state drives.
Solid-state drives
A solid-state drive (SSD) stores data in flash memory chips and has no moving parts. Any block can be read in the same short time wherever it is, so random access, the weak spot of hard drives, is where SSDs are dramatically faster. They are also silent, use less power and survive being dropped. Replacing a hard drive with an SSD is often the single upgrade that makes an old computer feel new.
NAND flash
NAND flash is the non-volatile memory inside SSDs, Universal Serial Bus (USB) flash drives and memory cards. Each cell stores bits as a charge trapped in an insulated layer, which stays put without power. The more voltage levels a cell has to tell apart, the more bits it holds:
| Type | Bits per cell | Trade-off |
|---|---|---|
| SLC (single-level cell) | 1 | Fastest and most durable, most expensive per GB |
| MLC (multi-level cell) | 2 | Durable; mostly in older and enterprise drives |
| TLC (triple-level cell) | 3 | The common choice in consumer drives |
| QLC (quad-level cell) | 4 | Cheapest per GB; slower sustained writes and lower endurance |
Many TLC and QLC drives use part of their flash as a fast SLC-mode cache. Short writes land there at full speed; a very large copy can fill the cache, after which the write speed drops noticeably. That is normal behavior, not a fault.
The controller, wear and endurance
Flash has two quirks. It is written in pages but can only be erased in much larger blocks, and every cell survives only a limited number of erase cycles. The SSD's controller, a small processor on the drive, hides both: it keeps a map from the addresses the operating system uses to physical locations, spreads writes evenly over all cells (wear leveling), moves data around to free whole blocks (garbage collection), corrects bit errors and keeps spare cells in reserve.
Endurance is on the datasheet as TBW (terabytes written) or as drive writes per day (DWPD) over the warranty period. For typical desktop use the rating is far away:
tbw = 600 # endurance from the datasheet: 600 terabytes written
for gb_per_day in (20, 50, 200):
years = tbw * 1000 / gb_per_day / 365
print(f"{gb_per_day:>3} GB written per day: rating reached after {years:4.1f} years")
20 GB written per day: rating reached after 82.2 years 50 GB written per day: rating reached after 32.9 years 200 GB written per day: rating reached after 8.2 years
Endurance matters for write-heavy work such as databases, video editing and caching servers; that is where enterprise drives with higher ratings belong. SSDs do fail, but more often through the controller or firmware than by wearing out, and usually without the audible warning of a clicking hard drive.
TRIM
When you delete a file, the file system only marks its space as free; the drive itself does not know the data is no longer needed. TRIM is the command with which the operating system tells the SSD which blocks no longer hold valid data. The controller can then erase them in the background instead of copying stale data around, which keeps write speed up and reduces wear. Current operating systems send TRIM automatically: Windows when files are deleted, plus a periodic re-TRIM in the scheduled "Optimize Drives" task; most Linux distributions run a weekly trim; macOS does it for Apple SSDs, and for others once it is enabled.
Interfaces: SATA, NVMe and M.2
A drive's interface is how it talks to the rest of the computer. It sets a speed limit, and it decides which connector or slot the drive needs.
SATA
Serial ATA (SATA) connects hard drives, 2.5-inch SSDs and optical drives. Each drive has a thin 7-pin data cable to a SATA port on the motherboard and a separate 15-pin SATA power connector from the power supply. The current version, SATA III, signals at 6 Gbit/s. It uses 8b/10b encoding (10 bits on the wire for every 8 bits of data), so at most 600 MB/s of data gets through; real SATA SSDs reach about 550 MB/s. That ceiling was set with hard drives in mind, and fast flash hit it years ago. Operating systems talk to SATA drives through the Advanced Host Controller Interface (AHCI), a controller standard also designed for spinning disks.
NVMe over PCI Express
Non-Volatile Memory Express (NVMe) is a protocol designed for flash from the start. An NVMe drive connects directly to Peripheral Component Interconnect Express (PCIe) lanes, usually four of them, the same kind of lanes a graphics card uses (see Expansion Cards and Graphics). It supports many parallel command queues instead of AHCI's one, with far less protocol overhead. The PCIe generation sets the ceiling. The calculation below assumes the published transfer rates per lane and the encoding each link uses: 8b/10b for SATA, 128b/130b for PCIe 3.0 and later.
# name, gigatransfers per second per lane, lanes, encoding (payload bits, line bits)
links = [
("SATA III", 6, 1, (8, 10)),
("PCIe 3.0 x4", 8, 4, (128, 130)),
("PCIe 4.0 x4", 16, 4, (128, 130)),
("PCIe 5.0 x4", 32, 4, (128, 130)),
]
for name, gt_per_s, lanes, (payload, line) in links:
bits_per_s = gt_per_s * 1e9 * lanes * payload / line
mb_per_s = bits_per_s / 8 / 1e6
print(f"{name:<12} {mb_per_s:8,.0f} MB/s")
SATA III 600 MB/s PCIe 3.0 x4 3,938 MB/s PCIe 4.0 x4 7,877 MB/s PCIe 5.0 x4 15,754 MB/s
These are link limits per direction; real drives stay somewhat below them. A PCIe 4.0 drive in a PCIe 3.0 slot works, but at PCIe 3.0 speed: the link runs at the highest generation both sides support.
M.2: a form factor, not a protocol
M.2 is a small card-shaped slot and module format, described on the Motherboards page. It says nothing about speed by itself: an M.2 slot can carry SATA, PCIe (NVMe) or both, depending on how the motherboard wires it. Two details on the module tell you what you have:
- Size code: 2280 means 22 mm wide and 80 mm long, the usual desktop size; 2242 and 2230 are shorter modules for small laptops and handheld devices. The slot needs a mounting point at the right length.
- Key: the notch in the edge connector. NVMe SSDs normally have an M key; M.2 SATA SSDs usually have B+M (two notches), so they also fit an M-key slot, which does not mean the slot supports SATA.
Servers: U.2 and SAS
Servers want drives they can swap from the front while the system runs (hot-swap). U.2 puts an NVMe SSD in a 2.5-inch case with a connector that fits a hot-swap drive bay. Serial Attached SCSI (SAS) is the enterprise counterpart of SATA, with dual ports for redundant paths; a SAS controller accepts SATA drives as well, but a SATA controller cannot use SAS drives. Newer server designs use the EDSFF (Enterprise and Data Center Standard Form Factor) family of flash modules.
Flash media and optical discs
USB flash drives and memory cards
USB flash drives and memory cards use the same NAND flash as SSDs, with a much simpler controller, so they are slower and wear out sooner under heavy use. Secure Digital (SD) cards come in three sizes: full-size SD (cameras), microSD (phones, drones, single-board computers) and the rarely seen miniSD. The capacity family is printed on the card, and the reader must support it:
| Card type | Capacity |
|---|---|
| SD | up to 2 GB |
| SDHC (High Capacity) | more than 2 GB, up to 32 GB |
| SDXC (eXtended Capacity) | more than 32 GB, up to 2 TB |
| SDUC (Ultra Capacity) | more than 2 TB, up to 128 TB |
Speed markings give a guaranteed minimum sequential write speed, which matters for recording video: Class 10 and U1 mean 10 MB/s, U3 means 30 MB/s, and the video classes V30, V60 and V90 mean 30, 60 and 90 MB/s. A1 and A2 are application performance classes for cards that run apps, for example in phones.
Optical discs
Optical drives read data with a laser from pits and lands (or, on recordable discs, dye or phase-change layers) on a spinning disc. They are rare in new computers but still used for archives, software distribution in some organizations and media. An external USB drive covers the occasional need.
| Disc | Typical capacity |
|---|---|
| CD | 650 or 700 MB |
| DVD, single layer | 4.7 GB |
| DVD, dual layer | 8.5 GB |
| Blu-ray, single layer | 25 GB |
| Blu-ray, dual layer | 50 GB |
| BDXL (three or four layers) | 100 or 128 GB |
The suffixes describe what you can do with the disc: -ROM is read only, -R can be written once, and -RW (BD-RE for Blu-ray) can be erased and rewritten. A drive reads older formats (a Blu-ray drive reads DVDs and CDs), not the other way around.
How capacity is counted
Buy a 1 TB drive, plug it into Windows, and it shows 931 GB. Nothing is missing; two different units share one name. Drive makers use decimal prefixes, as everywhere else in science: kilo is 1,000, mega 1,000,000, giga 109 and tera 1012. Operating systems grew up counting memory in powers of two, where "kilo" came to mean 1,024. The International Electrotechnical Commission (IEC) gave those binary units their own names: kibibyte (KiB), mebibyte (MiB), gibibyte (GiB) = 230 bytes = 1,073,741,824 bytes, and tebibyte (TiB) = 240 bytes. Windows calculates in these binary units but labels them "GB" and "TB".
GIB = 2**30 # gibibyte: 1,073,741,824 bytes
drives = {"256 GB": 256 * 10**9, "1 TB": 10**12, "4 TB": 4 * 10**12}
for label, size in drives.items():
print(f"{label:>6} = {size:>17,} bytes = {size / GIB:7.1f} GiB")
for decimal, binary, power in (("kB", "KiB", 1), ("GB", "GiB", 3), ("TB", "TiB", 4)):
extra = 1024**power / 1000**power - 1
print(f"1 {binary} is {extra:5.1%} more than 1 {decimal}")
256 GB = 256,000,000,000 bytes = 238.4 GiB 1 TB = 1,000,000,000,000 bytes = 931.3 GiB 4 TB = 4,000,000,000,000 bytes = 3725.3 GiB 1 KiB is 2.4% more than 1 kB 1 GiB is 7.4% more than 1 GB 1 TiB is 10.0% more than 1 TB
The gap grows with every prefix: 2.4% at kilo, 10% at tera. On top of that, a formatted drive has a little less free space than its raw capacity, because the partition table, the file system's own structures and (on a system drive) recovery partitions take some. macOS has shown decimal units since 2009, so the same 1 TB drive shows "1 TB" there. For the basics of bits, bytes and binary, see Number Systems.
Drives, partitions and volumes
Three words describe three layers. The drive (or disk) is the physical device. A partition is a region of that drive, recorded in a partition table: GUID Partition Table (GPT) on current systems, the older Master Boot Record (MBR) on legacy ones. A volume is a formatted area with a file system that the operating system can use, with a drive letter such as C: in Windows or a mount point such as /home in Linux. Most of the time one partition holds one volume, but a volume can also span several drives, as with RAID. File systems and partitioning are covered in the Operating Systems topic.
Seeing the drives in a system
On Linux, lsblk lists block devices as a tree: drives
and the partitions on them. The ROTA column is 1 for
rotating hard drives and 0 for SSDs, and TRAN shows the
transport. The output below is illustrative:
lsblk -o NAME,SIZE,TYPE,ROTA,TRAN,MOUNTPOINTS
NAME SIZE TYPE ROTA TRAN MOUNTPOINTS sda 3.6T disk 1 sata └─sda1 3.6T part 1 /srv/data nvme0n1 931.5G disk 0 nvme ├─nvme0n1p1 512M part 0 /boot/efi └─nvme0n1p2 931G part 0 /
lsblk uses binary units too: the "T" and "G" here are
TiB and GiB, which is why the 4 TB hard drive shows as 3.6T. In
Windows PowerShell, Get-PhysicalDisk shows each drive's
media type, bus and health (again illustrative):
Get-PhysicalDisk | Format-Table DeviceId, FriendlyName, MediaType, BusType, HealthStatus, Size
DeviceId FriendlyName MediaType BusType HealthStatus Size -------- ------------ --------- ------- ------------ ---- 0 NVMe SSD 1TB SSD NVMe Healthy 1000204886016 1 SATA HDD 4TB HDD SATA Healthy 4000787030016
Size is in bytes. The Disk Management console
(diskmgmt.msc) shows the same drives graphically with
their partitions, and is where a new, uninitialized drive gets its
partition table and first volume.
Choosing storage
| Aspect | HDD (7200 RPM) | SATA SSD | NVMe SSD |
|---|---|---|---|
| Typical sequential speed | 150–280 MB/s, highest on large, recent drives and on the outer tracks | 500–550 MB/s | about 2,000–3,500 MB/s (PCIe 3.0) to 7,000 MB/s and more (PCIe 4.0 and 5.0) |
| Random access time | milliseconds | well under a millisecond | well under a millisecond, with more parallelism |
| Cost per TB | lowest | higher | similar to SATA SSD, higher for the fastest drives |
| Moving parts | yes: sensitive to shock, audible | no | no |
| Connection | SATA cable (or SAS) | SATA cable, or M.2 SATA | M.2 (M key), U.2 or a PCIe card |
The figures are typical ranges at the time of writing; datasheets quote best-case sequential numbers, and small random operations are much slower on every type. In practice:
- Boot and application drive: an SSD, NVMe if the system has a suitable slot. The operating system and programs do constant small random reads, exactly where hard drives are weakest.
- Bulk storage (media libraries, archives, backup targets): hard drives still give the most terabytes for the money.
- Shared storage for a household or small office: a network-attached storage (NAS) device with several hard drives, usually in RAID, and drives rated for always-on NAS use.
Monitoring drive health
Hard drives and SSDs record their own health: reallocated sectors,
read errors, temperature, power-on hours and, for SSDs, how much of
the rated endurance is used. This self-monitoring system is called
Self-Monitoring, Analysis and Reporting Technology (S.M.A.R.T.);
tools such as smartctl on Linux or the drive maker's
utility on Windows read it. Rising reallocated or pending sector
counts are an early warning to replace the drive. See
Hardware Troubleshooting
for how to read the values and what the typical failure symptoms
are.