Resizing ext4 partition of a guest Ubuntu on vmdk on ESXi 6.0

I have rather old ESXi 6.0 that hosts a vm with Ubuntu. I need to increase the disk for it.

I don't have vmware-vdiskmanager as advised in

1 Answer

Here are the steps that worked for me:

On ESXi

Find vm id:

vim-cmd vmsvc/getallvms

And power off:

vim-cmd vmsvc/power.off 6

Resize the vmdk file (specify xxxxx.vdmk instead of xxxxx-flat.vmdk):

vmkfstools -X 500G xxxxx.vmdk

Power on vm:

vim-cmd vmsvc/power.on 6

On guest vm

Use parted and resize2fs:

$ 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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like