Managing partitions and filesystems is one of the most critical skills tested on the LPIC-1 (101-500) exam. Whether you are setting up a fresh server, expanding storage on a production box, or recovering from a disk failure at 2 AM, you need to know these tools cold. This guide covers every partition and filesystem topic you will encounter on the exam, with real command examples and explanations that go beyond surface-level theory.
This post maps directly to LPIC-1 Objective 104.1 (Create partitions and filesystems), 104.2 (Maintain the integrity of filesystems), and 104.3 (Control mounting and unmounting of filesystems). We also touch on Objective 102.1 (Design hard disk layout) where relevant.
1. Linux Disk Naming Conventions
Before you touch any partitioning tool, you need to understand how Linux names its block devices. The kernel assigns device nodes under /dev/ based on the controller type and detection order.
SCSI/SATA/USB Disks (/dev/sd*)
Traditional SATA drives, SAS drives, and USB storage all appear as /dev/sda, /dev/sdb, /dev/sdc, and so on. The letter increments with each detected device. Partitions on these disks are numbered: /dev/sda1, /dev/sda2, /dev/sda3.
For MBR-partitioned disks, primary partitions are numbered 1 through 4. Logical partitions inside an extended partition always start at number 5, regardless of how many primary partitions exist.
NVMe Disks (/dev/nvme*)
NVMe SSDs use a different naming scheme. The controller is /dev/nvme0, the first namespace (think “disk”) on that controller is /dev/nvme0n1, and partitions are /dev/nvme0n1p1, /dev/nvme0n1p2, etc. A second NVMe controller would be /dev/nvme1.
VirtIO Disks (/dev/vd*)
Virtual machines running on KVM/QEMU with the VirtIO driver expose disks as /dev/vda, /dev/vdb, etc. Partitions follow the same pattern as SCSI: /dev/vda1, /dev/vda2. You will see these on every major cloud provider that runs KVM underneath.
You can always check what block devices the kernel sees with:
lsblk
That command gives you a tree view of all disks, partitions, and their mount points. It is one of the first commands you should run when troubleshooting storage.
2. Partition Tables: MBR vs GPT
Every disk needs a partition table before you can carve it into usable partitions. Linux supports two types, and the LPIC exam expects you to know both thoroughly.
MBR (Master Boot Record)
MBR has been around since 1983. The partition table lives in the first 512 bytes of the disk. Key limitations:
- Maximum disk size of 2 TiB (2,199,023,255,552 bytes)
- Maximum of 4 primary partitions
- To get more than 4 partitions, you sacrifice one primary slot for an extended partition, which then holds logical partitions
- No built-in redundancy for the partition table itself
MBR is still used on older systems, small disks, and legacy BIOS boot setups. If you are working with disks under 2 TiB and need BIOS boot compatibility, MBR works fine.
GPT (GUID Partition Table)
GPT is part of the UEFI specification and removes nearly every MBR limitation:
- Supports disks up to 9.4 ZB (zettabytes) in theory
- Up to 128 partitions by default (no need for extended/logical partitions)
- Each partition is identified by a unique GUID
- The partition table is stored at the beginning and end of the disk, providing redundancy
- Includes CRC32 checksums for integrity verification
Use GPT for any disk over 2 TiB, any UEFI system, and any new installation where you have no reason to stick with MBR. Modern Linux distributions default to GPT.
3. Partitioning with fdisk (MBR Disks)
fdisk is the classic interactive partitioning tool for MBR disks. Modern versions of fdisk can also handle GPT, but for the exam, associate fdisk with MBR and gdisk with GPT.
List all partitions on the system:
sudo fdisk -l
To work on a specific disk interactively:
sudo fdisk /dev/sdb
Once inside the fdisk prompt, these are the commands you need to memorize:
- p – Print the current partition table
- n – Create a new partition
- d – Delete a partition
- t – Change the partition type (e.g., 82 for Linux swap, 83 for Linux, 8e for Linux LVM)
- w – Write changes to disk and exit
- q – Quit without saving
- m – Display the help menu
Here is a typical workflow for creating a new primary partition. After running sudo fdisk /dev/sdb, you would press n for a new partition, p for primary, accept the default partition number, accept the default first sector, then type +10G to make it 10 GiB. Press w to write and exit.
After writing the partition table, inform the kernel about the changes:
sudo partprobe /dev/sdb
The partprobe command re-reads the partition table without requiring a reboot. On older kernels, you might need to use partx -a /dev/sdb instead.
4. Partitioning with gdisk (GPT Disks)
gdisk is the GPT counterpart to fdisk. The interface is deliberately similar, so if you know fdisk, you already know most of gdisk.
sudo gdisk /dev/sdc
Key commands inside gdisk:
- p – Print the partition table
- n – Create a new partition
- d – Delete a partition
- t – Change partition type code (uses GUID type codes like 8300 for Linux filesystem, 8200 for Linux swap, 8e00 for Linux LVM)
- i – Show detailed info about a partition
- w – Write changes and exit
- q – Quit without saving
Creating a partition in gdisk follows the same flow as fdisk. The main difference is the partition type codes. GPT type codes are four hex digits (like 8300) instead of the two-digit MBR codes (like 83).
One important gdisk feature: you can convert an MBR disk to GPT with the r (recovery) menu followed by f (load MBR and convert to GPT). Do this with extreme care on production systems and always have a backup.
5. Partitioning with parted (MBR and GPT)
parted handles both MBR and GPT disks and, unlike fdisk and gdisk, can resize partitions. This makes it the most versatile partitioning tool in the Linux toolkit.
Launch parted on a specific disk:
sudo parted /dev/sdd
Print the current partition layout:
(parted) print
Create a GPT partition table on a new disk:
(parted) mklabel gpt
For an MBR table, use mklabel msdos instead. Create a partition spanning from 1 MiB to 20 GiB:
(parted) mkpart primary ext4 1MiB 20GiB
Resize a partition (this is where parted shines):
(parted) resizepart 1 40GiB
Critical warning: parted writes changes immediately. There is no “write and quit” step like fdisk. Every command you run takes effect on the disk right away. Double-check your commands before pressing Enter.
You can also run parted in non-interactive (scripted) mode, which is useful for automation:
sudo parted -s /dev/sdd mkpart primary ext4 1MiB 20GiB
The -s flag suppresses the interactive prompts.
6. Creating Filesystems with mkfs
A partition without a filesystem is just raw space. The mkfs family of commands formats partitions with the filesystem of your choice. The LPIC exam covers four filesystem types in detail.
ext4
ext4 is the default filesystem on most Linux distributions. It is mature, well-tested, and handles general-purpose workloads reliably. Key features:
- Maximum volume size: 1 EiB
- Maximum file size: 16 TiB
- Journaling (metadata and optionally data)
- Extents-based allocation for reduced fragmentation
- Backward compatible with ext2 and ext3
- Online resizing (grow only)
Create an ext4 filesystem:
sudo mkfs.ext4 /dev/sdb1
Add a label during creation for easier identification:
sudo mkfs.ext4 -L "data_vol" /dev/sdb1
XFS
XFS is the default on RHEL/CentOS/Rocky Linux. It excels at handling large files and parallel I/O. Key features:
- Maximum volume size: 8 EiB
- Maximum file size: 8 EiB
- Excellent performance for large sequential writes
- Allocation groups allow parallel I/O operations
- Online resizing (grow only, cannot shrink)
- Online defragmentation with
xfs_fsr
Create an XFS filesystem:
sudo mkfs.xfs /dev/sdb2
If the partition already has a filesystem and you want to overwrite it:
sudo mkfs.xfs -f /dev/sdb2
Btrfs
Btrfs (B-tree filesystem) is a copy-on-write filesystem with advanced features. openSUSE uses it as the default. Key features:
- Maximum volume size: 16 EiB
- Built-in snapshots and subvolumes
- Transparent compression (zlib, lzo, zstd)
- Built-in RAID support (RAID 0, 1, 10)
- Online resizing (grow and shrink)
- Data and metadata checksumming
Create a Btrfs filesystem:
sudo mkfs.btrfs /dev/sdb3
vfat (FAT32)
vfat is the Linux implementation of Microsoft’s FAT32. You will use it for EFI System Partitions (ESP) and USB drives that need to work across operating systems. Key features:
- Maximum file size: 4 GiB
- Maximum volume size: 2 TiB (with 512-byte sectors)
- No file permissions, no journaling, no symlinks
- Universal cross-platform compatibility
Create a FAT32 filesystem:
sudo mkfs.vfat -F 32 /dev/sdb4
The -F 32 flag explicitly selects FAT32 rather than FAT12 or FAT16.
7. Mounting Filesystems
Creating a filesystem is only half the job. You need to mount it to make it accessible. Linux gives you several ways to handle this.
Manual Mounting with mount
Mount a filesystem to a directory:
sudo mount /dev/sdb1 /mnt/data
The mount point directory must exist before you mount. If it does not:
sudo mkdir -p /mnt/data
View all currently mounted filesystems:
mount | column -t
Or for a cleaner output, use findmnt which reads from /proc/self/mountinfo:
findmnt --real
Mount Options
The -o flag lets you specify mount options. These come up frequently on the exam:
- ro / rw – Mount read-only or read-write
- noexec – Prevent execution of binaries on this filesystem
- nosuid – Ignore SUID and SGID bits
- nodev – Ignore device files on this filesystem
- noatime – Do not update access times (improves performance)
- relatime – Update atime only if older than mtime (default on most distros)
- defaults – Equivalent to rw, suid, dev, exec, auto, nouser, async
Example mounting with multiple options:
sudo mount -o noexec,nosuid,nodev /dev/sdb1 /mnt/data
Remount an already-mounted filesystem with different options (no need to unmount first):
sudo mount -o remount,ro /mnt/data
UUID vs Device Name
Device names like /dev/sdb1 can change between reboots if you add or remove disks. The kernel assigns letters based on detection order, so what was /dev/sdb yesterday could become /dev/sdc today.
UUIDs solve this problem. Every filesystem gets a unique identifier when it is created, and that UUID never changes unless you reformat. Find the UUID with:
sudo blkid /dev/sdb1
Mount by UUID:
sudo mount UUID="a1b2c3d4-5678-9abc-def0-123456789abc" /mnt/data
Always use UUIDs in /etc/fstab for production systems. This is not just a best practice; it is a reliability requirement.
Persistent Mounts with /etc/fstab
The /etc/fstab file defines filesystems that should be mounted automatically at boot. Each line has six fields:
# <device/UUID> <mount point> <type> <options> <dump> <fsck order>
UUID=a1b2c3d4-5678-9abc-def0-123456789abc /mnt/data ext4 defaults 0 2
UUID=e5f6a7b8-1234-5678-9abc-def012345678 /mnt/backup xfs noatime,noexec 0 2
/dev/sdb3 /mnt/scratch btrfs defaults 0 0
The six fields explained:
- Device – UUID, device path, or LABEL
- Mount point – Where the filesystem appears in the directory tree
- Filesystem type – ext4, xfs, btrfs, vfat, swap, etc.
- Options – Mount options (defaults, noatime, noexec, etc.)
- Dump – Used by the dump backup utility (0 = skip, 1 = backup). Almost always 0 on modern systems.
- Fsck order – Order for filesystem checks at boot (0 = skip, 1 = root filesystem first, 2 = everything else)
After editing fstab, test it before rebooting:
sudo mount -a
This mounts everything in fstab that is not already mounted. If there is an error, you will see it immediately instead of discovering it during a reboot when the system drops to emergency mode.
8. Managing Swap Space
Swap provides overflow space when physical RAM is full. Linux supports two forms: swap partitions and swap files. The LPIC exam tests both.
Swap Partition
Create a partition with fdisk or gdisk and set its type to Linux swap (type 82 in fdisk, 8200 in gdisk). Then format and activate it:
sudo mkswap /dev/sdb5
Activate the swap partition:
sudo swapon /dev/sdb5
Verify it is active:
swapon --show
Add it to /etc/fstab for persistence across reboots:
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx none swap sw 0 0
Swap File
Swap files are more flexible than partitions because you can create and resize them without repartitioning. Create a 2 GiB swap file:
sudo dd if=/dev/zero of=/swapfile bs=1M count=2048
Set the correct permissions (swap files must not be world-readable):
sudo chmod 600 /swapfile
Format and enable:
sudo mkswap /swapfile
sudo swapon /swapfile
Add to fstab:
/swapfile none swap sw 0 0
To disable swap temporarily (useful before removing a swap file or partition):
sudo swapoff /swapfile
Swap partition vs swap file: Swap partitions have slightly less overhead because the kernel accesses them directly without going through a filesystem layer. Swap files are easier to manage and resize. For most workloads, the performance difference is negligible. Cloud instances and containers typically use swap files when swap is needed at all.
9. Logical Volume Management (LVM)
LVM adds a layer of abstraction between your physical disks and your filesystems. It lets you resize volumes, span multiple disks, and take snapshots without downtime. LVM is covered under LPIC-1 Objective 104.1 and is heavily tested.
LVM Architecture
LVM has three layers:
- Physical Volumes (PVs) – Raw partitions or whole disks initialized for LVM
- Volume Groups (VGs) – Pools of storage made from one or more PVs
- Logical Volumes (LVs) – Virtual partitions carved from a VG. These are what you format and mount.
Creating LVM Volumes
First, mark the partitions as LVM physical volumes. Make sure the partition type is set to 8e (fdisk) or 8e00 (gdisk) beforehand:
sudo pvcreate /dev/sdb1 /dev/sdc1
Verify your physical volumes:
sudo pvs
Create a volume group from these PVs:
sudo vgcreate vg_data /dev/sdb1 /dev/sdc1
Check the volume group:
sudo vgs
Create a logical volume. Allocate 50 GiB:
sudo lvcreate -L 50G -n lv_projects vg_data
Or allocate all remaining free space:
sudo lvcreate -l 100%FREE -n lv_projects vg_data
Note the lowercase -l for extents/percentage vs uppercase -L for absolute sizes. The logical volume device path will be /dev/vg_data/lv_projects (or equivalently /dev/mapper/vg_data-lv_projects).
Now format and mount:
sudo mkfs.ext4 /dev/vg_data/lv_projects
sudo mkdir -p /mnt/projects
sudo mount /dev/vg_data/lv_projects /mnt/projects
Extending LVM Volumes
This is where LVM really pays off. Extend a logical volume by 20 GiB:
sudo lvextend -L +20G /dev/vg_data/lv_projects
Then grow the filesystem to fill the new space. For ext4:
sudo resize2fs /dev/vg_data/lv_projects
For XFS (which uses a different tool):
sudo xfs_growfs /mnt/projects
Note that xfs_growfs takes the mount point as its argument, not the device path. You can combine the LV extend and filesystem resize in one command:
sudo lvextend -L +20G --resizefs /dev/vg_data/lv_projects
The --resizefs flag automatically detects the filesystem type and runs the appropriate resize tool.
Reducing LVM Volumes
Shrinking is more involved and riskier than growing. You must shrink the filesystem first, then shrink the LV. XFS cannot be shrunk at all.
For ext4, unmount the filesystem first, then run a filesystem check, shrink the filesystem, and finally shrink the LV:
sudo umount /mnt/projects
sudo e2fsck -f /dev/vg_data/lv_projects
sudo resize2fs /dev/vg_data/lv_projects 30G
sudo lvreduce -L 30G /dev/vg_data/lv_projects
Always shrink the filesystem to a size equal to or smaller than the target LV size. If you shrink the LV below the filesystem size, you will destroy data.
LVM Snapshots
Snapshots capture the state of an LV at a specific moment. They are copy-on-write, so they initially use very little space and grow as the original volume changes.
sudo lvcreate -s -L 5G -n snap_projects /dev/vg_data/lv_projects
The -s flag marks this as a snapshot. The 5G is the size of the snapshot space (how much change it can track before it fills up and becomes invalid). Mount the snapshot read-only to access the point-in-time copy:
sudo mount -o ro /dev/vg_data/snap_projects /mnt/snapshot
Remove a snapshot when you are done with it:
sudo lvremove /dev/vg_data/snap_projects
If you need to add more physical storage to a volume group later, add a new PV and extend the VG:
sudo pvcreate /dev/sdd1
sudo vgextend vg_data /dev/sdd1
10. Filesystem Maintenance
Filesystems need occasional maintenance. Corruption happens, performance degrades, and metadata gets stale. The LPIC exam expects you to know the right tool for each filesystem type.
fsck (Filesystem Check)
fsck is the front-end that calls the appropriate checker for each filesystem type. Never run fsck on a mounted filesystem. Unmount it first, or boot into single-user/rescue mode.
sudo umount /dev/sdb1
sudo fsck /dev/sdb1
For ext4 specifically, you can use e2fsck directly. The -f flag forces a check even if the filesystem appears clean:
sudo e2fsck -f /dev/sdb1
Add -p to automatically repair safe problems without prompting:
sudo e2fsck -fp /dev/sdb1
tune2fs (ext2/ext3/ext4 Tuning)
tune2fs adjusts tunable parameters on ext-family filesystems. Common uses:
View current filesystem parameters:
sudo tune2fs -l /dev/sdb1
Set a filesystem label:
sudo tune2fs -L "data_vol" /dev/sdb1
Adjust the reserved block percentage (by default 5% is reserved for root). On a large data volume where root does not need reserved space, reduce it:
sudo tune2fs -m 1 /dev/sdb1
Set the maximum mount count before a forced fsck:
sudo tune2fs -c 30 /dev/sdb1
Set the maximum time interval between filesystem checks:
sudo tune2fs -i 90d /dev/sdb1
dumpe2fs (ext Filesystem Info)
dumpe2fs dumps detailed information about an ext filesystem, including block group details, superblock locations, and feature flags:
sudo dumpe2fs /dev/sdb1 | head -50
For just the superblock info without the block group details, add -h:
sudo dumpe2fs -h /dev/sdb1
xfs_repair
XFS has its own repair tool. Like fsck, it must be run on an unmounted filesystem:
sudo umount /mnt/data
sudo xfs_repair /dev/sdb2
If the log is dirty (the filesystem was not cleanly unmounted), xfs_repair will refuse to run. Clear the log first:
sudo xfs_repair -L /dev/sdb2
The -L flag zeroes out the log. This may cause some data loss for transactions that were in the log, but it lets the repair proceed.
To view XFS filesystem information (similar to dumpe2fs for ext):
sudo xfs_info /mnt/data
11. Disk Usage and Block Device Information
Monitoring disk usage is a daily task for any sysadmin. The LPIC exam covers several tools for this.
df (Disk Free)
Show filesystem usage in human-readable format:
df -hT
The -h flag gives human-readable sizes (G, M, K). The -T flag shows the filesystem type. To check a specific mount point:
df -hT /mnt/data
Show inode usage instead of block usage (useful when you are running out of inodes on ext filesystems with lots of tiny files):
df -i
du (Disk Usage)
While df shows overall filesystem usage, du tells you which directories are consuming space. Show the total size of a directory:
du -sh /var/log
Show subdirectory sizes sorted by size (find the space hogs):
du -h --max-depth=1 /var | sort -hr
The -s flag summarizes (shows total only), and --max-depth controls how many levels deep to report.
lsblk (List Block Devices)
lsblk shows all block devices in a tree view:
lsblk
Show additional information like filesystem type, UUID, and size:
lsblk -f
The -f output includes the filesystem type, label, UUID, available space, and mount point all in one view. This is often faster than running multiple commands.
blkid (Block Device Attributes)
blkid shows UUID, filesystem type, and labels for block devices:
sudo blkid
Query a specific device:
sudo blkid /dev/sdb1
This is the command you will reach for most often when you need a UUID for an fstab entry.
12. LPIC-1 Exam Objectives Mapped
Here is how everything in this guide maps to the official LPIC-1 (101-500) exam objectives. Use this as a checklist for your study sessions.
102.1 – Design Hard Disk Layout
- Allocating filesystems and swap space to separate partitions or disks
- Tailoring the design to the intended use of the system
- Ensuring the /boot partition meets hardware architecture requirements for booting
- Knowledge of basic features of LVM
104.1 – Create Partitions and Filesystems
- Manage MBR and GPT partition tables
- Use various mkfs commands to create filesystems: ext2, ext3, ext4, XFS, VFAT, exFAT
- Basic feature knowledge of Btrfs (including subvolumes and snapshots)
- Key tools: fdisk, gdisk, parted, mkfs, mkswap
104.2 – Maintain the Integrity of Filesystems
- Verify the integrity of filesystems
- Monitor free space and inodes
- Repair simple filesystem problems
- Key tools: du, df, fsck, e2fsck, mke2fs, tune2fs, xfs_repair, xfs_fsr, xfs_db
104.3 – Control Mounting and Unmounting of Filesystems
- Manually mount and unmount filesystems
- Configure filesystem mounting on bootup
- Configure user-mountable, removable filesystems
- Use of labels and UUIDs for identifying and mounting filesystems
- Knowledge of systemd mount units
- Key files: /etc/fstab
- Key tools: mount, umount, blkid, lsblk
Quick Reference: Command Cheat Sheet
Use this table as a fast lookup during your study sessions:
| Task | Command |
|---|---|
| List all block devices | lsblk -f |
| Show UUIDs | sudo blkid |
| Partition MBR disk | sudo fdisk /dev/sdX |
| Partition GPT disk | sudo gdisk /dev/sdX |
| Create ext4 filesystem | sudo mkfs.ext4 /dev/sdX1 |
| Create XFS filesystem | sudo mkfs.xfs /dev/sdX1 |
| Mount a filesystem | sudo mount /dev/sdX1 /mnt/point |
| Check filesystem | sudo fsck /dev/sdX1 |
| Repair XFS | sudo xfs_repair /dev/sdX1 |
| Create swap | sudo mkswap /dev/sdX1 |
| Enable swap | sudo swapon /dev/sdX1 |
| Create PV | sudo pvcreate /dev/sdX1 |
| Create VG | sudo vgcreate vg_name /dev/sdX1 |
| Create LV | sudo lvcreate -L 10G -n lv_name vg_name |
| Extend LV + FS | sudo lvextend -L +5G --resizefs /dev/vg/lv |
| Disk free space | df -hT |
| Directory size | du -sh /path |
| Tune ext4 params | sudo tune2fs -l /dev/sdX1 |
Final Study Tips
A few practical pointers from someone who has taught this material to hundreds of exam candidates:
- Practice in a VM. Spin up a virtual machine with a few extra virtual disks. Run through every command in this guide at least twice. Muscle memory matters when you have 90 minutes on the clock.
- Know which tools go with which filesystem.
tune2fs,dumpe2fs,e2fsck, andresize2fsare for ext filesystems.xfs_repair,xfs_growfs,xfs_info, andxfs_fsrare for XFS. Mixing them up is a common exam trap. - Always use UUIDs in fstab. If an exam question asks about persistent mounting, the answer involves UUIDs or labels, not raw device paths.
- Remember the LVM hierarchy. PV goes into VG, VG gets carved into LVs. The commands follow the same naming pattern:
pvcreate,vgcreate,lvcreatefor creation;pvs,vgs,lvsfor listing;pvdisplay,vgdisplay,lvdisplayfor detailed info. - XFS cannot shrink. This comes up on the exam. You can grow an XFS filesystem online, but you cannot shrink it. If you need to make it smaller, you must back up, recreate, and restore.
- parted writes immediately. Unlike fdisk and gdisk, parted does not have a “write changes” step. Every command takes effect the moment you press Enter.
- Never fsck a mounted filesystem. This will show up as a wrong answer on the exam and will corrupt your data in real life.
Work through these topics methodically, practice each command on real (or virtual) disks, and you will walk into the LPIC-1 exam confident that partition and filesystem questions are free points.

























































