增加虚拟机硬盘大小失败,无可用扇区

增加虚拟机硬盘大小失败,无可用扇区

我正在关注此链接增加我的虚拟机的大小。我通过进入虚拟机的“设置”页面将磁盘大小(从 100GB 增加到 200GB)增加了。

~ $sudo fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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 label type: dos
Disk identifier: 0x000ad9ca

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048   209715199   104344576   8e  Linux LVM

Disk /dev/mapper/centos-root: 102.7 GB, 102680756224 bytes, 200548352 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 /dev/mapper/centos-swap: 4160 MB, 4160749568 bytes, 8126464 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

我没有尝试对未分配的空间进行分区,并且No free sectors available我在运行 fdisk 时得到了结果。

~ $sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): p
Partition number (3,4, default 3):
No free sectors available

关于如何克服此错误并更新虚拟机上的磁盘大小,有什么建议吗?

答案1

fdisk -l重新启动虚拟机有帮助。重新启动后,执行时可以看到新磁盘。

相关内容