0481 055 328 [email protected]
Linux Logo data recovery
Logical Volume Manager is a disk manager which allows  spanning partitions across many devices and enables  partition resizing. It has been in  the Linux kernel since 1999 and relying on its device mapper framework, is now supported by every modern distribution.  It is widely utilized by system administrators for various server, NAS and SAN systems running Linux as the means of organizing storage space with maximum efficiency. It is now the default way of disk management in all Linux distros both commercial and personal.
LVM Structure for data recovery

Basics of LVM

Logical Volume Manager acts as a layer of  abstraction between Linux and the real drives , The LVM is  not tied to a specific  media. A volume can spread over many drives and be resized or removed any time on the fly.

LVM Elements

  • Physical volumes. the actual drives or RAID systems.
  • Volume groups. A volume group is a  a virtual partition consisting  of one or more physical volumes . You need at least one physical volume  to create a volume group . When a volume group is created, it is automatically divided into storage chunks of the same fixed size which are referred to as physical extents.
  • Physical extents. the smallest block into which physical volumes are written to (the default size is 4 MiB). Physical extents are the equivalent of sectors.
  • Logical volumes. A logical volume is a part of a volume group and consists of physical extents. Similar to a standard partition in a non-LVM managed system, it has a mount point and a file system, such as Ext4 or XFS, but in contrast to it, can be created, removed or resized utilizing free space in the volume group it belongs to. This is achieved by copying and reorganizing available physical extents whilst running.
centos data recovery logo

Data Organization

LVM uses physical volume labels and metadata. A physical volume label carries the UUID (universally unique identifier) of the corresponding physical volume, its size in bytes, the list of data area and metadata area locations. This label is usually written to the second 512-byte sector on the disk. Metadata is stored in ASCII and holds all configuration details of each volume group. It is written to a special metadata area within every physical volume forming the corresponding volume group. New metadata is usually added to the end of the old metadata and after that the pointer to the metadata start gets updated. Besides the information about how and when the volume group was created, its name, unique id, version, properties, the size of an extent, etc., metadata embraces:

  • a list of physical volumes it consists of together with their UUIDs, properties, number of extents and the offset to the start of the first extent in sectors;
  • a list of logical volumes, each item of which consists of a list of logical volume segments with mapping to the list of physical volume segments.

As Logical Volume Manager stores this metdata on disk sectors instead of separate files, the disks remain readable by it after Linux reinstall or in other cases when the root file system is wiped.

Pros & Cons of LVM Storage

LVM offers noteworthy benefits in terms of scalability and storage space management:

  • Dynamic resizing of volumes
  •  
  • Spreading one volume over multiple disks
  • Live capacity expansion   drives can be added to a volume group to increase size.
  • Thin ProvisioningLVM gives the possibility to apportion more storage capacity to logical volumes than in fact is available in a volume group. In contrast to a set of partitions with a fixed size, a special thin pool can be created within a volume group, which will provide room for all thin logical volumes bound to it. However, none of the thin volumes reserves a part or the whole present space for individual needs until some data is actually written to consume this space. Hence, each of the thin volumes is assigned a virtual size which may exceed the amount of free space on the physical storage.
  • Support of snapshots LVM supports snapshotting enabling a  backup copy of the file system .

cons are

  • Unsafe volume shrinking  commonly result in corruption and data loss, especially when the file system is full or shrinking is not supported by this file system type.
  • No dual-booting
  • Risk of overwritingBy multi-booting other operating systems may fail to detect this volume manager and consider the disk empty which bears the possibility of overwriting.
  • No default fault-tolerance
  • High likelihood of metadata corruption LVM provides the possibility to enlarge a logical volume and its file system when it is mounted and active. However, any possible interruption of this procedure caused by a power outage, software or hardware malfunction or simple user mistake can prevent the correct metadata to be written completely and render the entire storage unusable.
data recovery software

Data recovery and LVM

With bespoke software we are able to read metadata on the LVM disks and automatically reconstruct such a volume However, severe damage or total overwriting of LVM metadata may pose a big challenge for data recovery: more often than not data in LVM is stored on non-contiguous sectors, especially when there are multiple physical volumes in a volume group and volumes get resized many times. In some cases, metadata can be recovered with the help of a backup copy which are stored in /etc/lvm/backup. The file name will match the name of the volume group.

data recovery of lvm volume