David Páez

Basic storage abstractions on Linux

Published: Sat Feb 10 2024
Topics: linux


Some of the first concepts you come in contact with when installing and using a GNU/Linux distribution for the first time are those related to storage. I would have saved a lot of time in my projects with linux if I had studied the fundamentals of storage sooner.

The following is a condensed and simplified summary of five concepts that you will need in order to better understand Linux (and most other OS’s). Hence, this will be useful for working with personal computers, bare metal servers, virtual machines, docker containers, IoT devices, etc.

Here is a list, ranging from the most concrete to the most abstract:

  1. Drive: Physical storage medium or device
  2. Disk: OS representation of a drive
  3. Partition: Contiguous part of a disk
  4. Volume: Formatted partition
  5. Image: Snapshot of disk, partition or volume

Let’s elaborate on each one.

Drive

A physical device that has the capability of storing raw (digital) data. It is the physical substrate that contains the immaterial data. The more correct name for it would be storage medium or device.

Sometimes it is used informally to refer to any of the other categories. It's a mess, I know 🤦‍♂️️.

There are two main types of storage technology:

Disk

It is the representation of the Drive within an operating system, like Linux.

The OS assigns a name to each disk.

On Linux, the most common names are:

where x is an letter beginning from a

🧱 Example:

A linux computer with two SSDs and one HDD will have disks named as follows: sda, sdb and hda

On Windows, all regular hardware disks have the ‘disk’ prefix followed by an integer starting from 0

🧱 Example:

A Windows computer with two SSDs and one HDD will have disks named as follows: disk0, disk1, disk2

A disk has a special sector or place for the partition table: a data structure that defines how the disk is divided into one or more partitions.

The partition configuration of a disk can be implemented with any of several existing partition schemes. The most popular are:

Go up