Howto resize a lvm volume

Als erstes die Maschine herunterfahren und die gewünschte Partition im Hypervisor eurer Wahl vergrößern. Danach Neustart der Maschine.

Kommandos:

lsblk - Anzeige detaillierter Partitionsdaten

pvs/pvdisplay - Anzeige der physischen Partitionskonfiguration

vgs/vgdisplay - Anzeige der Volume-Groups

lvs/lvdisplay - Anzeige der logischen Volumes

  1. LVM Partition ermitteln
    root@server#pvs
    PV VG Fmt Attr PSize PFree
    /dev/xvda2 debian lvm2 a-- <49,07g 0
  2. Partition vergörßern
    root@server#pvresize /dev/xvda2
    Physical volume "/dev/xvda2" changed
    1 physical volume(s) resized or updated / 0 physical volume(s) not resized
  3. Größe prüfen
    root@server#pvs
    PV VG Fmt Attr PSize PFree
    /dev/xvda2 debian lvm2 a-- <99,07g 50,00g
  4. Logical Volume prüfen
    root@server#lvdisplay
    --- Logical volume ---
    LV Path /dev/debian/swap
    LV Name swap
    VG Name debian
    LV UUID TugG23-lY6H-b53g-vx1S-OYnt-Tqnl-hljEA7
    LV Write Access read/write
    LV Creation host, time debian, 2023-12-18 16:21:50 +0100
    LV Status available
    '#'open 2
    LV Size 952,00 MiB
    Current LE 238
    Segments 1
    Allocation inherit
    Read ahead sectors auto
    • currently set to 256
      Block device 254:0

    --- Logical volume ---
    LV Path /dev/debian/root
    LV Name root
    VG Name debian
    LV UUID 2OoOpe-welF-3SuS-CR7Z-ryE5-py6x-8IMt4q
    LV Write Access read/write
    LV Creation host, time debian, 2023-12-18 16:22:12 +0100
    LV Status available
    '#'open 1
    LV Size <48,14 GiB
    Current LE 12323
    Segments 1
    Allocation inherit
    Read ahead sectors auto

    • currently set to 256
      Block device 254:1
  5. Volume auf 100% verfügbare Größe erweitern
    root@server#lvresize --extents +100%FREE --resizefs /dev/debian/root
                Size of logical volume debian/root changed from <48,14 GiB (12323 extents) to <98,14 GiB (25123 extents)
                Logical volume debian/root successfully resized.