32

I have two internal drives in my 27" iMac (10.8.5). An SSD system disk and a 1TB SATA drive.

The HDD has been acting up recently, very slow performance, bad behavior etc. Tech Tool Pro and Disk Utility don't seem to be able to fix the drive, so I decided to wipe the data by a reformat and writing zeros to the entire drive.

Everytime I try and format, it tells me that the drive cannot be unmounted. I have rebooted a few times, and spent days running everything from TechTool Pro on it and it won't go.

$ diskutil list disk2
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *4.0 TB     disk2
   1:                        EFI EFI                     314.6 MB   disk2s1
   2:                  Apple_HFS Everest                 4.0 TB     disk2s2

$ diskutil repairVolume /dev/disk2s2
Started file system repair on disk2s2 Everest
Updating boot support partitions for the volume as required
Error: -69673: Unable to unmount volume for repair

$ diskutil eraseDisk JHFS+ Everest /dev/disk2
Started erase on disk2
Unmounting disk
Error: -69888: Couldn't unmount disk

Any thoughts on how to get it to unmount and reformatted? Is there a way in Terminal to do this instead?

2
  • @bmike Since it's unclear, if it's really a duplicate of the linked question, i wouldn't add the diskutil list here. Actually I think the reasons are different: here probably a degraded hdd, there a wrong EFI size and therefore an unreadable or partly overwritten HFS+ volume. The symptoms (unable to unmount) and the solution (force unmount) are probably the same though.
    – klanomath
    Mar 25, 2015 at 17:02
  • no most likely an early fusion drive
    – oemb1905
    Oct 10, 2015 at 3:49

8 Answers 8

59

You can force unmount a drive by running the following Terminal command:

diskutil unmountDisk force /Volumes/VOLUMENAME

Replace VOLUMENAME with the name of a volume on the disk you are trying to unmount.

Following this, attempt to Erase/Partition the drive again in Disk Utility. Using the above command can interrupt file read/writes, which can cause file corruption. However, since you are erasing the drive anyway, this doesn't really matter in your situation.

8
  • Thanks. Combining this with ^ ... worked perfectly. Apple - please make your GUI stronger.
    – oemb1905
    Oct 4, 2015 at 7:29
  • 5
    Didn't have a volume to unmount; unmounted the disk device instead (with N being 3 in my case): diskutil unmountDisk force /dev/diskN
    – Joel Purra
    Feb 10, 2016 at 19:35
  • I was able to unmount the disks using above solution. But now I am getting following error while trying to erase or paritition primary internal HD: "wiping volume data to prevent future accidental probing failed". Any help is greatly appreciated.
    – Ab'initio
    Jun 9, 2016 at 10:42
  • @Ab'initio This should be a separate question rather than a comment. Make sure to search before asking.
    – grg
    Jun 9, 2016 at 11:33
  • I think, this answer is for the fist attempt (diskutil repairVolume /dev/disk2s2) but not for the second one (diskutil eraseDisk JHFS+ Everest /dev/disk2) If you want to reformat the disk from scratch, the answer is first try to diskutil unmountDisk force /dev/diskN (in your case disk2) and if that does not work, because of automatic fsck, try the option bleater describes.
    – leon
    Jan 21, 2018 at 16:01
7

When a disk is first connected, macOS helpfully tries to run fsck on the volume. If the volume is large or has extensive problems, this process can run for a long time before it fails.

The following Terminal command should identify the process at fault:

sudo lsof | grep diskn

replacing diskn with the number of the offending disk.

Once you have the process ID, you can kill it thus:

sudo kill -9 pid

replacing pid with the process ID determined above.

Then you can run diskutil normally, either from GUI or command line.

3
  • fuser /Volume/<whatever> will give you the PIDs that use that resource.
    – atmosx
    Nov 25, 2017 at 8:35
  • Thank you bleater I had force unmountDisk, and still not helped. Your indication, and explanation of what was happening, helped me to solve the problem after half a day. With first sudo lsof | grep diskn and then sudo kill -9 689 (being this digits the first ones to appear after fsck_hfs) I did the trick, and could use then the normal diskutil eraseDisk JHFS+ ChoosenName /dev/diskN to reset the whole partition of my Disk with false size (due to hard cloning).
    – leon
    Jan 21, 2018 at 15:47
  • This helped me but what worked for me was to identify the process fsck_hfs and then sudo killall fsck_hfs solved the issue
    – Leo Dabus
    Mar 6, 2021 at 8:12
2

Disable Spotlight for that Hard Drive (System Preferences)

https://discussions.apple.com/thread/1454712?start=0&tstart=0

1
  • Answers on Ask Different need to be more than just a link. It's okay to include a link, but please summarize or excerpt it in the answer. The idea is to make the answer stand alone.
    – nohillside
    Jan 4, 2018 at 9:32
0

If you have a PC download transmac trial start in administrator mode plug your disk in via usb. Locate your drive and right click on it. If you have an image you would like to clone to it use the clone option. Otherwise use format and choose HFS+ plug the hard drive into your Mac again and it should format no problem.

Worked for me this morning. Took about 5-10 minutes.

1
  • Transmac worked for me also. Spent hours trying other solutions, but this worked straight away!
    – user128386
    May 18, 2015 at 23:30
0

You cannot erase a disk that you are booted on. There should be a Recovery Partition, a "hidden" Partition from which you can format the boot disk. Attention after that you can install os from the recovery Partition.

-2
diskutil eraseVolume JHFS+ Everest disk2s2

The following is a better explanation:

  • sudo - act as the super user giving you greater power
  • diskutil - call the disk utility program
  • eraseDisk - call the erase disk function
  • FAT32 - set the disk to a format of your choice (FAT/HFS/etc)
  • SDCARD - give your drive a new name
  • MBRFormat - set the format style (Master Boot Record here)
  • /dev/disk7 - which disk do you want to erase
1
  • Thank you Adam for making this so much better of an answer.
    – bmike
    Oct 3, 2020 at 0:30
-4

Try to use

umount -f /Volumes/<drive name>/
1
  • Welcome to Ask Different! We're trying to find the best answers and those answers will provide info as to why they're the best. Explain why you think the answer you provided will solve the problem or is better than others out there. Providing links can also help the OP, and others, find additional info for themselves. See How to Answer on how to provide a quality answer. - From Review
    – fsb
    Sep 29, 2016 at 13:18
-4
diskutil unmountDisk force <fill in the mount name here>
1
  • 4
    How does this differ from the already accepted answer?
    – nohillside
    Jan 4, 2018 at 9:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .