Pcornel
Linux · Disks & Block Devices

Partitions

Cheat sheet · https://pcornel.dk/topic.php?topic=2751

Back to the Topic

Answer

Partitions divide a disk into regions recorded in the partition table (MBR or GPT), each with a start, end and type, and appear as /dev/sda1, /dev/nvme0n1p1.

Remember

Back up before changing partitions. Grow online with growpart then grow the filesystem. Shrinking needs the filesystem shrunk first (XFS cannot shrink). Run partprobe after changes.

First checks

  • growpart /dev/<disk> <n> — grow a partition to fill the disk
  • lsblk -f — disks, partitions, filesystems, UUIDs and mount points
  • blkid — UUIDs, labels and types
  • fdisk -l / parted -l — partition tables
  • udevadm info /dev/<dev> — device properties

Commands

lsblk -d -o NAME,SIZE,MODEL,SERIAL

Verify in this order

partition table edited → kernel re-reads it → partition device appears → used by filesystem or LVM

Where it usually breaks

First mismatch in hardware/block device → kernel driver/mapper/RAID/LVM → filesystem → mount namespace/options → path permissions/MAC → consumer I/O; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2751

Confirmation

Confirm action

Continue?