Storage Handling

2023-10-29
3 min read

Using Logical Volumes offers several advantages over using physical storage directly.

Logical Volumes

Logical Volume Manager

  1. A Logical Volume Manager (LVM) system is used to create logical storage volumes as a layer on the physical storage. This storage system provides greater flexibility than using physical storage directly.
  2. LVM hides the hardware storage configuration from the software, and enables you to resize volumes without stopping applications or unmounting file systems.
  3. By hiding the hardware storage configuration, LVM abstracts the complexities of underlying storage devices, offering a more simplified and consistent interface.
  4. LVM provides comprehensive command-line tools such as vgcreate, lvcreate to manage storage.

Physical devices

  1. Logical Volumes use physical devices for storing data. These devices might be disk partitions, whole disks, RAID arrays, or SAN disks.
  2. Before they can be used in the LVM system, devices like disk partitions or whole disks must be initialised as an LVM Physical Volume. Once designated as an LVM Physical Volume, the entire device is utilised for that purpose.

Physical Volumes (PVs)

  1. The underlying physical device serves as the LVM Physical Volume.
  2. LVM tools segment the physical volumes into Physical Extents (PEs) to form small chunks of data that act as the smallest storage block on a PV.

Volume Groups (VGs)

  1. Volume Groups are storage pools that are made from one or more PVs. It is the functional equivalent of a whole disk in physical storage. A Physical Volume must be allocated only to a single Volume Group.
  2. The size of each Physical Extent (PE) in a VG is set automatically by LVM, although it’s possible for users to specify a different size. A Volume Group might consist of unused space and several Logical Volumes.

Logical Volumes (LVs)

  1. Logical volumes, which can be resized or reconfigured as needed, are created from the available free Physical Extents across all Physical Volumes in the Volume Group.
  2. These Logical Volumes are then provided as the storage device for applications, users, and operating systems.
  3. By default, each Logical Extent gets mapped to one Physical Extent. Some settings could change this mapping. For example, mirroring causes each Logical Extent to map to two Physical Extents.

So here is the high-level flow.

PhysicalDevicesPhysicalVolumesVolumeGroupsLogicalVolumes

In the next part, we shall apply this concept in a hypothetical scenario.