macOS not allowing me to reallocate free space! I had two partitions on my mac, both had macOS installed on it as a result both had a recovery partiton, now I deleted one pratition cause it got corrupted due to some script which I ran. 

Now mac has only one partition which is the startup volume.

The problem is the previous partition created a free space upon removing it and it is not allocated to anyone, now when I try to delete the free space, Disk Utility fails to carry out the opertaion!




Both the partitons also created a public folder, which I don't know much about cause I never created it, now the problem is what should I do with this public folder should I remove it from my system preferences or should I keep it, I don't know what might happen/get deleted if I remove it from my iMac!



So basically two issues have arised as a consequence of the corruption and running a custom script for tweaking your mac!

I went through this https://www.reddit.com/r/osx/comments/305lik/help_removing_the_free_space_partition/ post but it doesn't seems to be linked with my issue as I don't have any (No CoreStorage logical volume groups found - Terminal output for diskutil cs list; diskutil list)

And when I try to resize the disk via Terminal I get this error:

Sayans-iMac:~ sayanhussain$ diskutil resizeVolume disk0s2 R
Resizing to full size (fit to fill)
Started partitioning on disk0s2 macOS
Error: -69742: The requested size change for the target disk or a related disk is too small; please try a different disk or partition, or make a larger change
Sayans-iMac:~ sayanhussain$
Ok so the error is now solved. What I did!

First I ran diskutil list to view all the active partitions, now I had only on partiton so added a new partiton via DiskUtility

Then I once again ran diskutil list, now I was able to see the newly added partiton

Now what I did ti remove the free space is that I merged both the partitions together 

To merge two partitons I simply ran this command in terminal 

Sayans-iMac:~ sayanhussain$ diskutil mergePartitions
Usage:  diskutil mergePartitions [force] format name
        DiskIdentifier|DeviceNode DiskIdentifier|DeviceNode

Merge two or more pre-existing partitions into one.  The first disk parameter
is the starting partition; the second disk parameter is the ending partition;
this given range of two or more partitions will be merged into one.

All partitions in the range, except for the first one, must be unmountable.

All data on merged partitions other than the first will be lost; data on the
first partition will be lost as well if the "force" argument is given.

If "force" is not given, and the first partition has a resizable file system
(e.g. JHFS+), it will be grown in a data-preserving manner, even if a different
file system is specified (in fact, your file system and volume name parameters
are both ignored in this case). If "force" is not given, and the first
partition is not resizable, you will be prompted if you want to erase.

If "force" is given, the first partition is always formatted. You should
do this if you wish to reformat to a new file system type.

Merged partitions are required to be ordered sequentially on disk.
See diskutil list for the actual on-disk ordering; BSD slice identifiers
may in certain circumstances not always be in numerical order but the
top-to-bottom order given by diskutil list is always the on-disk order.

Ownership of the affected disk is required.

Example: diskutil mergePartitions JHFS+ NewName disk3s4 disk3s7
         This example will merge all partitions *BETWEEN* disk3s4 and disk3s7,
         preserving data on disk3s4 but destroying data on disk3s5, disk3s6,
         disk3s7 and any invisible free space partitions between those disks;
         disk3s4 will be grown to cover the full space if possible.
Sayans-iMac:~ sayanhussain$