Fix for disk erase failed couldn’t unmount disk


If you’re trying on a Mac using Disk Utility to erase a hard drive and it won’t unmount, giving you an error similar to Disk erase failed. Couldn’t unmount disk, then you may have to force an unmount through the terminal.

Launch up Terminal.app (through /Applications/Utilities or through a Spotlight search).

Then paste in the command:

diskutil list
to list out the different disks. You should see some disks appear like /dev/disk0, /dev/disk1, /dev/disk2.

Find the one you want to force unmount. For this example, let’s say it’s /dev/disk2.

Run a command similar to this one

sudo diskutil unmountDisk force /dev/disk2
If you’re prompted for a password, enter it (yes, your account does need to have administrative privileges). You should not physically unplug the drive.

You should now be able to erase the drive.


75 responses to “Fix for disk erase failed couldn’t unmount disk”

  1. Excellent post! It worked the 1st time for me, and i also had to stumble across the interweb minefield before finding this solution. Thank you !

    -Bobby

  2. I tried this method, but now it says “Forced unmount of disk2 failed: at least one volume could not be unmounted” Please help, I would like to erase my hard drive so i can do a clean install of el Capitan

  3. Whenever I go to type the password, it has a round dot and won’t let me type anything. Do you know what might be causing this?

  4. In the terminal, there’s no visual feedback for passwords. Just keep typing your password and then hit Enter when you’re done. Your password is being accepted. There are just no dots or asterisks to indicate so.

  5. I have been trying off and on for weeks to get rid of this error. I searched high and low and your directions were the easiest to follow and actually worked!! Thank you very very much.

  6. That’s an odd one.

    What happens if you try this?

    sudo /usr/sbin/diskutil unmountDisk force /dev/disk2
    • Came across this same problem after my MacBook Pro freezes after logging in and won’t go to my desktop. I’ve tried the original text and the one you suggested to Jon and it still says ‘command not found’
      Any ideas what’s up?

      • The only thing I can think of is that you’re accidentally typing it wrong. I would suggest copy and paste. You may have to still change the number (it may not be /dev/disk2 but /dev/disk3 or something else), but most terminal “command not found” errors I’ve seen have been due to people not typing exactly what they’re seeing (no space where there should be one, or an I instead of 1, or lowercase instead of uppercase, etc.), so copy-and-paste is probably the best way to go.

          • Another possibility is that you’re trying to run the sudo command from a non-admin account. Standard accounts do not have enough privileges to escalate using sudo.

  7. I was trying to install tacos sierra on my 2011 iMac 21.5″ and it crashed my computer, and it just kept restarting. I foolishly tried to download it on my macbook pro 2012 13″ also. So now i have two broken internal hard drives. Have an external hard drive, which i used to boot up the iMac with el capitan, but i am still in the process of trying to erase the internal drive. I tried this but it still didn’t work, it says “unable to unmount 1 or more part” or something like that. I need to get this one fixed and get the internal one running again, because i can’t have two computers running off one external drive, and i still need to fix my macbook. PLEASE HELP!! Thank You!

    • Sierra is still beta, right? I wouldn’t have installed it on an everyday use (production) machine, but I guess what’s done is done. If the external El Capitan absolutely refuses to unmount the disk, can you try booting into Recovery Mode (hold down Cmd-R while booting up) and then using Disk Utility there?

      If that doesn’t work, I’d actually seriously consider booting Ubuntu or some other non–Mac OS X operating system to reformat the drive that way first, and then use Disk Utility to format the drive back to HFS+ and reinstall OS X.

      • i managed to install el capitan on the external drive and use terminal to force erase the disk. from there i booted the iMac on its original OS X lion and from there downloaded the public beta of mac os sierra, which i was supposed to in the first place, but i was just impatient. Im just happy i didn’t have any files on the computers, so nothing was lost, just my time it took to fix them. Right now i have the macbook booted on the external on el capitan and I’m going to go through the whole process over again for this computer.

  8. I had hoped…. 🙁

    Didn’t work for me – I’ve been trying anything and everything to get my external to show back up so I could start over!

    Unmounting disk
    Wiping volume data to prevent future accidental probing failed.
    Operation failed…

  9. I knew there had to be an “easy” way to do this, and this was it. Thanks so much for the quick and easy tip. Worked like a charm for me to reformat an external drive. 100x easier than the other ways I read to solve the unmount issue, like boot disks, etc.

  10. Is there a way to work around needing a password? I was an idiot and renamed my home folder and now I’m trying to format my computer because it doesn’t recognize me or my password so not only can I not get into any admin stuff to fix the original issue, but I get the cannot erase/unmount error, and my password doesn’t work so I can’t use the terminal to force it. u_u

    • You may be able to rectify this issue by booting into single user mode, and then (after the fsck scan) renaming the home folder back.

  11. i have the same prob and am doing this coz i forget ma macbook password and now !! i can’t complete this w/o a password !! wt to do pls i need help ..

  12. when i try to unmount i get an error saying “at least one volume could not be unmounted”. I tried the other workaround; hdiutil detach, and i get an error saying “Resource busy”

    please advise

  13. Your instructions are clear, and almost successful in my case…
    Within the terminal it was successful, but when I go back to Disk Utility to format the hard drive to ExFat it still says “Disk Erase failed with error: Invalid Request.” Any ideas?
    (I am trying to format a windows pre-formatted hard drive to use on my mac).

  14. I’ve done this procedure several times, it says it was successful: “Forced unmount of all volumes on disk2 was successful” but it’s not showing up in finder, and the disc utility says it’s uninitialized, still fails disc utility erase, and after hitting the erase button it tries, but fails: Unmounting disk
    Operation failed…
    Unable to write to the last block of the device.

    I watched the video posted here that says to partition it, but my partition button is greyed out, what can I try next?

    • If it successfully unmounts the volumes, the volumes are unmounted and thus should not show up in Finder.

      Keep it unmounted and then erase in Disk Utility.

      • it still fails disc erase in utility, this drive is almost brand new, it’s hardly been used, is there anything else I can try?

        • Try booting up Ubuntu and reformatting the drive (as FAT32) and then booting into Recovery Mode and re-reformatting it (as HFS+).

  15. Is there a way to restore the data prior to erasing using the steps above?
    Current error: Source volume is read-write and cannot be uncounted, so it can’t be lock copied.
    Thanks.

    • The error says “so it can’t be lock copied”? I’ve never seen that error and can’t find it in a Google search. What’s the exact error message? And what are you trying to do? Get data off the volume before erasing it? I’m unclear what you mean by “restore the data.” Do you mean “save the data”?

  16. Great piece of advice! Worked at first attempt, I was running out of hope after trying several solutions from other forums

  17. Thanks for the post. I’ve tried everything you recommended (including in the comments section), and have not had success. Here’s what I did:

    Big-Mac:~ admin$ diskutil list
    /dev/disk0
    #: TYPE NAME SIZE IDENTIFIER
    0: GUID_partition_scheme *500.1 GB disk0
    1: EFI EFI 209.7 MB disk0s1
    2: Apple_HFS iMac 499.2 GB disk0s2
    3: Apple_Boot Recovery HD 650.0 MB disk0s3
    /dev/disk2
    #: TYPE NAME SIZE IDENTIFIER
    0: FDisk_partition_scheme *1.0 TB disk2
    1: Apple_HFS Beatrice 910.3 GB disk2s1
    2: Windows_NTFS For Windows 89.9 GB disk2s2
    Big-Mac:~ admin$ sudo diskutil unmountDisk force /dev/disk2
    Password:
    Forced unmount of disk2 failed: at least one volume could not be unmounted
    Big-Mac:~ admin$ hdiutil detach /dev/disk2
    hdiutil: detach: timeout for DiskArbitration expired
    Big-Mac:~ admin$

    Any help would be appreciated! 🙂

    • Yeah, unfortunately, no idea on that. Honestly, since that appears to be an external drive, I would shut down the computer and then just unplug the drive.

  18. I have tried all the methods listed in previous comments. When trying to erase the disk it gives me the “could not unmount disk” error. When using the sudo command it gives me the error of “at least one volumes could not be unmounted”. I used to have a boot camp windows 7 that was deleted a year ago If that would effect it. I am not using any external drives

  19. After trying for several hours, came across this solution and it worked perfectly, thanks much for posting this! I am wondering now if I could have simply “ejected” my external Seagate hard drive to come up with the same solution – since drive disappeared from desktop similarly when I choose to eject drive. Either way, glad this worked.

  20. How do you know which one to choose to unmount? After typing diskutil list there are 14 dev/disk? Trying to erase hard drive and had “can’t unmount” error.

  21. Hi Alan,

    Trying to erase my hard drive and it won’t unmount: Disk erase failed. Couldn’t ummount disk.

    The diskutil list command brought up just /dev/disk0 (plus disk0s1, disk0s2 and disk0s3). The command “sudo diskutil unmountDisk force /devdisk0” failed because “at least one volume could not be unmounted.”

    I followed your further guidance below to another blog and the command “hdiutil detach /dev/disk0” resulted in the following message: “hdiutil: couldn’t unmount ‘disk0’ – Resource busy.”

    I followed your additional further guidance below and see the command “sudo lsof | grep /Volumes/myDrive” – what is supposed to be substituted in for “myDrive”? I’ve tried many things and everything simple ends up resetting the Terminal for a new command query.

    • /dev/disk# is where the drive is physically, and /Volumes/NAMEOFDRIVE is where you can actually find the drive in Finder.

      Three quick ways to find that:

      1. Type /Volumes/ and then hit the Tab key on your keyboard twice to see what the options are.

      2. Type mount and hit Enter to see what paths things are mounted to.

      3. Type df -h and hit Enter to see free disk space (but this will also show the mounted paths).

      • 1. Typing “/Volumes/” and hitting Tab once yielded “Macintosh HD”; Tab a second time did nothing.

        2. Typing “mount” and hitting Enter yielded:

        /dev/disk0s2 on / (hfs, local, journaled)
        devfs on /dev (devfs, local, nobrowse)
        map -hosts on /net (autofs, nosuid, automounted, nobrowse)
        map auto_home on /home (autofs, automounted, nobrowse)

        3. Typing “df -h” yielded:

        Filesystem; Size; Used; Avail; Capacity; iused; ifree; %iused; Mounted on

        /dev/disk0s2; 297Gi; 9.1Gi; 288Gi; 4%; 2455523; 75477379; 3%; /
        devfs; 181Ki; 181Ki; 0Bi; 100%; 626; 0; 100%; /dev
        map -hosts; 0Bi; 0Bi; 0Bi; 100%; 0; 0; 100%; /net
        map auto_home; 0Bi; 0Bi; 0Bi; 100%; 0; 0; 100%; /home

        Thank you for the additional assistance but I’m not quite sure what to do with any of this. I tried the command “$ sudo lsof | grep /Volume/Macintosh\ HD” but it resulted in nothing, I just got a reset terminal after it prompted me for my password. I also tried it in a different command on the other page you referenced: typing “$ sudo diskutil unmount force /Volumes/Macintosh\ HD” resulted in “Volume Macintosh HD on disk0s2 failed to unmount.”

        Do you have any other troubleshooting tips?

        • Why are you trying to unmount Macintosh HD? Are you booting from an external drive? If you’re not booting from an external drive, Macintosh HD is the drive you’re using when you boot up your Mac. Based on your mount and df -h output, it doesn’t seem you have anything mounted that needs to be unmounted.

          • I am not using an external drive, I’m trying to erase my startup disk before discarding my old iMac. The Apple instructions (https://support.apple.com/en-us/HT204904) state to select the disk, not the volume, in Disk Utility but when I try to do so, I get the following error message: “Disk erase failed. Couldn’t ummount disk” mentioned in my first comment above and which I thought this article was about troubleshooting around.

          • You won’t be able to erase the drive while you’re using it. Boot into recovery mode (hold down Cmd-R while rebooting) and then you should be able to unmount and erase Macintosh HD.

  22. Don’t I need to erase the disk rather than the volume? That’s what the Mac help page says regarding wiping a computer to sell or donate. I can successfully erase Macintosh HD (the only partition) but I get the error message “Disk Erase Failed: couldn’t unmount disk” when I try to erase the disk itself. Hence this series if inquiries.

    • There’s nothing user-specific on your recovery partition if you wipe the Macintosh HD partition. If you really want to erase the entire disk, including the recovery partition, you must boot from an external drive.

      • It’s funny, now that I check the Apple help page again, it’s been revised as of four days ago and the note that used to be included (make sure to select the disk, not the volume) is now gone – figures! Anyway, it sounds like I should be good to go. Thanks for the help, I really appreciate it.

  23. started with above suggestions and part of it worked. Wanted to format it but then it still says it needs an unmounted disk.

    at first the disk looks like this:

    /dev/disk4 (external, physical):
    #: TYPE NAME SIZE IDENTIFIER
    0: FDisk_partition_scheme *16.0 GB disk4
    1: Windows_FAT_32 boot 66.1 MB disk4s1
    2: Linux 16.0 GB disk4s2

    Then i forced the disk to unmount:

    iMac-van-Ronald:~ koenie$ diskutil unmountDisk force /dev/disk4
    Forced unmount of all volumes on disk4 was successful

    Formatting:

    iMac-van-Ronald:~ koenie$ sudo diskutil eraseDisk FAT32 ROLF MBRFormat /dev/disk4
    Password:
    Started erase on disk4
    Unmounting disk
    Creating the partition map
    Waiting for partitions to activate
    Formatting disk4s1 as MS-DOS (FAT32) with name ROLF
    Error: -69830: This operation requires an unmounted disk

    what to do, besides throwing it out off the window…….

    • Hi Ronald, I ran across your post and see you had the same issue im having now with no luck in finding a solution. This was a year ago I realize but do you happen to remember how you fixed your SDcard?

  24. HUGE help! Simple solution that worked perfectly, and all the other solutions I found were very complex and would have been time consuming. Thank you so much.

  25. Hello,
    I have the same problem and I ran into you website. I was trying to erase an external hard drive, and got this error. Following your directions, the disk was unmounted successfully in terminal. At Disk Utility, I saw the partitions of the external hard drive being greyed out. So I clicked at the hard drive and clicked Erase, but still got the same error. After ejecting it and reconnecting the drive, it seemed that nothing has been erased. What would you suggest? Thanks!

  26. this is the closest i’ve gotten to be able to erase this external disk, but… i got this error message:
    Error: -69825: Wiping volume data to prevent future accidental probing failed

  27. Tried but…

    sudo diskutil unmountDisk force /dev/disk2
    sudo: unable to stat /etc/sudoers: Permission denied
    sudo: no valid sudoers sources found, quitting

  28. Thank you, Alan! Your procedure worked perfectly — you got me out of a very frustrating situation.

Leave a Reply to Alan Siu Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.