How do you calculate storage capacity of a hard disk?

Calculating the storage capacity of a hard disk drive (HDD) is important to understand how much data you can store on the drive. The total storage capacity depends on several factors that we will discuss in this article.

Hard Disk Drive Basics

A hard disk drive consists of one or more circular platters made of a non-magnetic material, usually aluminum or glass. These platters are coated with a thin magnetic film consisting of grains of material that can be magnetized to store data.

The platters rotate at high speeds, typically 5400 to 15000 RPM. A read/write head hovers above each platter surface to read and write data by magnetizing the grains on the platter in specific directions to represent 0s and 1s.

The platters are divided into tracks which are further subdivided into sectors. A unique sector number identifies each sector. The sector is the smallest addressable storage unit on a hard disk.

Modern HDDs use 512 byte or 4K (4096 byte) sector sizes. The sector size is set when the drive is formatted and cannot be changed without reformatting.

Cylinders, Heads and Sectors

To locate data on a hard disk, the drive electronics use 3 coordinates – cylinder, head and sector number. This is known as CHS addressing.

Cylinders refer to concentric circular tracks across all the platter surfaces stacked vertically in the hard disk. If there are 4 platters, a cylinder refers to a track on all 4 platters. The tracks that lie directly above one another across all platters constitute a cylinder.

Heads refer to the read/write heads that access each platter surface. For a 4 platter drive, there are 8 heads – 2 heads per platter, one for the top surface and one for the bottom.

Sectors are the smallest indivisible unit of storage on a hard disk. Each track is further divided into sectors of 512 bytes or 4K bytes each. A sector number identifies the specific sector being accessed.

So a cylinder number, head number and sector number together identify a specific 512 byte or 4K byte sector on the hard disk where data is stored.

CHS Addressing Limitations

Early HDDs used CHS addressing only. However this imposed a limit on maximum capacity.

For example, if a HDD has 8032 cylinders, 16 heads and 63 sectors per track, the maximum capacity is:

8032 cylinders x 16 heads x 63 sectors x 512 bytes per sector = 504 MiB

This was insufficient as disk capacities grew larger. Also the complex geometry calculations required for CHS slowed down the disk.

LBA Addressing

To overcome CHS limitations, Logical Block Addressing (LBA) was introduced. In LBA, each sector is assigned a unique Logical Block Address (LBA) from 0 to n.

The drive electronics simply use the LBA to directly access the desired sector. No more complex geometry calculations required.

Maximum capacity was no longer limited by drive geometry. This allowed for much larger capacities. LBA avoids the 504 MiB limit for CHS.

Modern HDDs use LBA for addressing sectors. But the cylinder/head/sector coordinates are still maintained internally for error detection and recovery.

Data Transfer Rate

The hard disk rotates at a constant speed, measured in rotations per minute (RPM). Typical rotation speeds are 5400, 7200 and 15000 RPM.

The rate at which data can be read from or written to the drive is determined by:

  • Rotational speed – Higher RPM means data passes under the head faster
  • Data density – More densely packed data means more data per rotation
  • Disk diameter – Larger diameter platters have more data per track

Combining these factors gives the data transfer rate, which is measured in megabytes per second (MBps). HDD data transfer rates range from 100 MBps to 250 MBps for high performance drives.

Areal Density

The main factor that determines HDD capacity is areal density. This is the amount of data that can be stored per square inch of platter surface.

HDD technology has steadily improved areal density over the years, enabling larger storage capacities:

Year Areal density
1991 1 Gbit/in2
1997 5 Gbit/in2
2003 40 Gbit/in2
2009 370 Gbit/in2
2016 1.3 Tbit/in2

Higher areal density is achieved by innovations like magnetoresistive heads, perpendicular recording, shingled magnetic recording and advanced signal processing.

Calculating Total Capacity

Now that we understand the key concepts, we can calculate the total storage capacity of a hard disk drive.

The steps are:

  1. Find the areal density of the drive from the manufacturer specification. This is specified in Gbit/in2.
  2. Find the total platter surface area by calculating area of each platter:
    • Area = π x r2 where r is platter radius
    • Multiply by total number of platters to get total area
  3. Multiply areal density by total area to get total number of Gbits the drive can store.
  4. Convert Gbits to bytes by dividing by 8 (since 1 byte = 8 bits).
  5. Divide by 1024 repeatedly to convert to desired unit like MiB, GiB, etc.

Let’s take an example of a 2 platter hard disk with the following specs:

  • Platter diameter: 2.5 inches
  • Areal density: 500 Gbit/in2

Solving:

  1. Platter radius r = 2.5/2 = 1.25 inches
  2. Area of each platter = π x r2 = π x 1.252 = 4.909 in2
  3. Total area with 2 platters = 4.909 x 2 = 9.818 in2
  4. Total bits = 9.818 x 500 Gbit/in2 = 4909 Gbits
  5. Total bytes = 4909 x 1024^3 / 8 = 613,625,000,000 bytes
  6. Converting to GiB: 613,625,000,000 / 1024^3 = 500 GiB

Therefore, the total storage capacity is 500 GiB.

Other Factors Affecting Capacity

Some other factors affect the usable capacity of a hard drive:

Formatted vs Unformatted Capacity

A HDD’s unformatted capacity is its maximum capacity before any partitions are created and filesystem is set up. This does not account for space used up in formatting and partitioning.

The formatted capacity refers to actual usable space available to store files after formatting and partitioning. The formatted capacity is always smaller.

Over-provisioning

HDD vendors allocate more physical sectors than advertised capacity as spare sectors. These compensate for bad sectors and improve performance. This over-provisioning uses up 5-15% of disk space.

Filesystem overhead

The filesystem itself uses up some storage to maintain filesystem metadata, structures, journals etc. This overhead consumes 1-2% of disk space.

So the actual usable space on a drive can be 10-20% lower than the advertised capacity.

Conclusion

We discussed the key factors that determine hard disk storage capacity:

  • Areal density is the primary factor determining total HDD capacity.
  • LBA provides a simple linear mapping to sectors without CHS restrictions.
  • RPM, density and diameter affect data transfer rate.
  • Formatted capacity is lower than unformatted capacity.
  • Over-provisioning and filesystem overhead further reduce usable space.

By accounting for these factors, you can accurately calculate the total and usable storage capacity of any hard disk drive.