Skip to content

How Linux Sees Devices


Every storage concept in this section — partitions, filesystems, LVM, mounting — sits on top of one foundational idea: how Linux represents a physical (or virtual) disk in the first place. Before creating a single partition, it’s worth knowing exactly what you’re looking at when you list what storage exists on a system.

Block Devices

A block device is how Linux represents anything that stores data in fixed-size chunks (“blocks”) that can be read or written in any order — as opposed to something like a keyboard or a network socket, which streams data sequentially. Physical disks, SSDs, USB drives, and even virtual disks in a cloud VM all show up to Linux as block devices.

Consistent with the “everything is a file” idea from the lsof chapter back in Processes & Job Control, every block device is represented as a special file under /dev — briefly mentioned back in the Filesystem Hierarchy Standard chapter as one of the directories that isn’t really storing ordinary data. This is where that idea becomes directly useful: /dev/sda, for instance, isn’t a regular file with content — it’s a device node, a handle the kernel uses to let you (or a program) address that physical disk directly.

Naming Conventions

Device names follow patterns that tell you something about the underlying hardware before you’ve even run a command:

PatternMeaning
/dev/sda, /dev/sdb, …SATA/SCSI/USB disks — lettered in the order the kernel detected them
/dev/nvme0n1, /dev/nvme1n1, …NVMe SSDs — numbered rather than lettered
/dev/sda1, /dev/sda2, …Partitions on /dev/sda — the whole-disk device name with a number appended
/dev/nvme0n1p1A partition on an NVMe device — note the added p before the partition number, needed because the device name already ends in a number

That distinction between a whole disk (/dev/sda) and a partition on it (/dev/sda1) matters constantly throughout this section — running a command against the wrong one of the two is a common, sometimes destructive mistake, and it’s worth internalizing the naming pattern now specifically to avoid that later.

Note

Letters are assigned in detection order, not by any fixed physical rule — which drive ends up /dev/sda versus /dev/sdb can, in some circumstances, change between reboots, especially with multiple USB devices. This is part of why the Mounting & /etc/fstab topic later in this section pushes toward identifying disks by UUID rather than by device name for anything long-term.

Listing What’s There: lsblk

lsblk (“list block devices”) shows every block device on the system, along with its partitions, in a tree view that makes the whole-disk-vs-partition relationship immediately visible.

lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0   100G  0 disk
├─sda1        8:1    0     1G  0 part /boot
└─sda2        8:2    0    99G  0 part /

Reading this: sda is the whole physical disk, 100G in size, with TYPE shown as disk. Underneath it, indented, are its two partitions — sda1 and sda2 — each shown as TYPE part, along with where each is currently mounted (a concept covered properly in the Mounting chapter later in this section). This tree structure is exactly the whole-disk/partition relationship from the naming convention table above, made visual.

A few flags worth knowing:

lsblk -f

Adds filesystem type and UUID columns — genuinely useful once you’re working with the Filesystems and Mounting files later in this section, since it tells you not just that a partition exists, but what’s actually formatted onto it.

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,FSTYPE

Like ps -o from the Processes section, -o lets you choose exactly which columns you want instead of the default set — useful once you know specifically what you’re checking for.

Why This Matters Before Touching Anything Else

Every command in the rest of this section — partitioning, formatting, mounting — takes a device path as an argument, and every one of them is capable of destroying data if pointed at the wrong device. lsblk is the tool you’ll run before nearly every other command in this section, specifically to confirm you’re about to act on the device you actually intend to, not a similarly-named one. Treat it the same way the ls habit was treated before rm -r back in the File Operations chapter — a two-second check that costs nothing and prevents a real mistake.

What’s Next

You can now see exactly what storage exists on a system and how it’s structured. The next chapter gets into actually dividing a disk into partitions — the tools available for it, and which one genuinely fits which situation.

Last updated on