APFS Volume Total Shows Less Free Space Than Container and How Can I Reclaim Space

Solution 1:

The results from the math shown below is about 17.3 GB of unallocated space.

 250.0     Total drive space
   -.2907  EFI partition
-190.0     APFS container
   -.1342  Microsoft Reserved
 -42.9     BOOTCAMP
   -.4719  Windows Recovery
_________
  17.2842  Unallocated space

I assume this unallocated space is between the Apple_APFS and Microsoft Reserved partitions. If so, then the correct command to add the free space to the Apple_APFS partition is given below. Before using this command, open the MiniTool application and confirm the free space is between the Apple_APFS and Microsoft Reserved partitions.

sudo diskutil apfs resizeContainer disk0s2 0

From the information you posted, I am guessing the free space will between the Microsoft Reserved and Microsoft Basic Data partitions. If this is the case, then you will first need to move the Microsoft Reserved partition partition to the end of the free space. Below is an outline of the steps to follow.

  1. The MiniTool can not move this partition. Instead you can make a copy of the partition.
  2. The copy of the Microsoft Reserved partition will have the wrong partition type id. You will need to use the MiniTool application to change this id to Windows - Microsoft Reserved Partition.
  3. The new partition will need to be assigned the GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER attribute bit. Basically, this is bit 0x8000000000000000. Unfortunately, this can to be done using MiniTool. You will have to use the diskpart command from a Administrator Command Prompt window.
  4. After exiting diskpart, you will need to reboot Windows.
  5. Use the MiniTool to remove the original Microsoft Reserved partition.

A final note:

You posted the following question.

That operation successfully executed and as you will see, container for APFS is at 190 GB now. But my Macintosh HD is still occupying 165.4 GB. I tried resizing using (/usr/sbin/diskutil apfs resizeContainer /dev/disk1 0) but to no avail. Does anyone know how I can reclaim the 20 GB space I freed up before and use container to its max capacity?

Answer: Basically, the question makes no sense. The APFS container has a size of 190 GB and the Macintosh HD volume is using 165.4 GB of this container's space. If you enlarge the APFS container, the size of the Macintosh HD volume will not change.