LVM – Anleitung für Anfänger

erneut laufen. Die Ausgabe sollte wie folgt aussehen:

server1:~# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 18 144553+ 83 Linux
/dev/sda2 19 2450 19535040 83 Linux
/dev/sda4 2451 2610 1285200 82 Linux swap / Solaris

Disk /dev/sdb: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 3040 24418768+ 8e Linux LVM

Disk /dev/sdc: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 3040 24418768+ 8e Linux LVM

Disk /dev/sdd: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdd1 1 3040 24418768+ 8e Linux LVM

Disk /dev/sde: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sde1 1 3040 24418768+ 8e Linux LVM

Disk /dev/sdf: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdf doesn’t contain a valid partition table

Nun bereiten wir unsere neuen Partitionen für LVM vor:

pvcreate /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

server1:~# pvcreate /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
Physical volume „/dev/sdb1“ successfully created
Physical volume „/dev/sdc1“ successfully created
Physical volume „/dev/sdd1“ successfully created
Physical volume „/dev/sde1“ successfully created

Lass uns nun aus Übungszwecken zum letzten Vorgan zurückkehren:

pvremove /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

server1:~# pvremove /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
Labels on physical volume „/dev/sdb1“ successfully wiped
Labels on physical volume „/dev/sdc1“ successfully wiped
Labels on physical volume „/dev/sdd1“ successfully wiped
Labels on physical volume „/dev/sde1“ successfully wiped

Lass

pvcreate /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

erneut laufen again:

server1:~# pvcreate /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
Physical volume „/dev/sdb1“ successfully created
Physical volume „/dev/sdc1“ successfully created
Physical volume „/dev/sdd1“ successfully created
Physical volume „/dev/sde1“ successfully created

Lass nun Folgendes laufen

pvdisplay

um den derzeitigen Status unserer Physical Volumes herauszufinden:

server1:~# pvdisplay
— NEW Physical volume —
PV Name /dev/sdb1
VG Name
PV Size 23.29 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID G8lu2L-Hij1-NVde-sOKc-OoVI-fadg-Jd1vyU

— NEW Physical volume —
PV Name /dev/sdc1
VG Name
PV Size 23.29 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 40GJyh-IbsI-pzhn-TDRq-PQ3l-3ut0-AVSE4B

— NEW Physical volume —
PV Name /dev/sdd1
VG Name
PV Size 23.29 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 4mU63D-4s26-uL00-r0pO-Q0hP-mvQR-2YJN5B

— NEW Physical volume —
PV Name /dev/sde1
VG Name
PV Size 23.29 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 3upcZc-4eS2-h4r4-iBKK-gZJv-AYt3-EKdRK6

Lass uns nun unsere Volume Group fileserver erstellen und füge /dev/sdb1 – /dev/sde1 hinzu:

vgcreate fileserver /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

server1:~# vgcreate fileserver /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
Volume group „fileserver“ successfully created

Lass uns nun den Status unserer Volume Groups herausfinden:

vgdisplay

server1:~# vgdisplay
— Volume group —
VG Name fileserver
System ID
Format lvm2
Metadata Areas 4
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 4
Act PV 4
VG Size 93.14 GB
PE Size 4.00 MB
Total PE 23844
Alloc PE / Size 0 / 0
Free PE / Size 23844 / 93.14 GB
VG UUID 3Y1WVF-BLET-QkKs-Qnrs-SZxI-wrNO-dTqhFP

Ein weiterer Befehl um etwas über unsere Volume Groups in Erfahrung zu bringen:

vgscan

server1:~# vgscan
Reading all physical volumes. This may take a while…
Found volume group „fileserver“ using metadata type lvm2

Lass uns nun aus Übungszwecken die Volume Group fileserver in data umbenennen:

vgrename fileserver data

server1:~# vgrename fileserver data
Volume group „fileserver“ successfully renamed to „data“

Lass uns vgdisplay und vgscan erneut laufen lassen um festzustellen, ob die Volume Group umbenannt wurde:

vgdisplay

server1:~# vgdisplay
— Volume group —
VG Name data
System ID
Format lvm2
Metadata Areas 4
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 4
Act PV 4
VG Size 93.14 GB
PE Size 4.00 MB
Total PE 23844
Alloc PE / Size 0 / 0
Free PE / Size 23844 / 93.14 GB
VG UUID 3Y1WVF-BLET-QkKs-Qnrs-SZxI-wrNO-dTqhFP

vgscan

server1:~# vgscan
Reading all physical volumes. This may take a while…
Found volume group „data“ using metadata type lvm2

Lass uns nun unsere Volume Group data löschen:

vgremove data

server1:~# vgremove data
Volume group „data“ successfully removed

vgdisplay

Keine Ausgabe dieses Mal:

server1:~# vgdisplay

Das könnte dich auch interessieren …