在扩展VCenter VM上LVM设备忙

我试图在VCenter上扩展一个LVM组,但没有取得太大的成功。

我遵循这个指南来扩展虚拟机磁盘,并创build新的主分区/dev/sda3 。 当我继续使用pvcreate -vv /dev/sda3命令时,我得到:

 # pvcreate -vv /dev/sda3 Setting activation/monitoring to 1 Setting global/locking_type to 1 Setting global/wait_for_locks to 1 File-based locking selected. Setting global/prioritise_write_locks to 1 Setting global/locking_dir to /run/lock/lvm Setting global/use_lvmlockd to 0 metadata/pvmetadataignore not found in config: defaulting to 0 metadata/pvmetadatasize not found in config: defaulting to 255 metadata/pvmetadatacopies not found in config: defaulting to 1 Locking /run/lock/lvm/P_orphans WB Setting response to OK Setting response to OK Setting id to ftrG8E-TB42-4ilL-dQnc-hLoK-wb8G-4KqGWb Setting vgid to QQ20nS-fyFe-Eedo-vrDl-w7V0-q7bR-kY51WH Setting vgname to conserver-vg Setting format to lvm2 Setting device to 2053 Setting dev_size to 16666066944 Setting label_sector to 1 Setting size to 1044480 Setting start to 4096 Setting ignore to 0 Setting response to OK Setting response to OK Setting name to conserver-vg Setting metadata/format to lvm2 Setting id to ftrG8E-TB42-4ilL-dQnc-hLoK-wb8G-4KqGWb Setting format to lvm2 Setting device to 2053 Setting dev_size to 32550912 Setting label_sector to 1 Setting size to 1044480 Setting start to 4096 Setting ignore to 0 Setting response to OK Setting response to OK /dev/sda3: size is 2046 sectors Setting devices/sysfs_scan to 1 Setting devices/multipath_component_detection to 1 Setting devices/md_component_detection to 1 Setting devices/fw_raid_component_detection to 0 Setting devices/ignore_suspended_devices to 0 Setting devices/ignore_lvm_mirrors to 1 devices/filter not found in config: defaulting to filter = [ "a|.*/|" ] Setting devices/cache_dir to /run/lvm Setting devices/cache_file_prefix to devices/cache not found in config: defaulting to /run/lvm/.cache Setting devices/write_cache_state to 1 Setting global/use_lvmetad to 1 /dev/sda3: size is 2046 sectors Device /dev/sda3 not found (or ignored by filtering). Unlocking /run/lock/lvm/P_orphans 

以下是类似post的一些输出:

 # uname -a Linux conserver 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux # fdisk -l /dev/sda Disk /dev/sda: 32 GiB, 34359738368 bytes, 67108864 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 Disklabel type: dos Disk identifier: 0x161f94c6 Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 999423 997376 487M 83 Linux /dev/sda2 1001470 33552383 32550914 15.5G 5 Extended /dev/sda3 999424 1001469 2046 1023K 8e Linux LVM /dev/sda5 1001472 33552383 32550912 15.5G 8e Linux LVM Partition table entries are not in disk order. # grep -i filter /etc/lvm/lvm.conf # returns all results as comments # df -h / Filesystem Size Used Avail Use% Mounted on /dev/mapper/conserver--vg-root 9.3G 8.3G 492M 95% / 

我迷失在如何能够扩展这个LVM而不能添加新的分区!

谢谢

为了在线resize,我创build了一个小脚本来生成所需的命令。 请参阅: https : //github.com/mircea-vutcovici/scripts/blob/master/vol_resize.sh

它涵盖了Linux上使用的最stream行的磁盘标签和文件系统。

您可以在不重新启动机器的情况下完成所有这些调整。