I have an external hard drive, I have created a macOS High Sierra bootable USB with Clover Boot Disk to install macOS on this hard drive. But I can not Erase one of the partitions on this hard disk to format it to Mac OS Extended (Journaled) or APFS. Disk Utility reported an error:
Unmounting disk MediaKit reports not enough space on device for requested operation. Operation failed...
I then did some testing by installing macOS High Sierra on the VMware Workstation and creating three partitions on a new virtual hard disk using Disk Utility.
I noticed that the partitions were created by Disk Utility under a special rule. Look at the partition table of the above virtual hard disk through GParted, we can see two points:
- An EFI partition is automatically created at the beginning of the hard disk with a size of 200MB.
- After each partition will have 128MB unallocated (except the EFI partition above).
After looking for some more information, now I understand. My external hard drive is Hitachi HGST 500GB, and some others also have this problem on WD My Passport and USB. But the hard disk vendor is not the cause, nor does it depend on you using Hackintosh or Macintosh. The main reason is that we have created partitions that do not conform to Apple’s Partitioning policy.
Depending on your situation you should choose the appropriate solution. Either delete all the partitions on the hard disk and re-initialize, all the data on the disk will be lost. Either create a 200MB EFI partition at the beginning of the disk and resize each partition to leave 128MB unallocated.
Alternatively, you can create partitions using third-party tools such as GParted or Disk Management. If you need to create a new partition to install macOS High Sierra, just create a Mac OS Extended (Journaled) partition with GParted, then convert to APFS using Disk Utility. But you will still get the error MediaKit reports not enough space on device for requested operation on Disk Utility until your hard disk meets Apple’s Partitioning policy.
If you do not want to keep the data on the hard drive, it is best to delete all partitions on the disk and re-initialize.
- Open Terminal.
- Use the diskutil list command to get a list of disks and partitions:
- Unmount all partitions on disk using Disk Utility or use diskutil unmount:
sudo diskutil unmount /dev/diskXsY
- Use the dd command to clean the first 4096 bytes of the disk:
sudo dd if=/dev/zero of=/dev/diskX bs=4096 count=1
- You can now click Erase in Disk Utility to initialize the disk.
Otherwise, if you have a lot of important data, just create an EFI partition and leave 128MB unallocated after each partition. Apple’s Partitioning policy only applies to GPT disks, not MBR disks.
From the information above we can use third-party tools to modify the partitions on the hard disk meet the following conditions:
- For Small disks (1 GB <= size <2 GB), leave 128MB unallocated after each partition you create. No need to create an EFI partition.
- For Large Disks (2GB <= size), leave 128MB unallocated after each partition that you created (except the EFI partition and the MSR partition). An EFI partition of 200MB must be created at the beginning of the disk.
If you do not have enough 200MB unallocated at the beginning of the disk, just use GParted to move or resize the partition first. Then create an EFI partition, for Windows, simply use diskpart.
diskpart list disk select disk X create partition efi size=200 format quick fs=fat32 label="ESP"
For GParted, just create a FAT32 partition, then right-click on the partition and select Manage Flags, check the box for esp and boot.
For NTFS partitions, you can use the Shrink feature in Disk Management to shrink 128MB. It’s fast, safe and does not lose data.
For GParted, enter at least 128 MB for Free space following (MiB). If you create a new partition, just enter at least 128MB for Free space preceding (MiB).
You can now use Disk Utility to create and format partitions on your hard disk. Disk Utility will no longer report MediaKit reports not enough space on device for requested operation. Please note that leave 128MB unallocated after each partition if you create new partitions using third-party tools. Good luck!