There are two partitions currently allocated on my 100 GiB hard disk. However, only ~85GB is formatted and I cannot expand /dev/disk0s2
to the maximum size with various attempts such as diskutil
and gpt
. The last ~20 GB free space does exist, but it cannot be partitioned. disk0
is a VMware vmdk resized from 85 GB to 107 GB with vmware-vdiskmanager.
What may cause this? And how should I achieve the goal?
Best Answer
Since resizing the partition that is currently mounted for the operating system is impossible and the filesystem (FS) may be corrupted. One of the solutions is to use a live CD, especially GParted Live ISO which has installed many tools related to disk management such as partition.
However, GParted can check the integrity of the FS, but it is not able to resize the partition to the maximum size. Hence,
parted
, a command-line tool, is used. (Thanks for @klanomath 's hints.)Step 1: Find out which partition has to be expanded.
Step 2: Expand the selected partition to the designated sector.
Step 3: Shutdown the Live system.
Step 4: Restart the macOS VM, and repair the disk.