| Was kann LVM und warum sollte man LVM benutzen/What can LVM do form me and why should I use LVM |
|
|
|
| Sonntag, 24 April 2011 | |
|
LVM (Logical volume manager) ist eine Softwarekomponente, die Festplatten bzw Partitionen als physikalische Partition (PV) in Volume Gruppen (VG) zusammenfast und es erlaubt daraus dynamisch logische Volumes (Partitions) (LV) zu erstellen und im laufenden System ihre Größe zu modifizieren. Linux, Aix, OS2, Solarix, FreeBSD u.a. untersützen LVM. Windows2000 und höher hat ein ähnliches Konzept, ist aber mit LVM nicht kompatibel. Linuxdistributionen wie z.B. Debian, Mandrake, Mint, Ubuntu, Redhat, Slackware und openSuSE bieten zwar während der Installation an das Linux unter LVM zu installieren. Nur leider ist der Standardfall immer noch, dass kein LVM benutzt wird. Im Folgenden wird im Detail beschrieben, was die Fähigkeiten und Vorteile von LVM sind und warum auch jeder Linux Benutzer LVM benutzen sollte.
===> English <===
LVM (Logical volume manager) is a software component, which aggregates disks rsp partitions as a physical partition (PV) in a volume group (VG) and allows to create on the fly logical volumes (Partitions) (LV) and to resize them on the fly. Linux, Aix, OS2, Solarix, FreeBSD and other support LVM.
Windows2000 and above has a similar concept but is not compatible with LVM. Linux distros like Debian, Mandrake, Mint, Ubuntu, Redhat, Slackware und openSuSE allow to install Linux on LVM managed disks but unfortunately per default there will be no LVM be used. Following pages describe in detail the capabilities and benefits of LVM and why every Linux user should also use LVM on his system.
Logische Teile von LVM und deren Zusammenhänge
LVM benutzt folgende Begriffe:
PV: Physical volume - ein physikalische Platte oder Partition einer Platte
PE: Physical extent partition - eine Speichereinheit einer PV
LV: Logical volume - eine Zusammenfassung von mehreren PEs. Entspricht einer Partition in einem nicht LVM verwalteten System.
LE: Logical extent - eine logische Speichereinheit einer LV die auf ein physische Speichereinheit einer PV, der PE verweist
VG: Volume group - eine Zusammenfassung von mehreren PVs und den darin definierten LVs
Das folgende Bild zeigt sehr gut die einzelnen Teile, die LVM ausmacht und ihre Zusammenhänge:
Die PVs /dev/sda1, /dev/sda2 usw besitzen physische extents (PE). Mehrere Platten werden zu einer volumegroup (VG) dataVG zusammengefasst. In dieser volumengroup dataVG sind logische volumes (LV) /dev/LV1 und /dev/LV2 definiert. Sie besitzen logische Extents (LE), die auf phyische Extents in det PV zeigen. Dabei können sich die PEs auf mehreren unterschiedlichen Platten verteilen.(/dev/LV2 PEs auf PV /dev/sda1, /dev/sdb1 und /dev/sdb2). Auf diesen logischen Volumes erstellt man dann ein Filesystem (FS) (ext3 bzw ext4) und mountet dieses im Betriebssystem mit dem mountpoint (MP) /home bzw als /.
Der Umstieg von der alten nicht LVM basierten Welt in die LVM Welt geht am leichtesten wenn man sich folgende Dinge merkt:
Nachteile eines LVM
Graphische Oberflächen für LVM
Die graphischen Oberflächen erlauben nur die wichtigsten Dinge wie PV/VG/LV anlegen und löschen sowie LV zu vergrößern. Will man tiefergehende und umfangreichere Dinge mit LVM machen muss man auf der Konsole entsprechende Befehle abgeben.
Zusammenfassung
LVM ist für einen jeden Systemadministratoren ein Muss. Es erlaubt flexible Bereitstellung und GrößenÄnderung von Partitionen was in einem Serverumfeld immer notwendig ist. Aber auch ein normaler Heimanwender von Linux profitiert von LVM. In der heutigen Zeit der riesigen Platten > 1TB kann man sicherlich immer noch die Platten auf die alte Art und Weise ohne LVM in Partitionen unterteilen und auch per gparted oder ähnlichen Tools deren Größe bei Bedarf ändern. Es ist aber wesentlich sinnvoller und einfacher zu administrieren wenn man die eine grosse Platte unter LVM Verwaltung stellt und dann dynamisch neue Partitionen erstellt. Besonders hilfreich ist das wenn man parallele Betriebssysteme installiert hat oder auch wenn man einfach nur parallel zu einer alten Betriebssystemversion eine neue aktuelle Version installieren möchte.Oftmals kauft man sich später noch eine oder zwei Platten dazu weil das Plattenplatz knapp wird. Mit einem LVM kann man die Platten sehr schnell integrieren. Allerdings muss man sich bewusst sein, dass dadurch die Ausfallwahrscheinlichkeit einer VG steigt und sollte geeignete Backupstrategien und -prozeduren auf externe USB Platten oder NAS Gerätehaben.
Die Snapshots sind auch eine hilfreiche Funktion, denn damit kann man einfach auf Knopfdruck ein Backup einer Partition erstellen. Hilfreich ist es auch, wenn man einen Betriebssystemupgrade testen möchte. Einfach einen Snapshot erstellen und auf dem den Upgrade durchführen. Dann Testen und wenn alles zufriedenstellend funktioniert fährt man den Rechner mit diesem Snapshot. Funktioniert es nicht dann löscht man den Snapshot und geht wieder auf die alte Version zurück. Bleibt man auf der neuen Version muss aber immer die alte Version beibehalten werden da ja der Snapshot immer nur die Änderungen zum alten LV beinhaltet.
Liste von den wichtigsten LVM Konsolenbefehlen
Erstellen einer PV:
vcreate /dev/sdb1
Erstellen einer VG:
vgcreate neuVG /dev/sda1 /dev/sdb1
Erweiterung einer VG um eine neue PV:
vgextend neuVG /dev/sdc1
Erstellung einer LV neuLV von 2G in einer VG neuVG:
lvcreate -L2G -nneuLV neuVG
Vergrößerung einer LV neuLV um 10G:
lvextend -L+10G /dev/neuVG/neuLV
Quellen und Referenzen:
Deutsch:
English:
Logical parts of LVM and their relationships
LVM uses following terms:
PV: Physical volume - a physical disk or partition of a disk
PE: Physical extent partition - a storage area of a PV
LV: Logical volume - a collection of multiple PEs. Corresponds to a partition in an non LVM managed system
LE: Logical extent - a logical storage area of a LV which refers to a physical storage area in a PV
VG: Volume group - a collection of multiple PVs and the LVs created in the PV
Following picture depicts all of the major LVM parts
PVs /dev/sda1, /dev/sda2 etc have physical extents (PE). Multiple PVs are combined in a volumegroup (VG) dataVG. This volumengroup dataVG has logical volumes (LV) /dev/LV1 and /dev/LV2 configured. They use logical extents (LE),
which point to physical extents in the assiciated PVs. The PEs can point to PE on different PVs (/dev/LV2 PEs
auf PV /dev/sda1, /dev/sdb1 and /dev/sdb2). These logical volumes have different filesystems (FS) ext3 and ext4 and are mounted to the operating system with mountpoint (MP) /home and /.
A move to the LVM world is quite easy if you remeber following two relations:
Disadvantages of LVM
Graphical interfaces for LVM
The graphical interfaces provide the most important and heavily used LVM administration tasks like to create and erase a PV/VG/LV and to increase and decrease a LV. If you want to use the whole power of LVM you have to use the console commands.
Summary
A system administrator will use LVM for sure. LVM allows to provide in a flexible way to create partitions on the fly and to modify the size of them. A standard Linux home user will also profit from LVM. Today the disks are huge (> 1TB) and LVM is the right tools to dynamically allocate and resize partions of these huge disks. In particular it's useful if you want to install parallel operating systems or if you want to upgrade an existing operating system to the latest level. A lot of time you buy another disk to increase the available disk space for your applications. With LVM it's quite easy to integrate the new disk into a VG and to allocate the new space either in new partition/LV or add additional space to existing partitions/LV. Keep in mind the risk for a VG failure will increase the more disks you combine in one VG. You should have a backup strategy and create backups on external USB disks or NAS boxes. As an alternative you can place LVMs on a RAID system.
A snapshot is also very useful. You can easily create a backup of a partition/LV. If you want to upgrade an operating system that way a backup is created very quick. If the upgrade fails you revert to the snapshot and are done. If everything works fine you use the new snapshot. Keep in mind you have to keep the old LV because the snapshot needs the original LV in order to work properly.
List of the most important LVM console commands
Create PV:
vcreate /dev/sdb1
Cretae VG:
vgcreate neuVG /dev/sda1 /dev/sdb1
Extend a VG with a new PV:
vgextend neuVG /dev/sdc1
Create a new LV neuLV of 2G in VG neuVG:
lvcreate -L2G -nneuLV neuVG
Extend a LV neuLV for 10G:
lvextend -L+10G /dev/neuVG/neuLV
|
|
| Last Updated ( Sonntag, 19 Februar 2012 ) |
| < Prev | Next > |
|---|








