LVM auf neu ersteller Festplatte von VM erweitern

maze-m

Member
Nov 26, 2024
45
4
8
Hallo zusammen!

Ich habe meiner VM 'nfs' eine weitere Festplatte hinzugefügt, auf welcher ich meine ganzen Filme abgelegt habe und
diese nun via NFS-Share meinem LXC-Container (Jellyfin) zur Verfügung stelle.
Das funktioniert auch super, allerdings wollte ich nun die Festplatte erweitern über "Hardware" --> "Hard Disk" --> "Disk Action" --> "Resize".
Dort konnte ich die Disk auch auf 1,2 TB erweitern, jedoch weiß ich nicht, wie ich nun das PV / LV in der VM erweitern soll.

lsblk -a bzw. lsblk -f zeigt mir das ("sdb" ist die zu erweiternden Disk) :


Bash:
matze@nfs:~$ lsblk -a
NAME               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda                  8:0    0   32G  0 disk
├─sda1               8:1    0  976M  0 part /boot
├─sda2               8:2    0    1K  0 part
└─sda5               8:5    0   31G  0 part
  ├─nfs--vg-root   254:1    0  8,1G  0 lvm  /
  ├─nfs--vg-swap_1 254:2    0  1,6G  0 lvm  [SWAP]
  └─nfs--vg-home   254:3    0 21,3G  0 lvm  /home
sdb                  8:16   0  1,2T  0 disk
└─video-lv_data    254:0    0 1000G  0 lvm  /mnt/video
sr0                 11:0    1  784M  0 rom
matze@nfs:~$ lsblk -f
NAME               FSTYPE      FSVER            LABEL                 UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1             ext4        1.0                                    aabcc7b4-dfa2-4d77-b670-ecdb8ad18c8e    803,8M     8% /boot
├─sda2
└─sda5             LVM2_member LVM2 001                               vmVOoi-WaAh-ETQb-OBS0-2SHu-qDgg-nOaX9c
  ├─nfs--vg-root   ext4        1.0                                    4f3d0a24-2890-44cd-8c88-22bfbd1cfe21      6,5G    13% /
  ├─nfs--vg-swap_1 swap        1                                      4e04da5a-3875-497d-a8dd-2d546e7f6ce2                  [SWAP]
  └─nfs--vg-home   ext4        1.0                                    ac894a24-e6ad-4740-97e3-da52a730d67b     19,7G     0% /home
sdb                LVM2_member LVM2 001                               WYvlJt-WcgM-7IvL-6VP2-Tc8h-6ANB-B2iNo2
└─video-lv_data    ext4        1.0                                    80393af6-ff6c-4f50-b44a-52bc20a78364       17G    93% /mnt/video
sr0                iso9660     Joliet Extension Debian 13.2.0 amd64 n 2025-11-15-11-09-09-00

pvdisplay (für 'sdb') zeigt mir das:

Bash:
--- Physical volume ---
  PV Name               /dev/sdb
  VG Name               video
  PV Size               1000,00 GiB / not usable 4,00 MiB
  Allocatable           yes (but full)
  PE Size               4,00 MiB
  Total PE              255999
  Free PE               0
  Allocated PE          255999
  PV UUID               WYvlJt-WcgM-7IvL-6VP2-Tc8h-6ANB-B2iNo2

lvdisplay (für 'sdb') zeigt mir das:

Bash:
 --- Logical volume ---
  LV Path                /dev/video/lv_data
  LV Name                lv_data
  VG Name                video
  LV UUID                K49VTW-AwnL-cNOd-Tdtt-et4A-cAUk-vGdXxT
  LV Write Access        read/write
  LV Creation host, time nfs, 2026-01-05 22:39:17 +0100
  LV Status              available
  # open                 1
  LV Size                <1000,00 GiB
  Current LE             255999
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0


Ich vermute, dass ich hätte vorher auf '/dev/sdb' eine Partition anlegen sollen, oder? Das ich das nicht gemacht habe, bricht mir vermutlich nun das Genick, oder sehe ich das falsch?
 
Probiere mal
Bash:
pvresize /dev/sdb
lvresize -r -L +99%FREE video/lv_data
Du kannst auch 100% nehmen wenn du wie hier keine thin volumes/pools hast.

Prüfe danach via
Bash:
pvs
lvs
df -hT

Du hättes hier übrigens auch auf LVM verzichten können.
 
Last edited:
  • Like
Reactions: maze-m
Vielen lieben Dank dir mal wieder für den super Support!

Das hat soweit geklappt, wobei ich allerdings lvextend -r -l +100%FREE video/lv_data hergenommen habe:


Bash:
root@nfs:~# lvextend -r -l +100%FREE video/lv_data
  File system ext4 found on video/lv_data mounted at /mnt/video.
  Size of logical volume video/lv_data changed from <1000,00 GiB (255999 extents) to 1,17 TiB (307199 extents).
  Extending file system ext4 to 1,17 TiB (1288485994496 bytes) on video/lv_data...
