A Practical Guide: Expanding Disk Space on a RedHat Linux Server with SAN Storage
Expanding SAN Storage on Red Hat: The Definitive Guide to LVM & Multipath
Adding disk space to a production Red Hat server is a routine but high-stakes task. When your storage is delivered over a SAN (Storage Area Network) with multiple paths, you must coordinate between the Linux SCSI layer, the Multipath daemon, and the Logical Volume Manager (LVM).
⚠️ Production Safety: Read Before Proceeding
In a production environment, one wrong device name can lead to catastrophic data loss.
Identify the Correct Path: Never run
pvcreateon a raw SCSI path (like/dev/sdb) if the disk is part of a multipath setup. Always use the multipath map (e.g.,/dev/mapper/mpathXor/dev/dm-X).Backup LVM Metadata: Before modifying your Volume Group, run
vgcfgbackup <VG_NAME>. This stores a recovery layout in/etc/lvm/backup/.Verify with
blkid: Ensure the new disk/LUN is truly empty before initializing it. Ifblkidreturns a UUID, that disk already contains data.
Step 1: Storage Discovery (Hardware Layer)
To see the new LUN provided by the SAN team without rebooting, we use the sg3_utils package.
1. Install the Utilities
yum install sg3_utils
2. Rescan the SCSI Bus
Monitor the kernel logs in one terminal while running the scan in another to confirm the new paths are detected.
# Terminal 1: Watch the logs
tail -f /var/log/messages
# Terminal 2: Trigger the scan
rescan-scsi-bus.sh -r -i -s
Note: The -s flag is essential for detecting size changes on existing LUNs.
Step 2: Initialize and Extend LVM
Once the OS detects the device (we will use /dev/dm-28 as per your notes), we move into LVM management.
1. Create the Physical Volume (PV)
Caution: Ensure you are targeting the correct DM (Device Mapper) node.
pvcreate /dev/dm-28
Verify with pvscan or pvs.
2. Extend the Volume Group (VG)
We add the new Physical Volume to the existing group (e.g., VG-SG-PI-DPI01).
vgextend VG-SG-PI-DPI01 /dev/dm-28
3. Expand the Logical Volume (LV)
You can use the exact number of Free Physical Extents (PE) shown in vgdisplay. In your example, this was 12799.
lvextend -l +12799 /dev/VG-SG-PI-DPI01/lv-sg-pi-dpi01
Pro-Tip: In modern RHEL versions, you can use
lvextend -r -l +100%FREE <path>. The-rflag automatically resizes the underlying filesystem for you safely.
Step 3: Filesystem Expansion
The final step is to grow the filesystem to fill the newly enlarged Logical Volume.
For ext3/ext4 Filesystems:
Use resize2fs. This is an online operation and does not require unmounting.
# Syntax: resize2fs [Device_Path]
resize2fs /dev/VG-SG-PI-DPI01/lv-sg-pi-dpi01
For XFS Filesystems (RHEL 7/8/9):
If your server uses XFS, resize2fs will not work. Use xfs_growfs.
# Syntax: xfs_growfs [Mount_Point]
xfs_growfs /sg-pi-dpi01
Step 4: Final Verification
Always confirm the expansion was successful at the OS level:
df -h
| Command | Purpose | Production Risk |
rescan-scsi-bus.sh | Detects new hardware | Low (unless -i causes a reset) |
pvcreate | Formats disk for LVM | High (can overwrite data) |
lvextend | Increases LV size | Low (but hard to shrink later) |
resize2fs | Expands filesystem | Medium (always have a backup/snapshot) |
Comments