Oracle Linux Basic Administration Series - Part 9 - How to Manage Logical Volume Management (LVM) in Oracle Linux
- Jason Beattie
- 19 hours ago
- 2 min read
Logical Volume Management (LVM) gives you flexibility and control over disk storage.Instead of being locked into fixed partitions, LVM lets you resize, extend, or combine storage dynamically which is perfect for growing environments or virtualized systems.
In this blog, you’ll learn how to:
Create physical volumes (PVs)
Combine them into volume groups (VGs)
Create and extend logical volumes (LVs)
Format, mount, and resize LVs
Step 1: Check Available Disks
Before setting up LVM, list your disks:
lsblk
We’ll use /dev/sdb for this example.
⚙️ Step 2: Create a Partition for LVM
Use fdisk to create an LVM partition:
sudo fdisk /dev/sdb
Verify:
sudo fdisk -l /dev/sdb
You should see Linux LVM under type.
🧱 Step 3: Create a Physical Volume (PV)
Initialize the new partition for LVM:
sudo pvcreate /dev/sdb1
Verify:
sudo pvs
Step 4: Create a Volume Group (VG)
Create a volume group named vgdata:
sudo vgcreate vgdata /dev/sdb1Verify:
sudo vgs
Step 5: Create a Logical Volume (LV)
Create a logical volume named lvdata with 10 GB space:
sudo lvcreate -L 10G -n lvdata vgdata
sudo lvs
Step 6: Format the Logical Volume
Format it with a file system (XFS recommended):
sudo mkfs.xfs /dev/vgdata/lvdata
sudo mkfs.ext4 /dev/vgdata/lvdataStep 7: Mount the Logical Volume
Create a mount point:
sudo mkdir /data
sudo mount /dev/vgdata/lvdata /dataCheck:
df -h | grep /data
Step 8: Make the Mount Persistent
Find the LV’s UUID:
sudo blkid /dev/vgdata/lvdata
Add it to /etc/fstab:
sudo vi /etc/fstab
sudo mount -aStep 9: Extend a Logical Volume
If you need more space, you can extend both the LV and the file system.
Step 1: Extend the LV by 5G:
sudo lvextend -L +5G /dev/vgdata/lvdataStep 2: Resize the file system:
For XFS:
sudo xfs_growfs /dataFor EXT4:
sudo resize2fs /dev/vgdata/lvdataVerify:
df -h /dataThe size should increase.
Step 10: Add Another Disk to a Volume Group
If you add another disk (say /dev/sdc1), add it to the VG:
sudo pvcreate /dev/sdc1
sudo vgextend vgdata /dev/sdc1Then extend your LV as needed — you now have a storage pool that can grow dynamically.
Conclusion
You’ve now mastered LVM (Logical Volume Management) in Oracle Linux. This is a tool for managing and scaling storage efficiently. With LVM, you can easily expand your storage, migrate volumes, and allocate space dynamically without downtime.
In the next post, we’ll move into scheduling tasks, learning how to automate jobs using cron and systemd timers.



Comments