Logical Volume Management
8:05 PMLogical Volume Management
Logical Volume Management, or LVM, is a set of drivers and utilities that enables efficient use of storage on the Linux system. LVM2 simply refers to version 2 of the suite.LVM's purpose
LVM is the open source answer to commercial volume management products, such as Veritas Volume Manager. It's purpose is to provide for better management of all storage attached to a server, whether local drives, Direct Attached Storage and SAN. In traditional storage management, a disk gets partitioned, then file systems created on the partitions and finally mounted to the file system tree. Once created, resizing partition sizes was problematic, usually requiring:- backing up all data
- destroying one or more partitions
- recreating partitions of the appropriate sizes
- recreating file systems
- restoring data from the back up
Concepts
Since LVM abstracts physical media away from file systems, you need to be aware of the terminology used with LVM.- A volume is space available for use.
- A physical volume is any amount of physical space. Whole disks, a partition on a disk, SAN or DAS space are all examples of physical volumes.
- A logical volume is a volume built on top of one or more physical volumes. Logical volumes take the place of a disk partition or SAN LUN in traditional storage management.
- An extent is the smallest measurable chunk of space.
- A physical extent is an extent on a physical volume.
- A logical extent is an extent on a logical volume.
- A physical volume group, or volume group, is one or more physical volumes bound together into a single, addressable (named) unit.
How it works
In brief, physical volumes are joined together into volume groups. Logical volumes are then constructed on top of one or more physical volume groups. Finally, a file system is built on each logical volume and mounted to the file system tree.Physical volumes and volume groups
The bundling of physical volumes into volume groups creates a pool of space that can be used to hold logical volumes. The physical volumes don't have to be the same size or even whole disks, all kinds of physical volumes can be joined together into the same volume group. That being said, using whole disks greatly simplifies things. Once created, additional physical volumes can be added to a volume group to expand the pool of available space easily. Removing physical volumes from a volume group is a little trickier because you have to migrate any existing data off the volume before removing it.Physical volumes are prepared by writing a signature block to the volume. This is done with the pvcreate command. This process will destroy any data on the volume. Additionally, if using a whole disk, you do not need to partition it at all.
Once prepared, physical volumes are grouped together into volume groups with the vgcreate command. You can group together as many volumes are you like. You must have at least one physical volume in the volume group.
Logical volumes
A logical volume gets created on one or more volume groups. When creating a logical volume, you specify how much space it should have using either absolute values, number of extents or a percentage of the volume group size.Other
It should be noted that LVM is not a replacement for RAID. RAID and LVM are two distinct technologies that compliment each other. LVM can be used to manage RAID volumes and software RAID volumes can be built on LVM volumes.Stuff left to incorporate into article
# pvcreate /dev/sdc # vgcreate vg01 /dev/sdc # lvcreate -l 75%VG --name mysql01 vg01 # lvdisplay --- Logical volume --- LV Name /dev/vg01/mysql01 VG Name vg01 LV UUID BdsWiL-J4d3-Xds0-Z0eW-Isi8-oZB5-vqIZmA LV Write Access read/write LV Status available # open 1 LV Size 510.46 GB Current LE 130679 Segments 1 Allocation inherit Read ahead sectors 0 Block device 253:0 # df -h /var/lib/mysql Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg01-mysql01 503G 102M 477G 1% /var/lib/mysql
0 comments