Proudly sharing my LVM setup: Multi-VG, NVMe + HDD Hybrid Storage

Logical Volume Management (LVM) in Linux serves a very similar purpose to Dynamic Disks in the Windows world (or features like Storage Spaces or RAID controllers), providing flexible storage management beyond basic partitions.

Key Similarities: LVM vs. Dynamic Disks

Both technologies share core capabilities that differentiate them from traditional, static partitioning:

Feature
LVM (Linux) Dynamic Disks (Windows)
Combine Disks Combine multiple Physical Volumes (PVs) into a Volume Group (VG). Span volumes across multiple physical disks.
undefined -— -—
Resize Volumes Logical Volumes (LVs) can be resized (grown or shrunk) online. Volumes can be extended or shrunk dynamically.
undefined -— -—
Flexibility Manage space abstractly within VGs; space doesn’t need to be contiguous on the physical drive. Provide volume management independent of underlying disk layouts.
undefined -— -—

Summary

If you are familiar with Windows Dynamic Disks, you can think of the LVM components like this:

  • A Physical Volume (PV) is like a physical disk or partition used by the dynamic disk system.

  • A Volume Group (VG) is the shared pool of storage you draw from (like the total pool of space available to all dynamic disks).

  • A Logical Volume (LV)
    is the actual partition you format and use, which can span multiple
    physical disks seamlessly (like a spanned or striped dynamic volume).

providing your disk is /dev/sdb, I just completed this to expend my Root by 2tb in less then 2 minutes.

Here are the specific commands required to expand a Logical Volume by adding a new physical disk to the Volume Group.

This sequence of commands allows us to seamlessly increase the size of an existing filesystem without needing to unmount it or reboot the system.

Prerequisites

  • The new physical disk is installed and recognized by the OS (e.g., /dev/sdb).

  • You know the name of your existing Volume Group (e.g., vg_data).

  • You know the name of your existing Logical Volume (e.g., general_data_lv).

Step-by-Step Commands

Execute the following commands in sequence in your terminal:

1. Initialize the new physical disk as an LVM Physical Volume (PV)

This prepares the disk for LVM use. Replace /dev/sdb with the device name of your new disk.

bash

sudo pvcreate /dev/sdb

2. Add the new Physical Volume to your Volume Group (VG)

This merges the capacity of the new disk into the storage pool of your existing Volume Group. Replace vg_data with the actual name of your Volume Group.

bash

sudo vgextend vg_data /dev/sdb

3. Extend the Logical Volume (LV)

This command extends the Logical Volume to consume all the newly added free space now available in the Volume Group. Replace vg_data and general_data_lv with your actual VG and LV names.

bash

sudo lvextend -l +100%FREE /dev/vg_data/general_data_lv

4. Resize the Filesystem

The final step resizes the filesystem inside the logical volume so the operating system can use the additional space. This command can often be run while the filesystem is mounted.

  • For ext4 filesystems:

    bash

    sudo resize2fs /dev/vg_data/general_data_lv
    
  • For XFS filesystems (Note: XFS requires specifying the mount point instead of the device path):

    bash

    sudo xfs_growfs /mount/point  # e.g., sudo xfs_growfs /mnt/data
    

Verification

Once finished, verify the new, expanded size using the df command:

bash

df -hT

df -hT
Filesystem                          Type      Size  Used Avail Use% Mounted on
tmpfs                               tmpfs     1.6G  2.1M  1.6G   1% /run
efivarfs                            efivarfs  128K   77K   47K  63% /sys/firmware/efi/efivars
/dev/mapper/vg_root-lv_root         ext4      2.3T   34G  2.2T   2% /
tmpfs                               tmpfs     7.8G  4.0K  7.8G   1% /dev/shm
tmpfs                               tmpfs     5.0M   16K  5.0M   1% /run/lock
/dev/nvme0n1p1                      vfat      500M  6.2M  493M   2% /boot/efi
/dev/mapper/vg_data-general_data_lv ext4      1.4T   20G  1.3T   2% /mnt/data
/dev/mapper/vg_home-lv_home         ext4      2.3T   25G  2.1T   2% /home
tmpfs                               tmpfs     1.6G  208K  1.6G   1% /run/user/1000
/dev/sdf1                           fuseblk   3.7T  1.6T  2.1T  43% /media//4tb
/dev/sdg1                           vfat       30G  2.9G   27G  10% /media//LINUX MINT

You should see the total size of your mounted filesystem reflecting the added disk capacity.

4 Likes