LVM2
Logical Volume provide the following advantages over using physical storage directly:
1. Flexible capacity: file system can extend across multiple disks, since you can aggregate disks and partitions into a single logical volume.
2. Resizable storage pools: Extend/Reduce logical volumes
3. Online data relocation
4. Convenient device naming
5. Disk stripping, stripes data across two or more disks, this can dramatically increase throughout.
6. Mirror volume: logical volumes provide a convenient way to configure a mirror for your data.
7. Volumes snapshots: take device snapshots for consistent backups or to test the effect of changes without affecting the real data.
For the RHEL4 release, the original LVM1 becomes to LVM2. LUM is backward compatible with LVM1, with the expection of snapshot and cluster support. Convert a volume group from LUM1 to LVM2 with vgconvert command.
The clustered logical volume manager(CLVM) is a set of clustering extension to LVM, these extensions allows a cluster of computers to manager shared storage using LVM. clmvd daemon runs in each cluster computer with the same view of the logical volumes.
CLVM allows a user to configure logical volumes on a shared storage by locking access to physical storage while a logical volume is being configured, CLVM uses the locking service provides by high available symmetric infrastructure.
LVM logical volumes:
1. linear volumes
2. stripped logical volumes
3. mirrored logical volumes
4. snapshot volumes
Initializing a block device as a physical volume places a label near the start of the device. By default, the LVM label is placed in the second 512-bytes sector. You can overwrite this default by placing the label on any of the first 4 sectors.
LVM label identifies the devices as LVM physical volume. It contains a random unique identifier(the uuid) for the physical volume. It also stores the size of the block device in bytes, and it records where the LVM metadata will be stored on the devices.
LVM metadata is small an stored as ASCII.
Currently LVM allows you to store 0, 1 or 2 identifical copies of its metadata on each physical volume, the default is 1 copy, once you configure the number of metadata copies on the physical volume, you can not change the number at a later time. The first copy is stored at the start of the device, shortly after the label. If there’s a second copy, it is placed at the end of the device. If you accidently overwrite the area at the beginning of your disk by writting to a different disk than you intend, a second copy of metadata at the end of the device will allow you to recovery the metadata.
In Linux kernel, sector are considered to be 512 bytes in size.
Stripping performance:
LVM can not tell that two PV are on the same physical disk, if you create a striped logical volumes when two PV are on the same physical disk, the stripes could be on different partitions on the same disk. This would result in a decrease in performance rather than an increase.
Stripped logical volumes:
The filesystem lays the data out across the underlying physical volumes, you can control the way the data is written to the physical volumes by creating a stripped logical volumes.For large sequential reads and writes, this can improve the efficiency of the data I/O.
Stripping enhances performance by writing data to a predetermined number of physical volumes in round-round fashion. With stripping, I/O can be done in pararrel. In some situations, this can result in near-linear performance gain of each addtional pv in the stripe.
If you have two-way strip that uses up an entire volume group, adding a single physical volume to the volume group will not enable you to extend the stripe. Instead, you must add at least two PVs to the vg.