How do I force a partition and format on a USB key in OS X Mountain Lion Disk Utility or from CLI diskutil?

I have a brand new Memorex TravelDrive 64GB USB disk which is being troublesome.

It's formatted FAT16 on MBR, which is not so nice, and I'd like to put it on HFS+.

I've tried to do this through the Erase and Partition tabs in Disk Utility, as well as from the CLI in Terminal.app via a couple different methods:

$ diskutil partitionDisk disk4 1 GPT HFS+ newdisk R
$ diskutil eraseDisk HFS+ newdisk disk4

In those, disk4 represents the special device or disk identifier (i.e., /dev/disk4) and newdisk is the arbitrary name I'm giving the new volume on the disk.

In all cases, the process hangs trying to unmount the disk. I've done a bit of investigation, to no avail:

  1. Tailing the Disk Utility log while it's running (tail -f ~/Library/Logs/DiskUtility.log) doesn't provide any useful information. All I see is:

    Starting next Erase job: 6 with no options
    2013-03-03 00:51:57 -0500: Preparing to erase : “newdisk”
    2013-03-03 00:51:57 -0500:  Partition Scheme: GUID Partition Table
    2013-03-03 00:51:57 -0500:  1 volume will be created
    2013-03-03 00:51:57 -0500:      Name        : “newdisk”
    2013-03-03 00:51:57 -0500:      Size        : 63.92 GB
    2013-03-03 00:51:57 -0500:      File system : Mac OS Extended (Journaled)
    
    dmAsyncStartedForDisk for disk4 
    2013-03-03 00:35:30 -0500: Unmounting disk
    

    and it hangs there, thus having me need to "Stop Progress" from the Debug menu after 20 or 30 minutes.

  2. Trying to figure out if something has hold of the disk for some other purpose doesn't reveal anything either -- ps aux | grep fsck returns only one process:

    ryan        4967   1.0  0.0  2432768    588 s003  R+   12:57AM   0:00.00 grep fsck
    

Anyone have thoughts on how to figure out what's going on here?


You need to use /dev/disk4 in place of just disk 4 in your command. It should read like this

diskutil partitionDisk /dev/disk4 1 GPT HFS+ newdisk R

It sure looks like you have all the correct commands. Have you tested these media using Disk Utility or tried your commands on a USB drive you could stand to erase?

My suspicion is the storage you are using isn't 100% functional.