RHCSA Storage Management & Disk Operations
π 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! π