11.1 List, Create, and Delete Partitions on GPT Disks
Key Takeaways
- On RHEL 10 exam systems, prefer GPT (GUID Partition Table) for new disks; list layout with lsblk, blkid, parted -l, and fdisk -l.
- Create and delete GPT partitions with parted (mkpart/rm), gdisk, or fdisk in GPT mode; set type codes (Linux filesystem, LVM, swap) correctly for the task.
- Kernel partition table re-read uses partprobe, partx, or a careful reboot when devices do not appear; never assume /dev/sdXN exists without checking.
- EX200 storage work is non-destructive by default: identify free disks or free space, avoid wiping the root disk, and verify before rm/mkpart on production-like layouts.
- Partitioning alone does not create a filesystem or LVM volume—follow with mkfs, pvcreate, or swap setup in later steps; persist mounts via fstab/UUID in related objectives.
11.1 List, Create, and Delete Partitions on GPT Disks
Quick Answer: Inventory disks with
lsblk,fdisk -l, andparted -l. On GPT disks, create partitions withparted(mkpart),gdisk, orfdisk(GPT label). Delete withparted rm,gdiskd, orfdiskd. Re-read the table withpartprobe/partxif nodes are missing. On EX200, work only on the intended free disk or free space—never casually reinitialize the system root disk.
Why GPT partitioning is on EX200
Under Configure local storage, Red Hat expects you to list, create, and delete partitions on GPT disks. Typical lab language:
- “On the unused disk
/dev/sdb, create a 2 GiB GPT partition for a filesystem.” - “Create two partitions: one for LVM and one for swap.”
- “Remove the second partition on
/dev/sdcwithout destroying the first.”
You are graded on the end layout: correct disk, sizes (within reasonable rounding), GPT label, and partition type/flags when the task cares. Filesystems and LVM come next; this section is the partition table skill.
GPT vs MBR in one minute
| Feature | MBR (msdos) | GPT |
|---|---|---|
| Max practical size legacy | 2 TiB classic limit | Multi-pebibyte class disks |
| Partition count | 4 primary (or 3 + extended/logical) | Many partitions (typically 128 entries) |
| ID style | 1-byte type codes | GUID type GUIDs |
| Exam default for new work | Legacy; still appear | Prefer GPT for new disks |
RHEL installers and modern VMs usually present GPT. If a task says “GPT disk,” do not leave an msdos label. If a disk is empty, you may need to create a GPT label first.
Discover disks and current layout
Always list before you write:
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS,UUID,MODEL
lsblk -f
sudo fdisk -l
sudo parted -l
cat /proc/partitions
| Tool | Best for |
|---|---|
lsblk | Tree of disks, partitions, LVs, mounts |
fdisk -l | Partition tables and sizes |
parted -l | Labels (gpt/msdos), flags, sizes |
blkid | Filesystem/PV UUIDs on existing nodes |
udevadm info | Detailed device properties |
Identify the root disk (holds / or /boot) and leave it alone unless the task explicitly targets it:
findmnt /
lsblk -o NAME,MOUNTPOINTS
df -h /
Exam disks for extra storage are often /dev/sdb, /dev/sdc, /dev/vdb, /dev/nvme0n1, or similar second devices—confirm size and emptiness against the task wording.
Device naming quick map
| Pattern | Meaning |
|---|---|
/dev/sda, /dev/sdb | SCSI/SATA/virtio-scsi style disks |
/dev/vda, /dev/vdb | virtio-blk virtual disks |
/dev/nvme0n1 | NVMe namespace; partitions nvme0n1p1 |
/dev/sda1 | Partition 1 on sda |
/dev/mapper/... | Device-mapper names (LVM, multipath)—not raw GPT slots |
NVMe partition nodes use a p before the number (nvme0n1p1). Do not invent nvme0n11.
Create a GPT label on a blank disk
Warning: Labeling wipes the partition table. Only on the disk the task authorizes.
parted
sudo parted /dev/sdb --script mklabel gpt
sudo parted /dev/sdb print
gdisk
sudo gdisk /dev/sdb
# o → create new empty GUID partition table
# y → confirm
# w → write and exit
fdisk (GPT)
sudo fdisk /dev/sdb
# g → create a new empty GPT partition table
# w → write
Interactive tools only write when you w (or parted --script runs immediately). You can quit with q to abort if you opened the wrong disk.
Create partitions
parted (scriptable—excellent under time pressure)
# Units: use MiB/GiB boundaries to avoid alignment surprises
sudo parted /dev/sdb --script mkpart primary 1MiB 2049MiB
# Or named partition with explicit FS hint (type string varies by use):
sudo parted /dev/sdb --script mkpart dataext4 1MiB 100%
sudo parted /dev/sdb --script mkpart lvmpart 1MiB 50%
sudo parted /dev/sdb --script mkpart swappart 50% 100%
Set partition flags/types when needed:
sudo parted /dev/sdb set 1 lvm on
sudo parted /dev/sdb set 2 swap on
sudo parted /dev/sdb print
For a pure Linux filesystem partition, a normal GPT “Linux filesystem” type is enough; for LVM PVs, set the LVM type/flag so later tools and humans recognize intent.
Interactive parted:
sudo parted /dev/sdb
(parted) unit MiB
(parted) print
(parted) mkpart primary 1 2049
(parted) set 1 lvm on
(parted) quit
gdisk
sudo gdisk /dev/sdb
# n → new partition
# accept partition number, first sector defaults
# size: +2G
# type: 8300 Linux filesystem, 8e00 Linux LVM, 8200 Linux swap
# p → print
# w → write
Memorize common gdisk type codes:
| Code | Use |
|---|---|
| 8300 | Linux filesystem |
| 8e00 | Linux LVM |
| 8200 | Linux swap |
| ef00 | EFI System Partition (ESP)—only if task needs UEFI boot work |
fdisk GPT mode
sudo fdisk /dev/sdb
# n new partition
# accept defaults or set size (+2G)
# t change type (31 Linux LVM, 19 Linux swap, 20 Linux filesystem—codes listed by L)
# p print
# w write
fdisk type hex codes differ from gdisk’s four-digit codes—use L inside fdisk to list, do not mix tables from memory under stress.
Delete partitions
Only delete what the task names. Order matters when you later recreate: deleting partition 2 does not renumber partition 1 on GPT the way some people fear—numbers stay as assigned until reused.
# parted
sudo parted /dev/sdb rm 2
# gdisk: d then partition number, then w
# fdisk: d then partition number, then w
Non-destructive mindset: If the partition holds a PV, filesystem, or swap that is still in use, unmount/disable first (umount, swapoff, vgchange -an as appropriate). Deleting a busy partition is a classic “I finished the task and the system hung” failure mode.
Kernel re-read and missing device nodes
After writing a table:
lsblk /dev/sdb
sudo partprobe /dev/sdb
# or
sudo partx -u /dev/sdb
# or
sudo udevadm settle
If /dev/sdb1 still missing, check dmesg | tail and whether something still holds the old table. A reboot is a valid exam recovery when partprobe cannot refresh a busy disk—but prefer live re-read to save time.
Sizing, units, and free space
Tasks say “2G,” “500M,” or “use the whole disk.”
sudo parted /dev/sdb unit GiB print free
sudo parted /dev/sdb print free
Leave a small gap at the start (1 MiB) for alignment when creating the first partition—parted examples above use 1MiB start. Using 0% / 100% is common and acceptable when the task allows full-disk use:
sudo parted /dev/sdb --script mkpart primary 0% 100%
If a disk already has a partition and free space at the end, create the next partition only in free space—do not mklabel again.
End-to-end exam scenarios
Scenario A — One GPT data partition on empty disk
Task: Initialize /dev/sdb as GPT; create one partition using all space for a future XFS filesystem.
lsblk
sudo parted /dev/sdb --script mklabel gpt
sudo parted /dev/sdb --script mkpart primary 1MiB 100%
sudo partprobe /dev/sdb
lsblk /dev/sdb
# Next chapter skills: mkfs.xfs /dev/sdb1 and fstab—not required merely to “create partition”
Scenario B — LVM-ready partition
Task: On /dev/vdb, create a 5 GiB partition of type LVM.
sudo parted /dev/vdb --script mklabel gpt
sudo parted /dev/vdb --script mkpart primary 1MiB 5121MiB
sudo parted /dev/vdb --script set 1 lvm on
# or gdisk type 8e00
lsblk -o NAME,SIZE,TYPE,PARTTYPE /dev/vdb
Scenario C — Delete without touching sibling
Task: Remove only partition 2 on /dev/sdc.
sudo parted /dev/sdc print
sudo parted /dev/sdc rm 2
sudo partprobe /dev/sdc
lsblk /dev/sdc
Verify partition 1 size and contents unchanged (blkid /dev/sdc1).
Scenario D — Wrong tool panic
You opened fdisk /dev/sda (root). Do not write. Press q and re-identify with lsblk.
Partitions vs LVM vs filesystems (scope control)
| Layer | Question it answers | Tools (this / next sections) |
|---|---|---|
| Partition table | How is the disk sliced? | parted, gdisk, fdisk |
| Physical volume | Is this device an LVM PV? | pvcreate (11.2) |
| Volume group / LV | How is capacity pooled/carved? | vg*/lv* (11.3–11.4) |
| Filesystem / mount | How do users store files? | mkfs, mount, fstab (later) |
Creating a partition of type LVM does not run pvcreate for you. Creating a partition does not format XFS/ext4. Do exactly the layer the task asks; do not “helpfully” format when only a partition was requested—and do not stop at a partition when the task says “create an XFS filesystem on a new partition.”
Persistence and scoring
The GPT table is stored on the disk itself. After a correct w / mklabel+mkpart, the layout survives reboot without /etc edits. You still re-check with lsblk after reboot in practice labs. Mount points and swap activation need separate persistent config (fstab, systemd mount units)—out of scope for pure partition creation, but remember the overall EX200 rule: configuration must survive reboot when the task creates usable storage.
Common traps
mklabelon the wrong disk — instant data loss; list twice.- MBR vs GPT — task says GPT but you left
msdos. - Wrong type code — filesystem tools work on 8300; LVM tasks expect PV-capable type and then
pvcreate. - Forgetting partprobe — scripts fail with “no such device.”
- Overlapping partitions or free-space math errors — use
print free. - Deleting a mounted partition — unmount first.
- Assuming
/dev/sdb1after creating on/dev/nvme0n1— wrong name pattern. - Using
/dev/mapper/...as if it were a GPT partition — mapper names are logical devices above the partition/PV layer.
Section checkpoint
You should inventory block devices, create a GPT label when required, add and remove partitions with parted/gdisk/fdisk, set Linux filesystem / LVM / swap types, refresh the kernel partition table, and practice a non-destructive exam workflow that protects the root disk. That is the EX200 bar for listing, creating, and deleting GPT partitions.
Which command pair is most appropriate to place a new GPT label on empty disk /dev/sdb and then create one partition using the bulk of the disk?
In gdisk, which type code is the standard choice for a partition that will become an LVM physical volume?
You wrote a new partition table on /dev/sdc but /dev/sdc1 does not appear in lsblk. What should you try before assuming the disk is broken?
An EX200 task says to create a 2 GiB GPT partition on the unused second disk without harming the system. What is the safest first step?