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?
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'