Difference between LVM and non LVM Volumes

Written By Support Team (Administrator)

Updated at April 19th, 2022

A Linux Server Administrator seems to be familiar with the volume types that are often discussed and used, namely LVM (Logical Volume Management) and non LVM. So what is the difference between the two types?

The following is the difference between LVM and non-LVM

LVM (Logical Volume Management)

Logical Volume Management (LVM) is the disk management option almost every Linux distro includes. If you want to create large amounts of storage media or create dynamic partitions, LVM might be the solution for you.

LVM combines hard disks or partitions (Physical Volume, PV) into pools (Volume Group, VG) from which "partitions" (Logical Volume, LV) can be dynamically requested, for example as shown below.


Information:

  • PV (physical volumes) - A PV is a disk partition, which is already set up to use LVM
  • VG (volume groups) - A VG is constructed from one or more PVs. Here you will find LVs, which can be formatted with standard Linux file systems.
  • LV (logical volumes) - This is the first step to create a partition of the new disk to be deployed and prepared for LVM, so that it can be used as a PV.

VG can be expanded by adding PV, and LV can be expanded to multiple physical volumes in a volume group. Thus, the Logical Volume can be many times larger than the largest disk in the system.

The advantage of LVM over traditional static partitioning of hard disks is the possibility to expand the file system. For this purpose, the VG can also be resized and expanded by adding a PV (hard disk).

Simply with this LVM method you can expand the root volume and Data volume easily.

Advantages of LVM:

  • Allows you to efficiently manage and utilize physical disk space.
  • Able to create logical volumes whose capacity can be increased or decreased depending on your needs.

  • If you intend to back up your data on multiple logical volumes, then you can increase your data availability.

  • New physical devices or volumes can be easily added under a volume group without downtime (zero downtime) and without any service disruptions (service disruption).

  • LVM allows you to partition a single physical device into multiple logical partitions as well as allows you to integrate multiple physical devices into a single volume group.
  • Logical Volumes can also be dynamically resized, so you can start with a small partition for example and configure it to expand as data is written to it.

  • Multiple disks and partitions can be lumped together into one large disk, or a single physical disk can be quickly split into multiple partitions of any size.


Disadvantages of LVM:

  • It can make the boot process more complicated and make repairing a disaster difficult.

  • LVs can suffer from external fragmentation when PEs are not allocated side-by-side on the underlying storage which can lead to decreased I/O performance

non-LVM

non-LVM or called by standard partition is the opposite of LVM where for non-LVM you cannot extend the root volume and usually if there is an expand then the solution is to mount to a certain directory. non-LVM can be used if you don't plan or will not add capacity on disk or storage. Look at the picture below


Three 10 GB hard drives above with partitions and mount points. All partitions are on individual hard disk drives.

Non-LVM advantages:

  • Easy to reinstall the operating system

  • Simpler backup

  • Improved security

  • Better organization

  • Install multiple operating systems easily

  • Using multiple file systems

Disadvantages of non-LVM:

  • Complicated and the risk of error is high

  • Having to complete multiple partitions at the same time and wasted space

  • Not really necessary for the average user

  • There is software downtime if there is additional disk

  • If you need a larger disk it cannot be done and must be added to a different directory

LVM and non-LVM IOPS performance

Here we have provided 2 volumes with the following details:

  • LVM

Partition: /dev/vdb

Filesystem: ext4

Size: 20GB

  • Non-LVM

Partition: /dev/vdd

Filesystem: ext4

Size: 20GB

For more details you can see the image below


 To test the performance of LVM and non-LVM IOPS, you can use the fio software.


MEASURING IOPS READ, WRITE, READ & WRITE AND RANDOM READ, WRITE, READ & WRITE ON NON-LVM

Measure IOPS read, write, read and write performance using fio software with the following command:

  • Read

 root@kb-lvm-non-lvm-bgn:/mnt/kbnon-lvm# time fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=read-non-lvm --filename=foo-$(date +"%Y%m%d%H%M%S") --bs=4k --iodepth=256 --size=2G --readwrite=read

Result: read: IOPS=27.9k, BW=109MiB/s (114MB/s)(2048MiB/18803msec)

  • Write

 root@kb-lvm-non-lvm-bgn:/mnt/kbnon-lvm# time fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=write-non-lvm --filename=foo-$(date +"%Y%m%d%H%M%S") --bs=4k --iodepth=256 --size=2G --readwrite=write

Result: write: IOPS=22.8k, BW=89.1MiB/s (93.4MB/s)(2048MiB/22989msec); 0 zone resets

  • Read/Write

 root@kb-lvm-non-lvm-bgn:/mnt/kbnon-lvm# time fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=read-write-non -lvm --filename=foo-$(date +"%Y%m%d%H%M%S") --bs=4k --iodepth=256 --size=2G --readwrite=rw

Result:

Read: read: IOPS=20.5k, BW=80.0MiB/s (83.9MB/s)(1023MiB/12783msec)

Write: write: IOPS=20.5k, BW=80.2MiB/s (84.1MB/s)(1025MiB/12783msec); 0 zone resets

MEASURING IOPS READ, WRITE, READ & WRITE AND RANDOM READ, WRITE, READ & WRITE ON LVM

Measure IOPS read, write, read and write performance using fio software with the following command:

  • Read

 root@kb-lvm-non-lvm-bgn:/mnt/kblvm# time fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=read-lvm --filename= foo-$(date +"%Y%m%d%H%M%S") --bs=4k --iodepth=256 --size=2G --readwrite=read

Result: read: IOPS=27.2k, BW=106MiB/s (111MB/s)(2048MiB/19279msec)

  • Write

 root@kb-lvm-non-lvm-bgn:/mnt/kblvm# time fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=write-lvm --filename= foo-$(date +"%Y%m%d%H%M%S") --bs=4k --iodepth=256 --size=2G --readwrite=write

Result: write: IOPS=22.1k, BW=86.2MiB/s (90.4MB/s)(2048MiB/23748msec); 0 zone resets

  • Read/Write

 root@kb-lvm-non-lvm-bgn:/mnt/kblvm# time fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=read-write-lvm -- filename=foo-$(date +"%Y%m%d%H%M%S") --bs=4k --iodepth=256 --size=2G --readwrite=rw

Result:

Read: read: IOPS=20.8k, BW=81.1MiB/s (85.1MB/s)(1023MiB/12612msec)

Write: write: IOPS=20.8k, BW=81.3MiB/s (85.2MB/s)(1025MiB/12612msec); 0 zone resets


Was this article helpful?