How to resize my macOS virtual machine hard drive if there are no reflecting changes in my guest macOS partition?
One can still extend a virtual hard disk size, however, a guest macOS (macOS virtual machine) partition size will remain the same.
NOTE: Make sure you have a backup copy of this virtual machine before you do the following.
For macOS 10.15 guests and above
1. To change the size of the virtual machine open its configuration -> Hardware -> Hard disk:
2. Click Properties and move the slider to the desired amount
3. Click Apply to save changes. A notification regarding the necessity of making a backup of the virtual machine will appear. Click Continue to apply changes.
4. After the virtual disk resizing, the guest macOS will treat the disk as a larger one, so the overall disk capacity will be increased. So, open Disk Utility inside the macOS virtual machine and click Partition icon:
5. When asked whether to add a Volume or partition device click Partition:
6. Click Free space partition -> "-" . The Free space partition will be removed and this space will be automatically added to Macintosh HD partition.
7. Click Apply.
For macOS 10.14 Mojave guests
After the virtual disk resizing, the guest macOS will treat the disk as a larger one, so the overall disk capacity will be increased. Now you need to do the following:
1. Open Disk Utility in macOS VM (Finder -> Applications -> Utilities -> Disk Utility)
2. Select Macintosh HD and click Partition
3. When asked whether to add a Volume or partition device click Partition
4. Click Macintosh HD partition, enter new desired partition size and click Apply
Now the disk size is correct in the guest macOS:
For macOS 10.13 High Sierra guests
1. Open Terminal in guest OS (Finder -> Applications -> Utilities -> Disk Utility) and execute the following command:
diskutil apfs list
2. Find the disk name in APFS Physical Store Disk field. In our case it's disk0s2, copy it somewhere:
3. Combine the following command:
sudo diskutil apfs resizeContainer <disk_name> <desired_disk_size>
Where <disk_name> is the name of the disk from point 2. and <desired_disk_size> is the disk size you want to set for this virtual machine. In our case when we want to enlarge disk0s2 to 90 GB the command will be:
sudo diskutil apfs resizeContainer disk0s2 90GB
NOTE: you will be prompted to use your password. There will be no symbols shown while typing, so you just need to hit the keys and then Enter/return
For macOS 10.12 Sierra guests and older versions of macOS
Follow the same instructions as for Mojave guest.