resize2fs /dev/video/lv_data
resize2fs 1.47.2 (1-Jan-2025)
Filesystem at /dev/video/lv_data is mounted on /mnt/video; on-line resizing required
old_desc_blocks = 125, new_desc_blocks = 150
The filesystem on /dev/video/lv_data is now 314571776 (4k) blocks long.

resize2fs done
  Extended file system ext4 on video/lv_data.
  Logical volume video/lv_data successfully resized.
root@nfs:~#

Nun schaut es auch gut aus:


Bash:
root@nfs:~# lvdisplay
  --- Logical volume ---
  LV Path                /dev/nfs-vg/root
  LV Name                root
  VG Name                nfs-vg
  LV UUID                i6Tu73-NF2v-HDDq-g2Ny-QjcB-Jq5g-EECK3i
  LV Write Access        read/write
  LV Creation host, time nfs, 2026-01-03 23:33:04 +0100
  LV Status              available
  # open                 1
  LV Size                <8,14 GiB
  Current LE             2083
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1

  --- Logical volume ---
  LV Path                /dev/nfs-vg/swap_1
  LV Name                swap_1
  VG Name                nfs-vg
  LV UUID                0eJfMH-OWLl-c0Fs-sQ5f-Ym0q-erbz-S3V0Dn
  LV Write Access        read/write
  LV Creation host, time nfs, 2026-01-03 23:33:04 +0100
  LV Status              available
  # open                 1
  LV Size                <1,62 GiB
  Current LE             414
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:2

  --- Logical volume ---
  LV Path                /dev/nfs-vg/home
  LV Name                home
  VG Name                nfs-vg
  LV UUID                Wrt6oy-cFX9-m382-4eST-bkJj-BJOG-6WIRF7
  LV Write Access        read/write
  LV Creation host, time nfs, 2026-01-03 23:33:04 +0100
  LV Status              available
  # open                 1
  LV Size                21,25 GiB
  Current LE             5440
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:3

  --- Logical volume ---
  LV Path                /dev/video/lv_data
  LV Name                lv_data
  VG Name                video
  LV UUID                K49VTW-AwnL-cNOd-Tdtt-et4A-cAUk-vGdXxT
  LV Write Access        read/write
  LV Creation host, time nfs, 2026-01-05 22:39:17 +0100
  LV Status              available
  # open                 1
  LV Size                1,17 TiB
  Current LE             307199
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0

root@nfs:~# pvs
  PV         VG     Fmt  Attr PSize  PFree
  /dev/sda5  nfs-vg lvm2 a--  31,04g 40,00m
  /dev/sdb   video  lvm2 a--   1,17t     0
root@nfs:~# lvs
  LV      VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home    nfs-vg -wi-ao---- 21,25g
  root    nfs-vg -wi-ao---- <8,14g
  swap_1  nfs-vg -wi-ao---- <1,62g
  lv_data video  -wi-ao----  1,17t
root@nfs:~# df -hT
Dateisystem               Typ      Größe Benutzt Verf. Verw% Eingehängt auf
udev                      devtmpfs  1,9G       0  1,9G    0% /dev
tmpfs                     tmpfs     393M    544K  392M    1% /run
/dev/mapper/nfs--vg-root  ext4      8,0G    1,1G  6,5G   14% /
tmpfs                     tmpfs     2,0G       0  2,0G    0% /dev/shm
tmpfs                     tmpfs     5,0M       0  5,0M    0% /run/lock
tmpfs                     tmpfs     1,0M       0  1,0M    0% /run/credentials/systemd-journald.service
tmpfs                     tmpfs     2,0G       0  2,0G    0% /tmp
/dev/sda1                 ext4      943M     74M  804M    9% /boot
/dev/mapper/nfs--vg-home  ext4       21G    2,1M   20G    1% /home
/dev/mapper/video-lv_data ext4      1,2T    917G  206G   82% /mnt/video
tmpfs                     tmpfs     1,0M       0  1,0M    0% /run/credentials/getty@tty1.service
tmpfs                     tmpfs     393M    8,0K  393M    1% /run/user/1000
root@nfs:~#
 
Weil es dir hier keine wirklichen Vorteile bringt. Zumindest fallen mir gerade keine ein. Du nutzt nur ein LV und ein Dateisystem direkt auf der Festplatte hätte auch nur ein Befehl zum erweitern benötigt :)
 
  • Like
Reactions: maze-m
Okay, vielen lieben Dank nochmal! Wahrscheinlich bringt's eher was, wenn ich mehrere Platten hätte und die zu einem LVM zusammenfügen würde :)....

Aber gut, "it works as designed" :)....