Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Apple OS X Disk Utility erase fail

  • Disk Utility erase fail

    Posted by Jack Stewart on August 24, 2011 at 11:32 am

    I am trying to format my hard drive through disk utility in the Mac OS Extended (journaled) format. When I try this it gives me the following error message:

    “Disk Erase failed

    Disk Erase failed with the error:

    Could not unmount disk”

    I have a WD My studio 2tb. It is partitioned so it works as 1TB but does a double back up. It is already in the Mac OS Extended (journaled) format so I have also tried formatting it to MS-DOS (FAT), but I am still getting the same error message.

    Any suggestions please?
    Thanks
    Jack

    Steve Modica replied 13 years, 4 months ago 3 Members · 3 Replies
  • 3 Replies
  • Steve Modica

    August 24, 2011 at 1:54 pm

    I’d find the disk utility process using ps and get its PID. Then dtruss it:

    sudo dtruss -p PID

    While that’s running in a terminal, hit the erase button.
    One possibility is that apple issues the scsi “erase” command and the drive simply doesn’t like it or is locked.
    In either case, you should see the failing system call in the output.
    Steve

    Steve Modica
    CTO, Small Tree Communications

  • James Bayliss-smith

    December 20, 2012 at 3:39 am

    I’m getting the same error

    [Steve Modica] “I’d find the disk utility process using ps and get its PID. Then dtruss it:”

    Any chance of explaining this in plain english? Cheers

  • Steve Modica

    December 20, 2012 at 4:54 pm

    [James Bayliss-Smith]
    [Steve Modica] “I’d find the disk utility process using ps and get its PID. Then dtruss it:”

    Any chance of explaining this in plain english? Cheers”

    Sorry.

    If you run ps -ef in a terminal you’ll see a list of running processes. One of them will be the disk utility:

    502 774 167 0 10:39AM ?? 0:00.43 /Applications/Utilities/Disk Utility.app/Contents/MacOS/Disk Utility -psn_0_421991

    In my case, it’s Process ID (PID) is 774.

    I can see what this guy is doing using one of the most powerful tools invented for operating system debugging. It’s called dtrace and Apple had the foresight to port it to OS X (from Solaris).

    “dtruss” is a script that uses dtrace to capture data about processes like the old “truss” command from BSD.

    So you would run this (using my example):

    sudo dtruss -p 774 (replace 774 with the correct PID for your disk utility).

    You’ll see a lot of stuff like this:

    psynch_mutexdrop(0x7FFEE40CB4D0, 0x1A4303, 0x1A4200) = 0 0
    psynch_mutexwait(0x7FFEE40CB4D0, 0x1A4403, 0x1A4200) = 1721347 0
    psynch_mutexdrop(0x7FFEE40CB4D0, 0x1A4503, 0x1A4400) = 0 0
    psynch_mutexwait(0x7FFF77055558, 0xB4303, 0xB4100) = 738051 0
    geteuid(0x10655BF00, 0x0, 0x10655C058) = 502 0
    geteuid(0x7FFF77FF8848, 0x7FFF8F0D8A82, 0xFFFFFFFF) = 502 0
    psynch_mutexwait(0x7FFEE40CB4D0, 0x1A4B03, 0x1A4900) = 1723139 0
    psynch_mutexdrop(0x7FFEE40CB4D0, 0x1A4C03, 0x1A4B00) = 0 0
    geteuid(0x7FFEE8939770, 0xA0, 0x7) = 502 0
    open(“/Library/Preferences/SystemConfiguration/preferences.plist\0”, 0x0, 0x1A4) = 10 0
    close(0xA) = 0 0
    open(“/Library/Preferences/SystemConfiguration/preferences.plist\0”, 0x0, 0x1A4) = 10 0
    fstat64(0xA, 0x10655BE70, 0x0) = 0 0
    read(0xA, “<?xml version=\”1.0\” encoding=\”UTF-8\”?>\n<!DOCTYPE plist PUBLIC \”-//Apple//DTD PLIST 1.0//EN\” \”https://www.apple.com/DTDs/PropertyList-1.0.dtd\”>\n\n\n\tCurrentSet\n\t/Sets/FF7F8FB9-4B14-469D-8D56-BF59150944B4\n\t”, 0x377B) = 14203 0
    close(0xA) = 0 0
    __sysctl(0x10655BA58, 0x2, 0x10655BA60) = 0 0
    __sysctl(0x10655BAF8, 0x2, 0x10655BB00) = 0 0
    psynch_mutexdrop(0x7FFF77055198, 0x6FE03, 0x6FD00) = 0 0

    All that psynch stuff is the app sitting around waiting for you to do something.

    When you click “erase” or repartition or whatever, a bunch of system calls will spit out (similar to the open/read/close stuff you see above). It’ll be interesting to see what it’s trying to do and why it fails.

    If you absolutely know the disk is going to be erased and you don’t care, you could do this too:

    Select the disk in disk utility and click the info button (not the partition but the disk).
    Look at the “Disk Identifier”. On my backup drive, it’s “disk1”. That’s the device file that is used to talk to the disk.

    I could manually overwrite this like so:

    $ sudo dd if=/dev/zero of=/dev/disk1 count=10000 bs=1m

    This will write 10GB of zeros over the front portion of the disk and should wipe out the partition table. Then the disk won’t be recognized anymore and you can reinitialize it.

    Steve

    Steve Modica
    CTO, Small Tree Communications

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy