As a Linux system administrator, having flexibility and control over your storage is critical. Filesystems fill up, new disks get added, performance requirements change – you need to be able to adapt. This is where Linux‘s Logical Volume Manager (LVM) comes in handy. In this comprehensive guide, we‘ll explore how LVM works and how to leverage it for your storage needs on Linux Mint.
Understanding LVM Architecture
The key to grasping the power of LVM is first understanding its underlying architecture of physical volumes, volume groups, and logical volumes.
Physical Volumes
Physical volumes (PVs) represent your actual storage devices – this can be entire disks like /dev/sdb, partitions like /dev/sdb1, or even hardware RAID arrays. PVs provide space to pools of storage called volume groups.
Volume Groups
Volume groups (VGs) collect one or more PVs together into a centralized pool of storage. This aggregated space can then be allocated to create logical volumes. Combining multiple PVs gives more flexibility in how storage gets divided up.
Logical Volumes
Logical volumes (LVs) are block devices like standard disk partitions, but composed from space in the underlying VG rather than tied to a single disk. You can format LVs with filesystems and mount them just like regular partitions. The difference is that LVs can be resized and moved between VGs.

So in summary, PV provide storage capacity, VGs pool that capacity, and from VGs you carve out LVs to act as mountable filesystems. This added layer of abstraction unlocks powerful management capabilities.
Benefits of LVM in Linux Mint
Taking the time to set up LVM provides several advantages for a Linux Mint system:
Simple Volume Resizing
With traditional partitions, expanding or shrinking a filesystem is often impractical without unused free space on the disk. With LVM, you can grow filesystems on demand by adding a new PV to a VG then expanding the LV. No more worrying about sizing partitions ahead of time.
Volume Snapshots for Backups
LVM permits creating read-only snapshots of LV filesystems for consistent backups. Snapshots record the state of a filesystem instantly. Backup software can then safely copy files from the snapshot without risk of changes during the backup.
Dynamic Striping Across Disks
For performance-sensitive applications like databases, LVM allows creating a striped logical volume made up of chunks of storage on multiple PVs. This enables RAID 0-like striping without the inflexibility of actual hardware RAID.
Efficient Thin Provisioning
For use cases like virtual machine storage, LVM thin provisioning allocates LV storage on-demand from a pool rather than dedicating space up front. This prevents overprovisioning disk space.
Live Data Migration
LV data can be relocated from one PV to another on a running system, enabling replacing disks or rebalancing data across an array. Trying this with a standard partition requires significant downtime.
As you can see, LVM opens up useful capabilities for managing storage in dynamic production environments. Now let‘s walk through a real example…
Configuring LVM on a Linux Mint Host
I have a Linux Mint 20 workstation running on an old laptop. I‘d like to add some additional storage for user files and backups that can grow over time. I have an extra 500GB SATA drive I can install. With LVM, I can avoid having to decide how big each filesystem needs to be in advance.
Here is how I would set this up:
Install lvm2 Package
Make sure LVM utilities are present – for Debian-based distros like Mint this is the lvm2 package:
sudo apt install lvm2
Initialize Physical Volume on /dev/sdb
I partition my new 500GB disk with a single partition /dev/sdb1 using fdisk, then mark it as LVM type:
sudo fdisk /dev/sdb
> n # add partition
> t # set partition type
> 8e # Linux LVM type
> w # write partition table
Initialize this partition as a physical volume:
sudo pvcreate /dev/sdb1
Create Volume Group
Now add this PV to a new volume group. I‘ll call it datavg:
sudo vgcreate datavg /dev/sdb1
Allocate Logical Volume
Carve out a 200GB logical volume from my VG for user files. mkfs it with XFS and mount it under /mnt:
sudo lvcreate --size 200G --name files datavg
sudo mkfs.xfs /dev/datavg/files
sudo mkdir /mnt/files
sudo mount /dev/datavg/files /mnt/files
I now have a mountable, resizable 200GB volume for data!
Create Snapshot Before Backup
To back up my documents, I take a read-only snapshot then pipe the snapshot to my backup process:
sudo lvcreate --size 200G --snapshot --name snap /dev/datavg/files
sudo rsync -avxHAX /dev/datavg/snap /backups/documents
This ensures a consistent view of the filesystem getting backed up.
Final Thoughts
LVM might seem complex initially, but once you grasp its logical volume abstraction and capabilities like instant snapshots, you unlock near limitless flexibility in adapting your storage needs. Set up LVM for your Linux Mint hosts and you‘ll wonder how you ever managed storage without it!
If you have questions or want help designing an LVM layout for your use case, don‘t hesitate to reach out. Managing Linux storage is what I live for!


