← Back to Dashboard

LVM Setup and Persistent UUID Mounting

Complete workflow for disk initialization, volume management, and permanent fstab configuration.

PHASE 1

Initializing LVM

LVM allows you to treat physical disks as flexible pools of storage rather than fixed partitions.

1. Create Physical Volume (PV)

sudo pvcreate /dev/xvdb

2. Create Volume Group (VG)

sudo vgcreate vg_data /dev/xvdb

3. Create Logical Volume (LV)

sudo lvcreate -l 100%FREE -n lv_storage vg_data
PHASE 2

Formatting & Mount Points

Choose XFS for modern RHEL/Rocky systems, or ext4 for legacy compatibility.

4. Format the Volume

# For XFS (Recommended)
sudo mkfs.xfs /dev/vg_data/lv_storage

# For ext4
sudo mkfs.ext4 /dev/vg_data/lv_storage

5. Create Mount Point

sudo mkdir -p /mnt/data
PHASE 3

Permanent UUID Configuration

Vim Shortcut: While editing /etc/fstab, use :r !blkid /dev/vg_data/lv_storage to pull the UUID directly into the file without typos.
Filesystem fstab Entry Example
XFS UUID=[ID] /mnt/data xfs defaults 0 0
ext4 UUID=[ID] /mnt/data ext4 defaults 0 2

Phase 4: Critical Verification

Never reboot without testing. A typo in fstab can prevent the system from booting into the UI/Shell.

# Attempt to mount all filesystems in fstab
sudo mount -a

# If no errors appear, verify with:
df -hT | grep data

Summary of Commands

Action XFS Command ext4 Command
Format mkfs.xfs mkfs.ext4
Resize xfs_growfs resize2fs
Check xfs_repair fsck.ext4