Articles

Volumes, partitions and filesystems: the stack that holds the data

Partitions, volumes and filesystems composed into one stack, and where a change is made.

Reading: 4 minServer & Virtualization

Article cover: Volumes, partitions and filesystems: the stack that holds the data

Storage is a stack of levels built from different material: a local partition, a software RAID device, a logical volume on a remote LUN, a ZFS pool over whole disks. Below the filesystem the levels do not know one another — each is just a block device to the one above. Three questions follow: what name survives a reboot, which fields were fixed at creation, how a decision at one level is inherited by the next.

The mental model. In order: which levels exist and what fills each one (composition); what stable name follows the data when the device path changes (identifier); which tool owns a given field and which fields were frozen at creation (owner).

Terms. A partition is a range of blocks in a partition table. A physical volume (PV), volume group (VG) and logical volume (LV) are the objects of the Logical Volume Manager (LVM): a device, a pool of them, a volume carved out. A UUID is an identifier written inside a filesystem or partition table; a label is a short name beside it. A LUN (logical unit number) is a block device presented over a storage network such as iSCSI; md is the Linux software-RAID driver.

ONE LOGICAL STACK, THREE COMPOSITIONS (what fills each level)

  container   partition (GPT)      md device         whole disk / LUN
  pool        ----                 LVM volume group  ZFS pool
  volume      the partition        logical volume    dataset / zvol
  filesystem  ext4                 XFS               ZFS
  mount       /srv                 /data             /backup

  identifier  PARTUUID             LV UUID           fs UUID / LABEL
  alignment   parted align-check   mkfs sunit/swidth xfs mount sunit/swidth

One stack, several compositions

The top-level rule is explicit: an XFS filesystem “can reside on a regular disk partition or on a logical volume”, and what sits underneath does not matter to it.

Three compositions cover most servers. On local disks a GPT partition is the container. With RAID and LVM the disks pool into an md device, which becomes a physical volume; the volume group hands out logical volumes, and the driver’s name never leaks upward, because md devices present themselves “as regular block devices” and a physical volume is just “a device path under /dev”. On a storage network the container comes from elsewhere: with iSCSI, FibreChannel or SAS, LVM splits a LUN into virtual disks. ZFS prefers the raw disks — “the recommended mode of operation is to use whole disks” — with no partition to grow.

The composition decides which levels exist to change at all: a volume group grows by adding a PV and is marked partial when one is “missing from the system”; a ZFS pool grows by adding a disk; a plain partition needs re-partitioning by hand.

Stable names: UUID, label, and why not /dev/sdX

The kernel assigns disk names in discovery order, so /dev/sda can be a different disk after a reboot or a hardware change. The name that travels with the data is the identifier written into the level. blkid reads it back as the “attributes (tokens, NAME=value pairs)” that include LABEL and UUID, and /etc/fstab accepts a label or UUID in place of a device name; the durable forms are LABEL=, UUID=, PARTUUID= and PARTLABEL=.

Two habits follow. Verify the convenience symlinks: udev maintains /dev/disk/by-label and its siblings, but the manual warns that using those directly is unsafe without verification. And keep identifiers unique: blkid “silently ignores all devices where the probing result is ambivalent” — two colliding filesystems. XFS shows the hazard: its UUID sits in every allocation group header, so a block-for-block copy reproduces it.

What a level fixes at creation

A field belongs to the level whose tool writes it, and only that tool can change it — or cannot. The sharpest cases are decided by mkfs: an ext4 filesystem cannot change its bytes-per-inode ratio, because “it is not possible to change this ratio on a file system after it is created”, nor its inode size for the same reason. XFS fixes inode alignment even earlier — “alignment must be established at the time the filesystem is created”.

Other fields change, but only through their own level:

  • Frozen at layout time: block size, inode size, bytes-per-inode ratio.
  • Tunable within limits: the XFS inode percentage “can be modified with xfs_growfs(8)”.
  • Identity, not geometry: the label and UUID, set or cleared without touching the layout.
  • Container versus content: resizepart “does not modify any filesystem present in the partition”; resize2fs “does not manipulate the size of partitions”.

How to sequence a resize is the earlier local-storage sheet’s subject; the point here is narrower — a field lives at one level.

Alignment is decided once, then inherited

Alignment is a decision at each level, inherited by the one above. At the partition level parted align-check minimal|optimal tests the partition’s start boundary; optimal “aligns to a multiple of the physical block size”.

The filesystem inherits it. On a plain device mke2fs and mkfs.xfs set their own geometry; on a logical volume, mkfs.xfs “will automatically query the logical volume for appropriate sunit and swidth values”, while noalign turns detection off. mke2fs sets the stripe geometry explicitly with -E stride. Inherited values go stale when a lower level changes: the mount-time sunit/swidth options matter mainly after a RAID reshape, so a re-shaped stack can leave the level above it out of step with the stripe below.

Limits and the common error

The common error is to treat the device name as the identity of the data. /dev/sdb is a position, not a name; the durable names are the UUID and the label, and a moved container leaves the content untouched until its own tool runs. A second error generalises from one field to another: a value frozen at mkfs, such as the inode size, cannot be edited into a different value.

A thin pool or a copy-on-write snapshot separates the apparent size of a volume from the space actually allocated, moving the risk from layout to capacity; and mkfs.xfs “will not write to the device if it suspects that there is a filesystem” unless forced.

Level and prerequisites

L3 — composition, identifiers and the change owner: this sheet assumes the levels and asks how they are built, named and altered. The block-device model comes from the L1 sheet Filesystems, users, groups and permissions: how a system decides who may touch what; the level path and the resize order come from the L2 sheet Local storage: partitions, filesystems and volume management.

Where to go next

The sheets that continue this one, named in plain prose: Block, file and object storage: three access models (the access models above the block layer), RAID and backup: availability is not protection and ZFS: pools, datasets, snapshots and scrub, Snapshots and their limits and Virtual disks: thin and thick provisioning (apparent size versus allocated space), and NAS and SAN: file-level and block-level shared storage.

References

Nodrius Field Kit — cover

Get the Nodrius Field Kit

Enter your email and we'll send you the complete Field Kit: eight technical resources in one download.

Your email address is sent to Nodrius and used to deliver the Field Kit to you by email. Marketing messages are separate and optional: the checkbox does not affect your download, and you are only added to our updates list if you tick it. Privacy Policy.

Privacy & cookies

This site does not use cookies, analytics or tracking, and it does not profile you. There is nothing technical to switch off, so Accept and Reject change nothing about how the site works: either choice lets you browse everything normally.

The only difference is what your browser remembers: two entries in local storage — your choice here, so this notice is not shown again, and a marker that the Field Kit offer has already been made — so the offer is presented once and not on every page. They contain no identifier, they are not shared with anyone, and the site sets no cookie for either.

What we do with your data
How your email address is used when you ask for a Resource, how long it is kept and which rights you have — in the Privacy Policy.
What the site stores in your browser
Two entries in local storage — your choice on this notice and whether the Field Kit offer has been shown — and no cookies, no session storage, no third-party content: in the Cookie Policy.