RHCSA Storage Management & Disk Operations

Expertise in Cloud, Networking & DevOps
Photo by imgix / Unsplash

πŸ“Œ Introduction

Storage management is a fundamental aspect of system administration, ensuring efficient data organization, performance, and scalability. The RHCSA exam tests knowledge of Logical Volume Management (LVM), mounting storage, and NFS integration. This guide provides a hands-on approach to mastering these skills.


πŸ“– What You’ll Learn in This Guide

πŸ”Ή Creating, managing, and resizing LVM volumes

πŸ”Ή Mounting and configuring storage devices

πŸ”Ή Setting up and troubleshooting NFS (Network File System)

πŸ”Ή Optimizing and monitoring disk usage


πŸ›  Logical Volume Management (LVM)

1️⃣ Understanding LVM Components

LVM provides flexibility in managing storage. It consists of:

  • Physical Volume (PV): Physical disk or partition
  • Volume Group (VG): Group of PVs pooled together
  • Logical Volume (LV): Virtual partitions created from VGs

2️⃣ Creating an LVM Setup

Step 1: Create Physical Volumes

sudo pvcreate /dev/sdb /dev/sdc  # Initialize disks as physical volumes

Step 2: Create a Volume Group

sudo vgcreate my_vg /dev/sdb /dev/sdc  # Create a volume group from PVs

Step 3: Create a Logical Volume

sudo lvcreate -L 10G -n my_lv my_vg  # Create a 10GB logical volume

Step 4: Format and Mount the LV

sudo mkfs.xfs /dev/my_vg/my_lv  # Format LV with XFS
sudo mkdir /mnt/my_storage  # Create mount directory
sudo mount /dev/my_vg/my_lv /mnt/my_storage  # Mount LV

To make the mount permanent, add this line to /etc/fstab:

/dev/my_vg/my_lv /mnt/my_storage xfs defaults 0 0

πŸ” Best Practice: Use lsblk to verify disk layout and mounted partitions:

lsblk -f

πŸš€ Resizing LVM Volumes

1️⃣ Extending a Logical Volume

Increase the size of an existing LV:

sudo lvextend -L +5G /dev/my_vg/my_lv  # Add 5GB to LV
sudo xfs_growfs /mnt/my_storage  # Resize the filesystem (for XFS)

2️⃣ Reducing a Logical Volume

Reducing LV size (for ext4 file system):

sudo umount /mnt/my_storage  # Unmount LV before resizing
sudo e2fsck -f /dev/my_vg/my_lv  # Check filesystem integrity
sudo resize2fs /dev/my_vg/my_lv 10G  # Resize filesystem first
sudo lvreduce -L 10G /dev/my_vg/my_lv  # Reduce LV size
sudo mount /dev/my_vg/my_lv /mnt/my_storage  # Remount the LV

πŸ” Best Practice: Always back up data before resizing a volume.


πŸ”— Mounting Storage Devices

1️⃣ Listing Available Storage Devices

lsblk -f  # List block devices and file systems
fdisk -l  # View disk partitions

2️⃣ Mounting a New Disk

Step 1: Format the Disk

sudo mkfs.ext4 /dev/sdd  # Format disk with ext4 filesystem

Step 2: Create a Mount Point

sudo mkdir /mnt/data_disk  # Create mount directory

Step 3: Mount the Disk

sudo mount /dev/sdd /mnt/data_disk  # Mount the disk

To make it persistent across reboots, add this to /etc/fstab:

/dev/sdd /mnt/data_disk ext4 defaults 0 0

πŸ” Best Practice: Use UUID instead of device names in /etc/fstab to avoid mount failures:

blkid /dev/sdd  # Find the UUID of the device

πŸ“‘ Configuring NFS (Network File System)

1️⃣ Installing NFS Server

sudo dnf install -y nfs-utils  # Install NFS utilities
sudo systemctl enable --now nfs-server  # Start and enable NFS service

2️⃣ Configuring NFS Exports

Edit /etc/exports and add:

/mnt/nfs_share 192.168.1.0/24(rw,sync,no_root_squash)

Apply changes:

sudo exportfs -arv

3️⃣ Mounting NFS on a Client Machine

Step 1: Install NFS Client

sudo dnf install -y nfs-utils  # Install NFS client utilities

Step 2: Mount the NFS Share

sudo mount -t nfs 192.168.1.100:/mnt/nfs_share /mnt/nfs_client  # Mount NFS share

To make the mount persistent, add this to /etc/fstab:

192.168.1.100:/mnt/nfs_share /mnt/nfs_client nfs defaults 0 0

πŸ” Best Practice: Use showmount -e <NFS-server-IP> to verify available exports:

showmount -e 192.168.1.100

πŸ›  Essential Practice for RHCSA

βœ… Create and manage LVM partitions

βœ… Mount and format storage devices

βœ… Configure persistent storage mounts

βœ… Set up and troubleshoot NFS server & client

βœ… Optimize disk usage and resize logical volumes


πŸ“Œ Next Article: RHCSA User & Group Management

πŸ“© Subscribe to our blog for more RHCSA tutorials and updates! πŸš€

Read more