There are many users who have complained about the POSIX error emerging during partitioning of Mac hard disk drive. "The POSIX error reports, The operation could not be completed. Cannot allocate memory".
Mac systems usually do not create any issues unless unavoidable situation do come up. You might have faced some unwanted and unknown errors while performing some disk related operations on Mac hard drive, external drive or USB flash media. POSIX error emerges when you try to either partition or format Mac hard drives and the error message you encounter is : 'Disk Erase failed with the error: POSIX reports: The operation couldn’t be completed. Cannot allocate memory'. Having this error to occur, your work stops in the middle. Actually, this POSIX error is more likely specific for USB chipsets and firmware versions or settings in certain drive enclosures. In addition to this, possibilities are that other multiple errors may have infected your Mac systems concerned to POSIX error.
Users perception is that such type of error can be resolved just by swapping or wiping drives, replacing memory modules, installing OS, etcetera but these do not work when the same problem again arises.
If you happen to receive PPOSIX error while working over Disk Utility tool then at first check whether your system boots up or not. If not then boot up your system from external OS drive and when internal system is mounted and then try to copy and paste files over System Disk for internal drive.
However, the problem is to overcome the default partition related issues over USB connections while using Disk Utility, you can go for using terminal commands as an alternative option. Initially, you need to format the hard drive and then it will become accessible through Disk Utility. Those terminal commands are :
Enter the 'diskutil' command in the terminal to format the drive and now replace the 'NAME' with desired drive name and 'IDENTIFIER' with ID of drive.
This command is an alternative command for 'diskutil” to create partitions and set up hard drive. Here, you again need to replace IDENTIFIER with drive's ID.
In case, having tried 'diskutil' and 'fdisk' commands in terminal and still nothing works then you certainly need a professional software. Stellar Partition Manager is best software when it comes to partition a Mac disk and to tackle disk related issues.