在不关闭 VM 的情况下调整 lvm 分区的大小

Resize lvm partition without shutting down VM

我调整了 qcow2 图像的大小以增加它的大小,在此过程中我传递了错误的设备进行扩展,现在 virt-filesystems 显示:

[root@node3 35]# virt-filesystems --long --parts --blkdevs -h -a disk.0
Name       Type       MBR  Size  Parent
/dev/sda1  partition  83   243M  /dev/sda
/dev/sda2  partition  05   1.0K  /dev/sda
/dev/sda5  partition  8e   9.8G  /dev/sda
/dev/sda   device     -    40G   -

我想调整 /dev/sda5 的大小以从 /dev/sda 中获取所有 40G 但在虚拟机 fdisk、lv 工具、parted 中不显示 space 而我是有点迷路。

感谢任何帮助或指导。

Fdisk 输出:

root@ubuntu:~# fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes
16 heads, 63 sectors/track, 83220 cylinders, total 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000bd79d

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048      499711      248832   83  Linux
/dev/vda2          499712    83883647    41691968    5  Extended
/dev/vda5          499714    20967425    10233856   8e  Linux LVM

Disk /dev/mapper/ubuntu--vg-root: 9940 MB, 9940500480 bytes
255 heads, 63 sectors/track, 1208 cylinders, total 19415040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/ubuntu--vg-root doesn't contain a valid partition table

Disk /dev/mapper/ubuntu--vg-swap_1: 536 MB, 536870912 bytes
255 heads, 63 sectors/track, 65 cylinders, total 1048576 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/ubuntu--vg-swap_1 doesn't contain a valid partition table

我最终创建了一个新分区 /dev/vda6,并将其添加到 LVM 组。