Management by logical volumes
The management by logical volumes (in English, logical volume management or LVM ) is a method and a software of cutting, concatenation and use of storage spaces of a waiter. It makes it possible to manage, make safe and optimize in a flexible way storage spaces on line in the operating systems of the type UNIX/Linux.
One also speaks about manager of volumes or Manager Volume in English.
Concepts
Physical volumes
The hard drives, partition S of hard drives, volumes RAID or logical units coming from a SAN form “physical volumes” ( physical volumes or statement ).
Groups of volumes
One concatene these physical volumes in “groups of volumes” ( volume groups or VG ).
Logical volumes
“Logical volumes” ( logical volumes or LV ) then are cut out in the groups of volumes, then formatted S and assembled S in filesystems or are used as a raw devices.
Volumes incorporated by bands (stripping)
Logical volumes can be “stripés” on a whole of physical volumes, following the example RAID 0.This technique is used to improve the performances, but makes more vulnerable to a breakdown disc.
Mirror (mirroring)
Logical volumes can be also mirrorés, following the example RAID 1.This technique makes it possible to be protected from a breakdown on an hard drive.
Extensions
The extensions are the smallest storage units LVM, they are used to increase the size of a group of volumes.There exist two types of extensions:
- physical extensions or EP (Physical Extents)
- logical extensions or IT (Logical Extent)
Stereotypes (snapshots)
The snapshots are logical volumes making it possible to carry out a coherent safeguard of another logical volume of the same group of volumes.The creation of a snapshot consists in taking a " photo" , instantaneous of logical volume targets (what is quasi-immediate) and one then starts to record the modifications made to target logical volume.
; Favors snapshots: The snapshots can be used like a method of safeguard. They make it possible to store a static image of a logical volume at one precise moment. One can then carry out a safeguard on cartouche of the snapshot, which will contain the data present on target volume at the moment of the creation of the snapshot.
; Limit of the snapshots: The snapshots ARE NOT a complete safeguard of a logical volume, they record only the modifications made to target volume, they do not contain the data of this one; more they are not persistent, i.e. they disappear in the event of restarting from the machine.
; Cut snapshots: A very widespread idea wants that the size of a snapshot must be equal to approximately 15-20% of the size of target logical volume. These approximations are completely unfounded, the size necessary to a snapshot depends on the activity in writing on logical volume targets during the lifespan of this snapshot. The suppression of all the data on logical volume targets will ask for example a snapshot of a size at least equal to the size of target logical volume. The size of a snapshot must thus be calculated according to the estimate of the volumes of data written on the target reader throughout your safeguard. In the majority of the cases that will require much less than 15%…
Partitions and filesystems
The partitions and filesystems (filesystems) do not form part of LVM.A partition can be used in physical volume, a filesystem must be installed on a logical volume to be able to be gone up and used.
Enlarging and reductions
It is possible to add hot statement in VG, but a statement must be unutilised (no data) to be withdrawn of a VG.It is possible to increase or reduce LV, but the filesystems installed above must deal with this operation. Many a filesystem deals with the enlarging and the hot reduction, failing this it must be dismounted (thus interruption of service) to undergo this operation.
Functionalities
The hard drives can be local (connected in the waiter) or distant, on a SAN ( Storage Area Network ) or a DAS ( Direct Attach Storage ) in the form of logical units (with which one associated LUN, Logical Unit Number ).The interest of the LVM is that one can modify the size of logical volumes without loss of data (even hot in the case of an enlarging on Ext2, Ext3 and ReiserFS). Preliminary disassembling is recommended all the same for Ext2 and Ext3.
For ReiserFS, the contracting is also possible hot.
Examples
Free software LVM1, LVM2 and EVMS under Linux is examples of Managers Volume, like the software owners LVM of HP-UX or Veritas Enterprise (VxVM) under HP-UX and Solaris.
LVM2
Usual orders of LVM2
Before using LVM, one needs partitionner the discs (see Outils of partitioning) in type LVM.Then,
- For physical volumes: pvcreate , pvscan , special minutes , pvdisplay , pvremove , pvmove , pvchange
- For the groups of volume: vgcreate , vgdisplay , vgscan , vgs , 'vgck , vgremove
- For logical volumes: lvcreate , lvmdiskscan , lvs , lvdisplay , lvremove , lvextend
Concrete example of use
- Change of a defective disc
-
One of the two discs gives signs of failure and an order Fsck created, with repetition, a file “lost+found” on one or more logical volumes. One of your discs is thus failing; the core must have announced in a file “warnings” (for example under /var/log/kernel) of which disc, hda or hdb, it acts. Let us suppose that it is about the disc B which one must replace by a disc of an at least equal size, named C.
- the interest of a management by logical volumes resides in the fact that the time of disconnection of the waiter can be tiny . They will remain nevertheless higher than a waiter under AIX for example, where it is possible to change the “hot” disc what is not possible on a basic PC. The following procedure can be applied:
- * to make a backup partitions of your waiter (if you have a power cut during the operation you are likely to be embarassé);
- * to extinguish your PC then to add the new one and third disc C for example on the tablecloth of the DVD.
- * to light your waiter again (it will be again operational throughout the operation), then to create one or more partitions on /dev/hdc in a form similar to those of the defective disc /dev/hdb. That is to say /dev/hdc6 the great partition of the type “8th - LVM”. The orders of lvm2 under root are then the following ones:
- # lvm2 vgextend henryvg /dev/hdc6 # so as to incorporate the physical partition “hdc6” in the group of volume “henryvg”;
- # lvm2 pvcreate /dev/hdc6 # so as to at the head create a descriptor of group of volume of the /dev/hdc6 partition.
- # lvm2 pvmove /dev/hdb6 # so as to move the contents of the " disc physique" B (and in all the logical volumes created on your waiter like /usr, /var, /home etc) on the other discs has and C. This stage can be long according to the size of the disc, 45 minutes for 40 Go for example;
- # lvm2 vgreduce henryvg /dev/hdb6 # so as to remove the disc B of management LVM (henryvg);
- # the disc B can then be removed during a forthcoming restarting. The disc C will then be set up of the defective disc B (even place on the tablecloth for example, even parameter setting) before relighting the PC. Indeed, the whole of the configuration having been transferred to C, the waiter will function with identical without any other intervention;
- # it will be appropriate nevertheless to restore the files which had been damaged by the defective disc and which are under the repertory “lost+found” of each logical volume (partitions in the old jargon).
- # lvm2 pvcreate /dev/hdc6 # so as to at the head create a descriptor of group of volume of the /dev/hdc6 partition.
- the interest of a management by logical volumes resides in the fact that the time of disconnection of the waiter can be tiny . They will remain nevertheless higher than a waiter under AIX for example, where it is possible to change the “hot” disc what is not possible on a basic PC. The following procedure can be applied:
Files of configuration
- lvmtab (created initially by the order vgscan ).
- lvm.conf
Others
The type of filesystem for a logical volume of type LVM is: 8th (into hexadecimal).
| Random links: | Method of Rietveld | Balby | Homer returns in the queen | For how be beautiful there you! | Auron (river) | Soutane |