Logical Volume Management

LVM is an optional subsystem that is a beefed up version of disk partitioning. Essentially, you can group disks together into a Volume Group (VG). The OS is then presented the VG as a block device.


LVM Benefits


Physical Volumes(pv)

Physical volumes can be :


Volume Groups (vg)

LVM combines physical volumes into storage pools known as volume groups. Volume groups abstract the characteristics of the underlying devices and function as a unified logical device with combined storage capacity of the component physical volumes. (digital ocean)


Logical Volume (lv)


Extent

An extent is a fixed-size-chunk within a volume group. They can be either a physical extent(PE) or logical extent(LE). An LV is just mapping between a PE and LE.


LVM Anatomy

    +-- Volume Group --------------------------------+
    |                                                |
    |    +----------------------------------------+  |
    | PV | PE |  PE | PE | PE | PE | PE | PE | PE |  |
    |    +----------------------------------------+  |
    |      .          .          .        .          |
    |      .          .          .        .          |
    |    +----------------------------------------+  |
    | LV | LE |  LE | LE | LE | LE | LE | LE | LE |  |
    |    +----------------------------------------+  |
    |            .          .        .         .     |
    |            .          .        .         .     |
    |    +----------------------------------------+  |
    | PV | PE |  PE | PE | PE | PE | PE | PE | PE |  |
    |    +----------------------------------------+  |
    |                                                |
    +------------------------------------------------+

Another view

        hda1   hdc1      (PV:s on partitions or whole disks)                        
           \   /                                                                    
            \ /                                                                     
           diskvg        (VG)                                                       
           /  |  \                                                                  
          /   |   \                                                                 
      usrlv rootlv varlv (LV:s)
        |      |     |                                                              
     ext2  reiserfs  xfs (filesystems) 

Example

See here


LV More


Snapshots

You can freeze an existing LV in time, even while system is running. You can continue to use the original volume normally, but the snapshot volume appears to be an image of the original, frozen in time at the moment you created it. You can use this to get a consistent filesystem image to back up, without shutting down the system. You can also use it to save the state of the system, so that you can later return to that state if you mess things up. You can even mount the snapshot volume and make changes to it, without affecting the original.


Logical Volume Management commands


Logical Volume Management commands


Logical Volume Management commands