Logical Volume, Physical Volume and Volume Groups

Please can someone explain to me the meaning of Logical Volume, Physical Volume and Volume Groups? Of what importance and advantage are they in linux?


Solution 1:

Logical volume management is a widely-used technique for deploying logical rather than physical storage.

With LVM, "logical" partitions can span across physical hard drives and can be resized (unlike traditional ext3 "raw" partitions).

A physical disk is divided into one or more physical volumes (Pvs), and logical volume groups (VGs) are created by combining PVs.

You should read some more specified info here at The Linux Logical Volume Manager

This picture pretty much sums it up

enter image description here

Also there's some good information at A Beginner's Guide To LVM

One of the big advantages of LVM is that you can most easily reduce the size of one partition, and use it on other partitions for example, without data loss.

You can also allocate minimal amounts of space for each logical volume and leave some of the disk unallocated. Then, when the partitions start to fill up, they can be expanded as necessary.

From Archlinux wiki:

Advantages

LVM gives you more flexibility than just using normal hard drive partitions:

  1. Use any number of disks as one big disk.

  2. Have logical volumes stretched over several disks.

  3. Create small logical volumes and resize them "dynamically" as they get more filled.

  4. Resize logical volumes regardless of their order on disk. It does not depend on the position of the LV within VG, there is no need to ensure surrounding available space.

  5. Resize/create/delete logical and physical volumes online. File systems on them still need to be resized, but some support online resizing.

  6. Online/live migration of LV being used by services to different disks without having to restart services.

  7. Snapshots allow you to backup a frozen copy of the file system, while keeping service downtime to a minimum.

Disadvantages

  1. Linux exclusive (almost). There is no official support in most other OS (FreeBSD, Windows..).

  2. Additional steps in setting up the system, more complicated.

  3. If you use the Btrfs file system, its Subvolume feature will also give you the benefit of having a flexible layout. In that case, using the additional Abstraction layer of LVM may be unnecessary.

LVM on Archlinux