Unable to format / erase hard drive



I have an external HD that died on me a while ago and I'm trying to see if I can format / erase it to start using it again.

The disk does not show up in Finder but I can see it in Disk Utility. When I try to erase it from there I get

Disk Erase failed with the error:
POSIX reports: The operation couldn’t be completed. Cannot allocate memory

When I try to verify the volume:

diskutil verifyVolume /dev/disk2
Error starting filesystem verification for disk2: Unrecognized filesystem (-9958)

I've tried running a surface scan in Techtools Pro, it processed 650 blocks and all were bad. I cancelled the operation cause it was very slow.

Diskutil info /dev/disk2 tells me:

Device Identifier:        disk2
   Device Node:              /dev/disk2
   Part Of Whole:            disk2
   Device / Media Name:      WD Ext HDD 1021 Media

   Volume Name:              
   Escaped with Unicode:     

   Mounted:                  No

   File System:              None

   Partition Type:           None
   Bootable:                 Not bootable
   Media Type:               Generic
   Protocol:                 USB
   SMART Status:             Not Supported

   Total Size:               2.0 TB (2000396746752 Bytes) (exactly 3907024896 512-Byte-Blocks)
   Volume Free Space:        Not Applicable

   Read-Only Media:          No
   Read-Only Volume:         Not applicable (no filesystem)
   Ejectable:                Yes

   Whole:                    Yes
   Internal:                 No
   OS 9 Drivers:             No
   Low Level Format:         Not Supported

I've also tried:

diskutil eraseDisk JHFS+ Stef2TB /dev/disk2
Started erase on disk2
Unmounting disk
Creating partition map
Waiting for disks to reappear
Formatting disk2s2 as Mac OS Extended (Journaled) with name Stef2TB
Error: -9944: File system formatter failed

Can I salvage this drive somehow or is it ready for the trash?


Posted 2014-03-30T08:28:14.250

Reputation: 242

Did you find the answer in the end? Im having the exact same issue.. – None – 2014-08-20T12:37:01.020



I found this worked perfectly (from the terminal):

diskutil eraseVolume ExFAT MyName diskX

You'll need to change diskX to whatever the number is for your drive. You can find that out in disk utility, select the drive, click info, and look under 'BSD device node'


Posted 2014-03-30T08:28:14.250

Reputation: 385

this worked perfect, my issue was i interrupted a dd process where i was trying to make a bootable SD and it then had a 3GB volume on my 64GB card, doing this cleaned it up – SeanClt – 2016-04-08T02:55:16.380

1@SeanClt same here! none of the other solutions worked for me. – dc95 – 2016-08-30T20:54:08.600

Anyone wanting a different format than ExFAT, you can type man diskutil in Terminal to reference the manual and find out what to type to get your desired format. Type q to quit when done reading. There are also some other commands besides eraseVolume that might better suit your reformatting needs. – Mentalist – 2017-12-05T04:48:31.910

Then I'm just getting "Error: 22: Invalid argument" after 10 or so seconds of it attempting to erase. Edit: The name needed to be wrapped like so 'MyName' – Nathan Hornby – 2018-03-06T16:48:34.250


Before trashing it try this:

In disk utility Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Click on the Options button, set the partition scheme to GUID then click on the OK button.

Set the format type to Mac OS Extended (Journaled.)

Click on the Partition button and wait until the process has completed.

Next step:

Select the volume you just created (this is the sub-entry under the drive entry) from the left side list.

Click on the Erase tab in the DU main window.

Set the format type to Mac OS Extended (Journaled.)

Click on the Security button, check the button for Zero Data and click on OK to return to the Erase window. Click on the Erase button.

The format process can take up to several hours depending upon the drive size


Posted 2014-03-30T08:28:14.250

Reputation: 35 740

When I try to create the partition I get "Partition failed with the error:File system formatter failed". When I try again I get "POSIX reports: The operation couldn’t be completed. Cannot allocate memory". Any other options? – stef – 2014-03-30T13:48:45.137

I was trying to avoid this, but it does look like trashing is the option. – Buscar웃 – 2014-03-30T14:13:13.603

Ah well we tried. Thanks for your advise. – stef – 2014-03-30T14:15:32.990

@stef one last option would be to remove the drive from the enclosure, disconnect it from the SATA interface, and then attach to diff. SATA bus (whether on hub, or SATA to USB cable). Would take some effort, but if the data is valuable enough and not backed up, it may be worth trying. Still, in all likelihood, it's mechanical failure of the drive head and not a problem with the SATA connection. – njboot – 2014-08-20T16:23:23.417

I did as you advised once and it failed. Then I tried a second time (leaving the name "Untitled") and it worked. Not sure if it was the second try or omitting a name that did it, but it worked. (Renamed it later with Finder's "Get Info") – Mentalist – 2017-12-05T04:39:55.050


I found that this worked for a USB drive to erase and format it as HFS+ with journaling.

sudo diskutil eraseDisk  JHFS+ 'My disk name' diskX

Where X is a number. First run sudo diskutil list to find the relevant disk3, etc - check the size and make sure it's the right disk!


Posted 2014-03-30T08:28:14.250

Reputation: 147


This worked for me! Disk Utility > View > Show all devices.

This made the troublesome drive's item in the sidebar become an item of larger item (sorry my vocabulary sucks).

Select the larger one and start the erase process from there. See if that works!

[Beginning state

View > Show all devices

New item

Tobin Knollys

Posted 2014-03-30T08:28:14.250

Reputation: 21


Before you trash your drive, it is also worth restarting the mac.

Sounds simple, but first boot after an OS upgrade or with a failed disk mount due to timing problems, and the system can get confused.

A reboot sorts this out. Happened to me: disk utility couldn't erase or reformat, tried all of the above, including macissues' bash script for overwriting the disk in terminal, multiple unplug/plug-in for the drive.... to no avail. Started the mac, and all was well: reformatted and on its way.


Posted 2014-03-30T08:28:14.250

Reputation: 111


On the left hand side of your finder, check the list of devices that are mounted. There may be more than one disk mounted. Eject all the mounted ones except for the one that you have to format. Now go to disk utility, select external hard drive and erase. This should work.

Aditya Mukesh Thakur

Posted 2014-03-30T08:28:14.250

Reputation: 11


I was having exactly the same problem as described above; unable to reformat my 16GB USB after interrupting an "erase free space" command. This worked http://www.macissues.com/2014/04/05/how-to-fix-deep-formatting-problems-with-os-x-drives/ The instructions are clear & simple, no Terminal experience required. The command will force a reformat--of course any data will be lost, but your drive will be usable. EDIT: After doing this, my pendrive wouldn't mount but was detected by Disk Utility. I simply selected it and formatted it and voila! It mounts and works!

Jaans Conifer Reinreb

Posted 2014-03-30T08:28:14.250

Reputation: 1


Hi Jaans, while this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. Please take a look here: Why and how are some answers deleted?

– bummi – 2015-04-22T20:41:14.747


The only solution for me was to format this USB drive on Windows. Also, the Quick Format didn't seem to work, I had to performa a standard format who took very long.

I don't understand what happened to the drive to be honest, I never had any error when formatting until now


Posted 2014-03-30T08:28:14.250

Reputation: 101


Sometimes there's a problem with flash disk that is null name and only format corrupting data. Other problem is flash disk that are no media. There's no solution for this removable disks.

Thiago Freitas

Posted 2014-03-30T08:28:14.250

Reputation: 1