// learn Β· linux Β· rhcsa Β· 9 min

Block devices & partitions.

A disk is a long strip of bytes. The partition table divides it into named regions you can format and mount. Watch a fresh disk grow partitions one at a time, learn MBR vs GPT, and the difference between lsblk, blkid, and /proc/partitions.

Block devices and partitions animated tutorial. lsblk and /proc/partitions, MBR vs GPT partition tables, parted interactive and script modes, partition alignment, partprobe, blkid for UUIDs. RHCSA EX200 ready.
// block devices & partitions

A disk is a strip of bytes. A partition table divides it into named regions. Watch a fresh disk grow partitions one at a time.

// before you start
you should know
  • Β·Know that /dev/sda etc. are disks
  • Β·Helpful: the filesystems lesson (next)
  • Β·Comfortable as root
by the end you'll

Read lsblk/blkid, pick MBR vs GPT, create properly aligned partitions with parted, and make the kernel notice them.

pace: 9 minutes

disk layout β€” step 1 / 6 Β· lsblk
πŸ’½ /dev/sdb Β· 100 GB
table: none
free Β· 100 GB
no partition table yet β€” `parted mklabel` first

lsblk β€” what disks does Linux see?

`lsblk` prints the tree of block devices: physical disks (sda, nvme0n1, vda) and their partitions, sizes, mount points, and types. It reads from sysfs (no root needed). Add -f to also show filesystem type and UUID. /proc/partitions is the raw equivalent. Always start with lsblk to know what you're working on β€” it's the cheapest way to avoid `parted /dev/sda` (your boot disk) when you meant `/dev/sdb`.

$lsblk
$lsblk -f
$lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
$cat /proc/partitions
// key insight

