调整 ESXi 6.0 上 vmdk 上客户机 Ubuntu 的 ext4 分区大小

调整 ESXi 6.0 上 vmdk 上客户机 Ubuntu 的 ext4 分区大小

我有一台相当老旧的 ESXi 6.0,它托管着一台装有 Ubuntu 的虚拟机。我需要为其增加磁盘空间。

我没有vmware-vdiskmanager按照建议https://kb.vmware.com/s/article/1004047

答案1

以下是对我有用的步骤:

在 ESXi 上

查找虚拟机 ID:

vim-cmd vmsvc/getallvms

并关闭电源:

vim-cmd vmsvc/power.off 6

调整 vmdk 文件的大小(请指定xxxxx.vdmk而不是xxxxx-flat.vmdk

vmkfstools -X 500G xxxxx.vmdk

启动虚拟机:

vim-cmd vmsvc/power.on 6

在客户虚拟机上

使用partedresize2fs

$ sudo parted
GNU Parted 3.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 537GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  500GB   500GB   ext4

(parted)
(parted)
(parted) resizepart 2
Warning: Partition /dev/sda2 is being used. Are you sure you want to continue?
Yes/No? Yes
End?  [500GB]? 537GB
(parted) q
Information: You may need to update /etc/fstab.
$ sudo resize2fs /dev/sda2
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 59, new_desc_blocks = 63
The filesystem on /dev/sda2 is now 131071483 (4k) blocks long.

相关内容