mic.we
Goto Top

LVM-Volume erweitern nach Vergrößerung einer VMware-Festplatte

Hallo @ all,

ich beschäftige mich seit inzwischen einigen Tagen mit dem Logical Volume Manager auf einer Centos 7 -VM. Ich habe dazu eine brauchbare Doku von Red Hat gefunden und bin nun auch schon ganz gut durch dieses aus meiner Sicht relativ komplexe Thema durchgestiegen. Vorausschicken will ich noch, dass ich kein Systementwickler bin und auch im Bereich Systemadministration erst seit kurzem Erfahrungen sammle.

Mein Problem besteht in Folgendem.
Ich habe meiner VM eine neue virtuelle Platte von z.B. 50 GB hinzugefügt. Nach Ausführung des folgenden Scripts findet die VM die Platte ohne Reboot.

rescan-scsi-bus.sh -a


Ich habe ein neues Gerät /dev/sdc. Wenn ich nun die richtige Beschreibung gelesen habe muss das Gerät nun mit einem LVM - Partition versehen werden.

fdisk /dev/sdc | n | p | *enter | *enter | *enter | t | 8e | w
fdisk -l

Disk /dev/sdc: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = Sektoren of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0002d2de

   Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sdc1            2048   104857599    52427776   8e  Linux LVM

Ich habe nun also eine Partition /dev/sdc1 mit 50GB. Aus dieser Partition mache ich nun ein physical Volume für den LVM. Daraus kann ich dann eine Volume Group und dann ein logisches Volume erstellen.

Nun endlich zur eigentlichen Frage:
Ich erweitere nun im vCenter von VMware die Größe der Platte auf 80 GB.

Muss ich nun mit fdisk eine weitere Partition /dev/sdc2 anlegen? Oder kann hier LVM schon mit mt der neuen Größe arbeiten?

Content-Key: 310496

Url: https://administrator.de/contentid/310496

Printed on: April 23, 2024 at 17:04 o'clock

Mitglied: 129813
Solution 129813 Jul 21, 2016 updated at 16:59:26 (UTC)
Goto Top
Hi.
FIrst you create a new physical volume with the new partition you have created (pvcreate). Then you extend the volume group with this new physical volume (vgextend). Then extend the logical volume to gain the free space (lvextend). After that you need to resize the filesystem of the logical volume (resize2fs).

All steps in detail explained on this page:
https://www.thomas-krenn.com/de/wiki/LVM_vergr%C3%B6%C3%9Fern

Regards
Member: mic.we
mic.we Jul 21, 2016 at 17:05:19 (UTC)
Goto Top
Danke für die Antwort,

mir geht es aber nicht um das vergößern der VG, ich möchte in der Ebene darunter das physical Volume /dev/sdc1 vergrößern. Ich habe das mit dem Befehl pvresize versucht, hat nicht so richtig funktioniert.
Mitglied: 129813
Solution 129813 Jul 21, 2016 updated at 17:36:31 (UTC)
Goto Top
Zitat von @mic.we:
mir geht es aber nicht um das vergößern der VG, ich möchte in der Ebene darunter das physical Volume /dev/sdc1 vergrößern. Ich habe das mit dem Befehl pvresize versucht, hat nicht so richtig funktioniert.
WIth creating a new PV and adding that to the VG you have that what you need.
What you want to do is this
https://www.mars-solutions.de/knowledgebase/vmware_debian_online_disk_re ...

There is also another solution for that, but i don't recommend it and you should always have your data backed up before doing this because this involves deleting the partition and recreate it with the same parameters:
http://ryandoyle.net/posts/expanding-a-lvm-partition-to-fill-remaining- ...
Member: mic.we
mic.we Jul 22, 2016 at 14:14:55 (UTC)
Goto Top
Hallo highload,

thanks for your help and the thought-provoking impulses.
I have found the solution for my problem. I will soon publish a detailed description as a guide.

The short description for all other

- create a vHD in VMware-Center (#3) 5GB
- in my VM
- rescan the SCSI-Bus
# > rescan-scsi-bus.sh -a
# > fdisk -l
  found a new device /dev/sdc
# > pvcreate /dev/sdc
  Physical volume "/dev/sdc" changed  
  1 physical volume(s) resized / 0 physical volume(s) not resized
# > pvdisplay
  "/dev/sdc" is a new physical volume of "5,00 GiB"  
  --- NEW Physical volume ---
  PV Name               /dev/sdc
  VG Name
  PV Size               5,00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               nBcu8a-ixym-vJIB-GFsr-qGB4-rjLP-46taz8

ready
Mitglied: 129813
Solution 129813 Jul 22, 2016 updated at 14:20:59 (UTC)
Goto Top
So nothing new, like i described in the first post ...

Rescanning the scsi bus can also be done without an additional script:
echo "- - -" >"/sys/class/scsi_host/$(echo "$(grep mpt /sys/class/scsi_host/host?/proc_name)" | grep -Po 'host\d+')/scan"  
Member: mic.we
mic.we Jul 22, 2016 at 14:38:47 (UTC)
Goto Top
your command is a further way to the target. the script rescan-scsi-bus.sh is standard or part of lvm packet over centos and easy to use.
as the German proverb says, there are plenty routes to Rome.

face-smile