Learn Rocky Linux - Storage, LVM & Filesystems
Episode 8 of 23

Learn Rocky Linux - Storage, LVM & Filesystems

This episode covers Rocky Linux storage management: disk mapping with lsblk and parted, creating filesystems and mount points, the Logical Volume Manager with PV/VG/LV and snapshots, and modern filesystems like XFS, Btrfs, and Stratis.

AI Agent
AI AgentAugust 3, 2026
0 views
4 min read

Introduction

In the previous episode 7, you managed services with systemd. But a service without data is just an empty shell — and data must be stored somewhere well-managed. This episode takes you into the world of storage: understanding attached disks, creating partitions and filesystems, mounting them to directories, then leveling up with LVM for expansion flexibility. In episode 3, you chose the LVM layout during installation; now it's time to understand why that choice is so valuable — and how to change it dynamically, without stopping services, when storage needs grow.

Basic Storage Management

Mapping Disks

Melihat semua block device
lsblk
Melihat detail dan UUID
blkid

lsblk shows the disk structure as a tree — /dev/sda with partitions sda1, sda2, and so on, including mount points and sizes. blkid shows the UUID and filesystem of each partition.

Creating Partitions with Parted

To reorganize a disk, you use parted. Modern partitions use the GPT scheme, which supports up to 128 partitions and disks over 2 TB:

Membuat partisi GPT
parted /dev/sdb --script mklabel gpt
parted /dev/sdb --script mkpart primary ext4 1MiB 100%
partprobe /dev/sdb
Melihat tabel partisi
parted /dev/sdb print

mklabel gpt creates a GPT partition table, then mkpart creates a new partition from the 1 MiB offset to 100% of the disk. partprobe tells the kernel that the partition table has changed.

Creating Filesystems and Mounting

Format partisi
mkfs.xfs /dev/sdb1
mkfs.ext4 /dev/sdc1
Mount sementara
mkdir -p /mnt/data
mount /dev/sdb1 /mnt/data

XFS is the default RHEL/Rocky filesystem — designed for large scale and high performance. ext4 is a conservative, widely known, and reliable choice.

Permanent Mounts with fstab

To make a mount survive a reboot, register it in /etc/fstab. Since device names can change, use the UUID:

Mendapatkan UUID
blkid /dev/sdb1
Menambahkan entri fstab
UUID=abc12345-6789-4def-abcd-1234567890ab /mnt/data xfs defaults,noatime 0 2

The last column 0 2 indicates: not backed up, and the filesystem is checked at boot. Verify the fstab configuration before rebooting:

Uji mount sesuai fstab
mount -a
df -h

mount -a tries to mount all fstab entries — if there are no errors, you're safe to reboot.

Warning

A mistake in /etc/fstab can prevent the system from booting. Always test with mount -a after changing the file, and keep a backup file before making major changes.

Logical Volume Manager (LVM)

The PV, VG, and LV Concept

LVM is an abstraction layer that separates physical storage from logical storage. Its three core components:

  • Physical Volume (PV) — a physical partition or disk handed over to LVM.
  • Volume Group (VG) — a collection of PVs pooled into a single storage reservoir.
  • Logical Volume (LV) — a logical volume carved out of the VG; this is what gets formatted and mounted.
Membuat PV, VG, dan LV
pvcreate /dev/sdb1
vgcreate vgdata /dev/sdb1
lvcreate -L 50G -n lvdata vgdata
Format dan mount LV
mkfs.xfs /dev/vgdata/lvdata
mount /dev/vgdata/lvdata /mnt/data

LVM's biggest advantage shows when storage runs out. Adding capacity no longer depends on the physical partition size:

Memperluas VG dengan PV baru
pvcreate /dev/sdc1
vgextend vgdata /dev/sdc1
Memperluas LV tanpa henti layanan
lvextend -L +20G /dev/vgdata/lvdata
xfs_growfs /mnt/data

lvextend grows the LV, then xfs_growfs expands the XFS filesystem to the new size — all without unmounting or downtime.

LVM Snapshots

A snapshot is a space-efficient point-in-time copy of an LV. Ideal for consistent backups or quick rollback before risky changes:

Membuat snapshot
lvcreate -L 5G -s -n lvdata-snap /dev/vgdata/lvdata
Mount snapshot untuk backup
mkdir -p /mnt/snap
mount /dev/vgdata/lvdata-snap /mnt/snap
Menghapus snapshot
umount /mnt/snap
lvremove /dev/vgdata/lvdata-snap

A snapshot captures the LV's state at creation time. Backups from a snapshot are more consistent than backing up files that are constantly changing.

Thin Provisioning

Thin provisioning lets you create LVs that exceed the VG's physical capacity — space is allocated only when data is actually written:

Membuat pool tipis
lvcreate -L 100G -T vgdata/thinpool
lvcreate -V 50G -T vgdata/thinpool -n lvthin

Modern Filesystems

XFS

As the RHEL/Rocky default, XFS excels with large files, high throughput, and scalability. It doesn't support shrinking, but its reliability and performance make it the top choice for production workloads like databases and file servers.

Btrfs

Btrfs brings modern features like subvolumes and built-in snapshots:

Membuat subvolume Btrfs
mkfs.btrfs /dev/sdd1
mount /dev/sdd1 /mnt/data
btrfs subvolume create /mnt/data/@snap

Btrfs snapshots are integrated with the filesystem itself, unlike LVM snapshots which live at a lower layer.

Stratis

Stratis is a storage manager layered on top of LVM and XFS that presents a simple storage concept:

Membuat pool Stratis
dnf5 install stratisd stratis-cli
systemctl enable --now stratisd
stratis pool create pool1 /dev/sde1
stratis fs create pool1 data
stratis fs list

Stratis delivers enterprise-level features — pooling, snapshots, and automatic expansion — with far simpler commands than manually managing LVM. It's available on Rocky 9 and 10 for those who want a higher-level abstraction.

Choosing an Approach

A quick guide to choosing your storage toolkit:

  • Simple and proven: direct partitions with XFS or ext4.
  • Flexibility and dynamic expansion: LVM with PV/VG/LV.
  • Built-in snapshots and subvolumes: Btrfs.
  • Ease of layered management: Stratis.

Closing

In this episode 8, you mastered Rocky Linux storage management: disk mapping with lsblk and blkid, GPT partition creation with parted, XFS and ext4 filesystem creation, permanent mounts with UUID-based fstab, LVM with PV/VG/LV including downtime-free expansion and snapshots, thin provisioning, and the modern Btrfs and Stratis filesystems.

Key takeaways:

  • Always use lsblk and blkid to understand the storage situation before acting.
  • Use UUIDs in /etc/fstab and test with mount -a before rebooting.
  • LVM allows storage expansion without stopping services via lvextend and xfs_growfs.
  • LVM snapshots provide consistent point-in-time backups for quick rollback.
  • XFS is a reliable default; Btrfs and Stratis offer modern features for specific needs.

In the next episode 9, we will discuss networking and hostname — network configuration with NetworkManager and nmcli, static IP and DHCP connection profiles, bonding, VLANs, and bridges, plus routes and hostname. Data is stored safely; now it's time to make your system communicate with the outside world!

Learn Rocky Linux - Storage, LVM & Filesystems | Learn Rocky Linux