Skip to content
Tech Master Tech Master

OneStopTechnical Forum

  • Books
  • AI
  • Networking
  • Windows
  • Linux
  • Cloud
  • Mac
  • Active Directory
  • Azure
  • Cloud
  • Exchange
  • M365
  • Server 2025
  • Storage
  • Vsphere
  • Website
  • Database
  • Security
  • Knowledge Base
  • VPN
Tech Master
Tech Master

OneStopTechnical Forum

Configure Logical Volume Management (LVM)

blog.payperitem.com, March 30, 2025March 30, 2025

Logical Volume Management (LVM) allows for flexible disk space management in Linux. Below are step-by-step instructions to configure LVM on both generic Linux and Ubuntu.


Step 1: Install LVM

LVM is included in most Linux distributions, but if it’s missing, install it using:

bash
sudo apt update
sudo apt install lvm2 -y # Ubuntu/Debian

For RHEL-based systems:

bash
sudo yum install lvm2 -y
sudo systemctl enable --now lvm2-lvmetad

Step 2: Identify Available Disks

Check available disks using:

bash
lsblk
fdisk -l

Assume we will use /dev/sdb and /dev/sdc for LVM.


Step 3: Create Physical Volumes (PVs)

Convert the disks to LVM physical volumes:

bash
sudo pvcreate /dev/sdb /dev/sdc

Verify:

bash
sudo pvdisplay

Step 4: Create a Volume Group (VG)

Create a volume group named vg_data:

bash
sudo vgcreate vg_data /dev/sdb /dev/sdc

Verify:

bash
sudo vgdisplay

Step 5: Create Logical Volumes (LV)

Create a logical volume (lv_storage) of 10GB:

bash
sudo lvcreate -L 10G -n lv_storage vg_data

Or use 50% of available space:

bash
sudo lvcreate -l 50%VG -n lv_storage vg_data

Verify:

bash
sudo lvdisplay

Step 6: Format the Logical Volume

Format with an ext4 filesystem:

bash
sudo mkfs.ext4 /dev/vg_data/lv_storage

Step 7: Mount the Logical Volume

Create a mount point:

bash
sudo mkdir /mnt/lvm_storage

Mount the volume:

bash
sudo mount /dev/vg_data/lv_storage /mnt/lvm_storage

Verify:

bash
df -h

Step 8: Persistent Mounting

To mount at boot, edit /etc/fstab:

bash
sudo nano /etc/fstab

Add:

bash
/dev/vg_data/lv_storage /mnt/lvm_storage ext4 defaults 0 2

Save and exit, then test:

bash
sudo mount -a

Step 9: Extending a Logical Volume (Optional)

If more space is needed:

bash
sudo lvextend -L +5G /dev/vg_data/lv_storage

Resize filesystem:

bash
sudo resize2fs /dev/vg_data/lv_storage

Verify:

bash
df -h

Step 10: Removing LVM (Optional)

If needed, unmount and remove:

bash
sudo umount /mnt/lvm_storage
sudo lvremove /dev/vg_data/lv_storage
sudo vgremove vg_data
sudo pvremove /dev/sdb /dev/sdc

Linux

Post navigation

Previous post
Next post

Related Posts

Zentyal as a Domain Controller (Active Directory)- Based on Linux

March 31, 2025April 2, 2025

Zentyal is an easy-to-use Linux server based on Ubuntu that provides essential network services such as domain controller, file sharing, email, firewall, and more. Here’s a step-by-step guide to installing and configuring Zentyal. Step 1: Download and Install Zentyal Step 2: Basic System Configuration Step 3: Configure Network Settings Step…

Read More

Web Server Security Guide (Nginx, Apache, Caddy, IIS) 🚀

April 2, 2025April 2, 2025

1️⃣ General Web Server Security Best Practices ✅ Keep the Server Updated ✅ Run as a Non-Root User ✅ Use TLS/SSL (HTTPS) ✅ Disable Unnecessary Modules ✅ Limit Server Signature Exposure ✅ Restrict File & Directory Access ✅ Enable Rate Limiting ✅ Enable Web Application Firewall (WAF) ✅ Enable Logging…

Read More

Customize Snipe-IT to add more field entries

April 3, 2025April 3, 2025

1. Using Custom Fields (No Code) This is the easiest way to add fields without modifying the code. 2. Database Modification (Advanced) If you need persistent changes beyond custom fields: 3. Extending Snipe-IT API for Custom Fields 4. Customizing the Frontend If the UI needs additional inputs:

Read More

Recent Posts

  • List of AD Schema Versions
  • OldNewExplorer Free Download For Windows 11, 10, 8 and 7 [Latest Version]
  • How to Get the Classic (old) Context Menu on Windows 11
  • BitLocker Recovery Keys
  • Active Directory and Server hardening

Recent Comments

No comments to show.
June 2025
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« May    
Log in
©2025 Tech Master | WordPress Theme by SuperbThemes
  • Login
  • Sign Up
Forgot Password?
Lost your password? Please enter your username or email address. You will receive a link to create a new password via email.
body::-webkit-scrollbar { width: 7px; } body::-webkit-scrollbar-track { border-radius: 10px; background: #f0f0f0; } body::-webkit-scrollbar-thumb { border-radius: 50px; background: #dfdbdb }