RHEL 10 Storage Administration Tutorial for Beginners
Beginner RHEL 10 storage lab: lsblk, parted, LVM, XFS, fstab with UUIDs, swap, lvextend -r, snapshots and Stratis, with a troubleshooting table.
Storage administration on RHEL 10 follows one path: identify the disk with lsblk, partition it with parted, create LVM physical volumes, a volume group and logical volumes, format them with XFS, mount them persistently through /etc/fstab using UUIDs, and grow them later with lvextend -r. XFS is the default file system and can grow but cannot shrink.
This tutorial is a hands-on lab for beginners and part of our RHEL 10 series, which starts with setting up RHEL 10 for the first time. You will add a new disk to a virtual machine and take it from raw device to a mounted, resizable file system, plus swap and a quick look at Stratis. Use a lab VM with a spare disk; every command here can destroy data if you point it at the wrong device. Commands follow Red Hat's RHEL 10 storage, LVM and file system guides.
Key takeaways
- Always confirm the device name with
lsblkbefore partitioning. Names such as/dev/vdbor/dev/nvme1n1can change between boots, so fstab uses UUIDs. - GPT is the normal partition table today. Use parted (or the web console) to create it.
- LVM adds a layer between partitions and file systems so you can grow volumes and add disks without repartitioning.
- XFS grows online but cannot shrink. If you need to shrink, plan for ext4 or for backup and recreate.
- After editing fstab, run
findmnt --verifyandmount -abefore you reboot.
The storage stack in one table
| Layer | Example | Main commands |
|---|---|---|
| Block device | /dev/vdb | lsblk, blkid |
| Partition | /dev/vdb1 | parted, fdisk |
| Physical volume (PV) | /dev/vdb1 marked for LVM | pvcreate, pvs |
| Volume group (VG) | vgdata | vgcreate, vgextend, vgs |
| Logical volume (LV) | /dev/vgdata/lvapp | lvcreate, lvextend, lvs |
| File system | XFS on the LV | mkfs.xfs, xfs_growfs, xfs_info |
| Mount point | /srv/app | mount, findmnt, /etc/fstab |
If you want the theory of how partitions and LVM relate before the lab, read how LVM and disk partitioning work together.
Step 1: Find the new disk
lsblk
lsblk -f # adds file system type, label and UUID
sudo blkid # UUIDs and types for formatted devices
A new, empty disk shows no partitions and no file system type. In this lab it is /dev/vdb with 20 GB. On your machine it might be /dev/sdb or /dev/nvme1n1. Replace the name in every command below.
Step 2: Create a GPT partition table and partitions
parted applies changes immediately, so there is no "write" step to forget.
sudo parted /dev/vdb mklabel gpt
sudo parted /dev/vdb mkpart data 1MiB 15GiB
sudo parted /dev/vdb set 1 lvm on
sudo parted /dev/vdb mkpart swap linux-swap 15GiB 17GiB
sudo parted /dev/vdb print
# Tell udev to process the new partitions
sudo udevadm settle
lsblk /dev/vdb
Starting at 1MiB keeps the partition aligned. The lvm flag is a label for humans and tools; LVM works without it, but it documents intent. You now have /dev/vdb1 for LVM and /dev/vdb2 for swap.
Step 3: Build LVM on the partition
# Mark the partition as a physical volume
sudo pvcreate /dev/vdb1
# Create a volume group from it
sudo vgcreate vgdata /dev/vdb1
# Create logical volumes
sudo lvcreate -n lvapp -L 8G vgdata
sudo lvcreate -n lvlogs -l 50%FREE vgdata
# Check the result
sudo pvs
sudo vgs
sudo lvs
-L takes an absolute size, and -l takes extents or a percentage such as 50%FREE. Keeping some free space in the volume group lets you grow any LV later without adding a disk.
Step 4: Create file systems
sudo mkfs.xfs /dev/vgdata/lvapp
sudo mkfs.xfs -L logs /dev/vgdata/lvlogs
sudo xfs_info /dev/vgdata/lvapp # works once mounted, or on the device
XFS is the default on RHEL. ext4 is also available with mkfs.ext4 and is the choice when you know a volume may need shrinking.
| Need | XFS | ext4 |
|---|---|---|
| Default on RHEL 10 | Yes | No |
| Grow while mounted | Yes (xfs_growfs) | Yes (resize2fs) |
| Shrink | No | Yes, unmounted |
| Repair tool | xfs_repair | e2fsck |
Step 5: Mount, then make it persistent
sudo mkdir -p /srv/app /var/log/app
sudo mount /dev/vgdata/lvapp /srv/app
findmnt /srv/app
df -h /srv/app
A manual mount disappears at reboot. Add entries to /etc/fstab. For LVM you can use the stable /dev/vgname/lvname path; for plain partitions use the UUID from blkid.
# <device> <mount point> <type> <options> <dump> <fsck>
/dev/vgdata/lvapp /srv/app xfs defaults 0 0
UUID=3f1c...-example /var/log/app xfs defaults,nofail 0 0
# Check syntax and that every device exists
sudo findmnt --verify
# Ask systemd to re-read fstab, then mount everything listed
sudo systemctl daemon-reload
sudo mount -a
findmnt -s
The nofail option lets the system boot even if that device is missing, which is useful for secondary data disks. A typo in fstab without it can drop the system into emergency mode, so always run the checks above before rebooting.
SELinux labels on new mount points
If a service such as httpd will read the new mount, give it the right SELinux context. For example, sudo semanage fcontext -a -t httpd_sys_content_t "/srv/app(/.*)?" followed by sudo restorecon -Rv /srv/app. Our SELinux beginner guide explains contexts.
Step 6: Add swap
sudo mkswap /dev/vdb2
sudo swapon /dev/vdb2
swapon --show
free -h
# Persist it (use the UUID that mkswap printed)
echo 'UUID=<swap-uuid> none swap defaults 0 0' | sudo tee -a /etc/fstab
You can also create swap on a logical volume (lvcreate -n lvswap -L 2G vgdata), which makes it resizable.
Step 7: Grow a volume
The application needs more space. Extend the LV and the file system in one command with -r (resize file system):
sudo lvextend -r -L +2G /dev/vgdata/lvapp
df -h /srv/app
Without -r, you would run sudo xfs_growfs /srv/app afterwards. XFS grows using the mount point.
When the volume group is full
Add a disk, make it a PV, and extend the VG:
sudo pvcreate /dev/vdc
sudo vgextend vgdata /dev/vdc
sudo vgs
sudo lvextend -r -l +100%FREE /dev/vgdata/lvlogs
Using a whole disk as a PV without a partition table is allowed, but a GPT partition makes the disk's purpose visible to other tools and admins.
Step 8: Snapshots before risky changes
An LVM snapshot captures an LV at a point in time, which is handy before an upgrade:
sudo lvcreate -s -n lvapp_snap -L 1G /dev/vgdata/lvapp
sudo lvs
# If the change went badly, merge back (takes effect on next activation)
sudo lvconvert --merge /dev/vgdata/lvapp_snap
# If it went well, remove the snapshot
sudo lvremove /dev/vgdata/lvapp_snap
A classic snapshot fills as the origin changes. If it reaches 100 percent it becomes invalid, so size it for the expected change and monitor it with lvs. Snapshots are not backups; they live on the same disks.
Thin provisioning with LVM
A thin pool lets you create logical volumes whose total size is larger than the space you have, and allocates blocks only as data is written. It is useful for labs and for many small volumes that rarely fill up.
# Create a 5 GB thin pool, then a 10 GB thin volume inside it
sudo lvcreate --type thin-pool -L 5G -n tpool vgdata
sudo lvcreate --type thin -V 10G --thinpool tpool -n lvthin vgdata
sudo lvs -a vgdata
Watch the Data% and Meta% columns in lvs. If the pool fills, writes to every thin volume in it fail, so set monitoring or the autoextend thresholds in /etc/lvm/lvm.conf (thin_pool_autoextend_threshold and thin_pool_autoextend_percent) and keep free space in the volume group.
Labels or UUIDs?
Both are stable identifiers for fstab. A UUID is assigned when the file system is created and is unique, but hard to read. A label is a name you choose, which is easier to recognise, but you must keep labels unique across disks.
# Set an XFS label (file system must be unmounted)
sudo umount /var/log/app
sudo xfs_admin -L applogs /dev/vgdata/lvlogs
sudo blkid /dev/vgdata/lvlogs
Then use LABEL=applogs in the first fstab column. The RHCSA objectives accept mounting by UUID or label.
Checking disk usage day to day
| Question | Command |
|---|---|
| How full is each mounted file system? | df -hT |
| Are inodes running out? | df -i |
| Which directories are largest? | sudo du -xh --max-depth=1 /var | sort -h |
| How much free space is left in each VG? | sudo vgs (VFree column) |
| Which devices back each LV? | sudo lvs -o +devices |
| What is mounted where, as a tree? | findmnt |
The -x option keeps du on one file system so it does not wander into other mounts. For alerting, export file system metrics with node_exporter and alert on the trend rather than on a single threshold.
Managing storage in the web console
RHEL includes the web console (Cockpit). After sudo dnf install cockpit cockpit-storaged and sudo systemctl enable --now cockpit.socket, browse to port 9090 on the server. The Storage page can create partition tables, volume groups, logical volumes and file systems, and it shows the same objects you created on the command line. It is handy for checking your work visually, but learn the commands first, because exams and automation use them.
A quick look at Stratis
RHEL 10 documentation includes Stratis, a local storage manager that builds pools from block devices and creates thin-provisioned file systems formatted with XFS. Stratis file systems appear under /dev/stratis/<pool>/<fs>.
sudo dnf install stratisd stratis-cli
sudo systemctl enable --now stratisd
sudo stratis pool create pool1 /dev/vdd
sudo stratis filesystem create pool1 fs1
sudo stratis filesystem list
Red Hat notes that Stratis tracks its own metadata, so change Stratis file systems with stratis commands rather than XFS tools. In fstab, Stratis mounts need the x-systemd.requires=stratisd.service option. For most exam and production work, LVM with XFS remains the main skill.
Cleaning up the lab safely
Removing storage is the reverse of creating it. Doing it in order avoids "device busy" errors and leftover signatures that confuse later labs.
- Stop anything using the mount:
sudo fuser -vm /srv/applists processes. - Unmount:
sudo umount /srv/app /var/log/app. - Remove the matching lines from
/etc/fstab, then runsudo systemctl daemon-reload. - Turn off swap with
sudo swapoff /dev/vdb2and remove its fstab line. - Remove the logical volumes, the volume group and the physical volume.
- Wipe remaining signatures so the disk looks new.
sudo lvremove vgdata/lvapp vgdata/lvlogs
sudo vgremove vgdata
sudo pvremove /dev/vdb1
sudo wipefs -a /dev/vdb
Skipping the fstab step is the most common reason a lab VM fails to boot the next day, so do it before you remove the volumes.
Troubleshooting checklist
| Symptom | Check | Fix |
|---|---|---|
| New partition not visible | lsblk | udevadm settle or partprobe |
| Boot drops to emergency mode | journalctl -xb | Correct the fstab line, add nofail for optional disks |
| "No space" but df shows space | df -i | Inodes exhausted; remove small files or recreate with more inodes |
| lvextend says insufficient extents | vgs | Add a PV with vgextend |
| Service denied access to new mount | ausearch -m avc -ts recent | Set the SELinux context and run restorecon |
| Need to shrink an XFS volume | xfs_info | Back up, recreate smaller, restore |
How this maps to the RHCSA exam
The RHCSA objectives include creating and deleting partitions, PVs, VGs and LVs, adding swap non-destructively, mounting file systems at boot by UUID or label, and extending LVs. This lab covers all of them. Our RHCSA on RHEL 10 complete guide lists the full objective set, and network storage is covered in configuring NFS on RHEL 10. Once storage is in place, the next admin skill is running services on it; see managing services and processes in RHEL 10.
Frequently asked questions
What is the default file system in RHEL 10?
XFS. It supports large file systems and online growth. It cannot be shrunk, so use ext4 for volumes you may need to reduce.
Should I use parted or fdisk on RHEL 10?
Both work with GPT. parted writes changes immediately and is easy to script; fdisk is interactive and only writes when you press w. Pick one and confirm the device name with lsblk first.
How do I extend a logical volume and its file system together?
Run lvextend -r -L +SIZE /dev/vg/lv. The -r option resizes the file system after the LV grows, so you do not need a separate xfs_growfs.
Why use UUIDs in /etc/fstab?
Kernel device names such as /dev/sdb can change when disks are added or reordered. UUIDs stay with the file system. LVM paths like /dev/vg/lv are also stable.
How do I test fstab without rebooting?
Run findmnt --verify, then systemctl daemon-reload and mount -a. Fix any error before you reboot.
Can I shrink an XFS file system?
No. Back up the data, create a smaller file system, and restore. ext4 supports shrinking while unmounted.
Is Stratis a replacement for LVM?
Stratis offers pooled, thin-provisioned XFS file systems with simpler commands. LVM is still the more widely used and examined tool, so learn LVM first.
Learn it with guided labs
Storage is one of the heaviest topics in our RHCSA training, run in the Kharadi, Pune classroom and live online. You can also review how /mnt and /media are used for removable devices.
References
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0