How to fix: MediaKit reports not enough space on device for requested operation
Today I bought a brand new external hard drive WD Elements Portable 1Tb. A Western Digital company says that it can be used on both Windows and macOS. But most WD drives come formatted in the NTFS file system format for OS Windows, while for macOS we needed the HFS+ format or the Apple’s brand new APFS (Apple File System) format.
macOS can read but not write to NTFS formatted drives. So the only workaround is to format the drive to HFS+ or APFS. The easiest way to format the drive is by using macOS built-in Disk Utility app. I started up the Disk Utility and tried to Erase it and make it APFS, but every time I try, I get the following error:
MediaKit reports not enough space on device for requested operation.
After several attempts, I tried formatting to HFS+, and get the same error.
What causes this error
This is not a WD issue. It can happen with a disc from any manufacturer. But this is not a problem with the disc at all. It’s all about the brand new APFS file system. At an early stage, there are usually some problems. In this case, the “Disk Utility” app could not correctly prepare the disk for APFS file system. After some time, this issue will most likely be fixed.
In my case, it’s my fault, I started to reformat my new hard drive from NTFS to APFS format instead of the usual HFS+ format. I used the old method to prepare the WD hard drive for use with macOS. But then I found this instruction. New instruction says that we first need to reformat NTFS into Mac OS Extended (Journaled), and then convert it to APFS format.
What I have:
- Drive: WD Elements Portable 1Tb
- OS: macOS High Sierra 10.13
WD Community Knowledge Base:
- Reformatting Required for Mac OS Compatibility
- How to format a WD hard drive to exFAT or FAT32
- How to Convert a WD External Drive to APFS Format
How to solve it
Critical! The instructions in the article below are designed to help repartition and format a hard drive. This process is data destructive and cannot be undone. Once the process begins, all the data on the drive will be lost!
Be careful working with disks in the terminal. Incorrect actions can lead to data loss and even computer failure.
To solve this problem, we will use the Terminal app and the two tools diskutil
and dd
. Both tools are built-in in macOS, so we do not need to download or install anything.
Launch the Terminal app from the Utilities folder of your Applications folder, or use Spotlight to find it.
Firstly we need to identify the mount name of our disk (hard drive):
diskutil list
/dev/disk0 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *121.3 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_APFS Container disk1 121.1 GB disk0s2 /dev/disk1 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +121.1 GB disk1 Physical Store disk0s2 1: APFS Volume Macintosh HD 105.9 GB disk1s1 2: APFS Volume Preboot 20.3 MB disk1s2 3: APFS Volume Recovery 519.9 MB disk1s3 4: APFS Volume VM 3.2 GB disk1s4 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *1000.2 GB disk2 1: EFI EFI 209.7 MB disk2s1 2: Apple_HFS Elements 999.8 GB disk2s2
There are two types of devices (methods to communicate with devices):
- raw devices
/dev/rdisk*
, communication is direct with the disk.- buffered devices
/dev/disk*
, data transit via buffer.When using
dd
or other duplication programs, always use raw device.
The below commands assume this is disk2
, but replace disk2
with the correct disk if it’s something different.
Before any operations on the disk we must unmount it:
diskutil unmountDisk force disk2
Forced unmount of all volumes on disk2 was successful
Warning! Do not forget to replace the
disk2
before pressing the key Enter.
Now we will write zeros to the disk (this will erase the entire disk):
sudo dd if=/dev/zero of=/dev/rdisk2 bs=1024 count=1024
Warning! Do not forget to replace the
rdisk2
before pressing the key Enter.
This command will prompt us to enter our computer password. Enter your password and then watch the magic happen…
Note! It’s normal that the password you enter is not displayed. This is how the password is entered on the command line. Just enter your password, and then press the Enter key.
Password: 1024+0 records in 1024+0 records out 1048576 bytes transferred in 0.890086 secs (1178062 bytes/sec)
Note! If you get the following message:
-bash: sudo: command not found
then just removesudo
from the command. In this case, you will not be prompted for the password of your computer.
Let’s now try to partition the disk. This will be the GUID Partition Table (GPT) and the Journaled HFS+ format of file systeme:
diskutil partitionDisk disk2 GPT JHFS+ "Elements" 0g
Started partitioning on disk2 Unmounting disk Creating the partition map Waiting for partitions to activate Formatting disk2s2 as Mac OS Extended (Journaled) with name Elements Initialized /dev/rdisk2s2 as a 998 GB case-insensitive HFS Plus volume with a 57344k journal Mounting disk Could not mount disk2s2 after erase Finished partitioning on disk2 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *1000.2 GB disk2 1: EFI EFI 209.7 MB disk2s1 2: Apple_HFS Elements 999.8 GB disk2s2
Note! Replace “Elements” with the name that you want to give to your hard drive.
Note! To get Master Boot Record (MBR) instead of GUID Partition Table (GPT), simply replace the “GPT” mention to “MBR”. That should work.
Warning! Do not forget to replace the
disk2
before pressing the key Enter.
Looks good. Our WD hard drive work again.
Finally, we can use the Disk Utility app to convert our hard drive from HFS+ format to APFS format. You can read more in this article.
Note! Converting a hard drive from HFS+ to APFS using Disk Utility app is optional. You can skip this step if you want to leave your hard drive in the HFS+ format.
Note! APFS requires macOS High Sierra (10.13). A macOS Sierra (10.12) or earlier versions of the Mac operating system don’t mount APFS-formatted volumes.
Conclusion
That’s it, you’re done. So simple isn’t it?
If you are having trouble fixing this problem with the instructions above, but are being able to solve this problem with any another method please describe it in the comment section below. Thanks!
If this article has helped you solve the problem then please leave a comment
Thanks for reading!
Arthur is a designer and full stack software engineer. He is the founder of Space X-Chimp and the blog My Cyber Universe. His personal website can be found at arthurgareginyan.com.