Three tools, three jobs: lsblk for layout (what disks/partitions exist), blkid for identity (UUID + fs type), findmnt for mounts (what's mounted where). Master those before reaching for parted, and you'll never accidentally repartition the wrong disk.

// exam-ready Β· disks & partitions
$lsblk / lsblk -f
$/proc/partitions
$blkid [DEV]
$findmnt /path
$parted /dev/sdX print
$parted /dev/sdX mklabel gpt
$parted /dev/sdX mklabel msdos
$parted /dev/sdX mkpart primary ext4 1MiB 1025MiB
$parted /dev/sdX rm 1
$parted /dev/sdX print free
$partprobe /dev/sdX
$partx -u /dev/sdX
$fdisk -l
$wipefs -a /dev/sdXn
$dd if=/dev/zero of=/dev/sdX bs=1M count=10
$smartctl -a /dev/sdX
// check yourself
4 quick questions
Q1

You're about to repartition a disk. Which command do you run FIRST to be sure you're working on the right one?

Q2

Difference between MBR and GPT partition tables?

Q3

You ran parted to create a new partition; lsblk still doesn't show it. What's the missing step?

Q4

Why reference partitions by UUID in /etc/fstab instead of /dev/sdXn?

These aren't graded β€” they're just for active recall, which is what actually makes the lesson stick.

πŸ“‚
// next

File systems & mounts

A partition is just bytes until you mkfs and mount it. See how XFS, ext4, mount, and /etc/fstab fit together.

open β†’

Read this lesson as text6 chapters Β· quiz answers

  1. 01lsblk β€” what disks does Linux see?

    lsblk prints the tree of block devices: physical disks (sda, nvme0n1, vda) and their partitions, sizes, mount points, and types. It reads from sysfs (no root needed). Add -f to also show filesystem type and UUID. /proc/partitions is the raw equivalent. Always start with lsblk to know what you're working on β€” it's the cheapest way to avoid parted /dev/sda (your boot disk) when you meant /dev/sdb.

    • $ lsblk β€” tree of block devices
    • $ lsblk -f β€” + filesystem + UUID
    • $ lsblk -o NAME,SIZE,TYPE,MOUNTPOINT β€” custom columns
    • $ cat /proc/partitions β€” raw kernel view
  2. 02MBR vs GPT β€” pick a partition table

    Before you can put partitions on a fresh disk, it needs a partition TABLE. MBR (Master Boot Record) is the legacy format: max 2 TiB disks, max 4 primary partitions (or 3 + an extended container). GPT (GUID Partition Table) is the modern one: huge disks, 128 partitions by default, redundant copies at both ends, required for UEFI boot. New systems use GPT; you'll see MBR only on legacy gear.

    • $ parted /dev/sdb mklabel gpt β€” make a GPT table (destructive!)
    • $ parted /dev/sdb mklabel msdos β€” make an MBR table
    • $ parted /dev/sdb print β€” show table type + partitions
  3. 03Create a partition with parted

    parted is the modern partition editor (fdisk also works, especially the rewritten util-linux one). Script form: parted /dev/sdb mkpart primary ext4 1MiB 1025MiB makes a 1 GiB partition. Always start at 1MiB for proper alignment β€” older defaults could land you in slow-spot misalignment territory. Repeat with different ranges to add more.

    • $ parted /dev/sdb mkpart primary ext4 1MiB 1025MiB β€” 1 GiB partition
    • $ parted /dev/sdb print β€” verify
  4. 04Add more β€” and watch alignment

    Adding another? Start where the last one ended. parted /dev/sdb mkpart primary linux-swap 1025MiB 3073MiB β€” a 2 GiB swap region. Use print free to see unallocated space. unit MiB in interactive mode shows everything in mebibytes so you can do the arithmetic. Misalignment kills SSD/NVMe performance; parted aligns to 1MiB boundaries by default β€” keep it that way.

    • $ parted /dev/sdb mkpart primary linux-swap 1025MiB 3073MiB β€” 2 GiB swap
    • $ parted /dev/sdb print free β€” see free space too
    • $ parted /dev/sdb unit MiB print β€” force MiB units
  5. 05Tell the kernel β€” partprobe

    parted writes the new partition table to disk, but the kernel may not re-read it if the disk is in use. partprobe /dev/sdb (or partx -u) asks the kernel to reload the partition table. After this, /dev/sdb1, /dev/sdb2 exist and you can mkfs on them. A reboot also works β€” partprobe just avoids the reboot.

    • $ partprobe /dev/sdb β€” re-read partition table
    • $ partx -u /dev/sdb β€” alternative
    • $ lsblk /dev/sdb β€” kernel sees them now
  6. 06Find existing partitions β€” blkid + UUIDs

    blkid shows what's ON each partition: filesystem type and UUID. Always reference partitions in /etc/fstab by UUID, not by /dev/sdXn β€” those names can change when you add or remove disks. blkid /dev/sdb1 shows just one; findmnt /mountpoint goes the other way (which device is mounted here). Together: lsblk for layout, blkid for identity, findmnt for mounts.

    • $ blkid β€” fs + UUID for every device
    • $ blkid /dev/sdb1 β€” just one
    • $ findmnt /var β€” what's mounted there
    • $ wipefs -a /dev/sdb1 β€” erase fs signatures (careful!)

Quiz β€” answers

You're about to repartition a disk. Which command do you run FIRST to be sure you're working on the right one?
β†’lsblk β€” shows every disk, partition, size, type, and mount point. Find the right device BEFORE handing it to parted.lsblk is the cheapest sanity check β€” it tells you which device is your boot disk, which is the new one, and what's mounted where. Using parted on the wrong device is one of the fastest ways to lose data.
Difference between MBR and GPT partition tables?
β†’MBR: legacy, max 2 TiB, max 4 primaries (or 3 + extended). GPT: modern, huge disks, 128 partitions by default, redundant copies, required for UEFI boot.MBR is a 1980s design with hard 2 TiB / 4 partition limits and no built-in redundancy. GPT was designed for modern hardware (UEFI requires it for boot disks). Default to GPT on new systems.
You ran parted to create a new partition; lsblk still doesn't show it. What's the missing step?
β†’partprobe /dev/sdX (or partx -u /dev/sdX) asks the kernel to re-read the partition table without a reboot.parted writes to the disk's partition table, but the running kernel may still hold the old layout. partprobe (or partx -u) forces a re-read so the new /dev/sdXn nodes appear.
Why reference partitions by UUID in /etc/fstab instead of /dev/sdXn?
β†’Because /dev/sdXn names depend on enumeration order β€” add or remove a disk and sda may become sdb. UUIDs are stable per-filesystem and survive that.Stable identifiers matter when /etc/fstab is your boot-time mount list. blkid gives you the UUID; use UUID=... in fstab so reordering disks doesn't break boot.
// more in linux

keep going β€” these pair well with what you just learned.

see all linux β†’

See also

back to RHCSA trackall lessons