Storage and LVM

Linux/RHEL notes for disks, filesystems, mounts, /etc/fstab, and LVM.

Use this page when checking disk usage, mounted filesystems, block devices, filesystem UUIDs, or LVM layout.


Basic disk checks

Show disk usage

df -h

Shows mounted filesystems and how much space is used.

Useful when checking if a server or filesystem is full.


Show filesystem type

df -Th

Show folder size

du -sh /path/to/folder

Example:

du -sh /var/log

Show largest folders inside a path

sudo du -h --max-depth=1 /path | sort -h

Example:

sudo du -h --max-depth=1 /var | sort -h

Block devices

Show block devices

lsblk

Show filesystems with lsblk

lsblk -f

Show UUIDs

blkid

Show mounted filesystems

mount

Cleaner view:

findmnt

Show one mount point

findmnt /mount/point

Example:

findmnt /

Filesystem checks

Check filesystem type

df -T /mount/point

Example:

df -T /

Check disk/inode usage

df -h
df -i

df -i is useful when disk space is free but the system says no space is left. It may be out of inodes.


Show open deleted files

sudo lsof | grep deleted

This is useful when space is not freed after deleting large files. A process may still have the deleted file open.


Mounting

Mount a filesystem

sudo mount /mount/point

This works if the mount exists in /etc/fstab.


Mount a device manually

sudo mount /dev/DEVICE /mount/point

Example:

sudo mount /dev/sdb1 /mnt/data

Unmount a filesystem

sudo umount /mount/point

If it says the target is busy, check what is using it:

sudo lsof +f -- /mount/point

or:

sudo fuser -vm /mount/point

/etc/fstab

/etc/fstab controls filesystems that should mount automatically.

View fstab

cat /etc/fstab

Test fstab without rebooting

sudo mount -a

Be careful. If /etc/fstab is wrong, boot can be affected.


Example fstab line

UUID=xxxx-xxxx  /mnt/data  xfs  defaults  0  0

Common fields:

device/UUID   mountpoint   filesystem   options   dump   fsck

LVM basics

LVM means Logical Volume Manager.

Basic structure:

Physical Volume  โ†’  Volume Group  โ†’  Logical Volume  โ†’  Filesystem  โ†’  Mount point
PV               โ†’  VG            โ†’  LV              โ†’  XFS/ext4     โ†’  /data

Physical volumes

Show physical volumes

sudo pvs

More detail:

sudo pvdisplay

Volume groups

Show volume groups

sudo vgs

More detail:

sudo vgdisplay

Logical volumes

Show logical volumes

sudo lvs

More detail:

sudo lvdisplay

Show LVM tree

lsblk

Useful because it shows the relation between disk, partition, LVM, and mount point.


Extend LVM filesystem

Basic flow:

1. Check current disk/filesystem
2. Check free space in VG
3. Extend LV
4. Grow filesystem
5. Verify

Check current size

df -h
lsblk
sudo lvs
sudo vgs

Extend logical volume

Example: add 10 GB:

sudo lvextend -L +10G /dev/VG_NAME/LV_NAME

Example: use all free space in the VG:

sudo lvextend -l +100%FREE /dev/VG_NAME/LV_NAME

Grow XFS filesystem

RHEL commonly uses XFS.

sudo xfs_growfs /mount/point

Example:

sudo xfs_growfs /

Grow ext4 filesystem

sudo resize2fs /dev/VG_NAME/LV_NAME

One-command LV extend and filesystem grow

Sometimes this works:

sudo lvextend -r -L +10G /dev/VG_NAME/LV_NAME

The -r option attempts to resize the filesystem too.

Still verify after:

df -h
sudo lvs

Dangerous storage actions

Be very careful with:

mkfs
fdisk
parted
wipefs
lvremove
vgremove
pvremove
dd
umount on production filesystems
editing /etc/fstab

These can destroy data or break boot/mounts.


First commands for disk issues

hostnamectl
df -h
df -i
lsblk
lsblk -f
findmnt
sudo pvs
sudo vgs
sudo lvs
sudo du -h --max-depth=1 /var | sort -h
sudo lsof | grep deleted

Disk full troubleshooting flow

1. Which filesystem is full?
2. Is it disk space or inodes?
3. Which directory is growing?
4. Are logs too large?
5. Are deleted files still open?
6. Is it safe to remove/compress/archive files?
7. Is LVM free space available?
8. Does the filesystem need to be extended?

Safe notes

Do not paste real production disk names or customer paths if they reveal sensitive systems.

Use generic examples like:

/dev/sdb1
/dev/vg_data/lv_app
/mnt/data
/server01

Personal notes

Add work-specific storage lessons here over time.