MacBook Pro refuses to eject external disk - How do I make this stop?

So I have an issue that's been bugging me for a couple weeks, now (from even before I upgraded to Mountain Lion), that I, really, need a solution to. I have a 1TB external drive divided into 3 partitions. I eject it whenever I wish to remove it from my computer, but, lately, there is 1 partition that, constantly, refuses to be ejected. I get the usual warning in this instance:


The disk [volume name] wasn't ejected because one or more programs may be using it.


I click "Try Again" and it doesn't work. It works with "Force Eject", but I don't want to cause any unnecessary damage to the contents of the drive. The next time it happened, I ran the following in Terminal:


sudo lsof -xf +d "/Volumes/[volume name]"


This told me that the "mds" process was accessing the disk, which means Spotlight was using it. I clicked the "Spotlight" icon in the menu bar and Spotlight didn't appear to be doing anything. I can't quit the "mds" process in Activity Monitor, because the process just starts again. The only thing that worked was logging out, then, logging back in, then, I could, immediately eject the volume.


Of course, the next time I plugged the disk in, the same thing happened.


How do I stop this from happening? How can I stop Spotlight from, constantly, holding this disk captive? I shouldn't have to log out to eject a disk.


Please advise.

MacBook Pro (15-inch Mid 2010), OS X Mountain Lion

Posted on Aug 4, 2012 7:38 AM

Reply
16 replies

Nov 6, 2017 12:24 AM in response to Cerebro

I have the same issue for my 2TB external hard disk ,I tried many ways find on the internet didnt work .i solved this by this procedure


1.show all hidden files in the hard disk by the terminal command


defaults write com.apple.finder AppleShowAllFiles YES

2.I opened the hard disk ,

3. click on hidden file get info.give permission for trash it,Clear all the hidden system files & other hidden files with system permission.

4.eject it

5.mount it

6.it will ask for backup disk skip it

7.now MBP is detect the EHD as new one.now it works very perfect & normal

8.Go to terminal Paste Hide Hidden Files by terminal command

defaults write com.apple.finder AppleShowAllFiles NO

Thank you

Aug 4, 2012 9:48 PM in response to Cerebro

After many hours of frustration, the issue is finally resolved.


I contacted AppleCare (as I'm still covered). They had me boot from the recovery partition and run Disk Repair on all of my volumes. I rebooted, and was able to unmount and remount the irritating volume several times. This only lasted a minute or two, then the process that hijacked the volume came into effect and, again, prevented me from ejecting the volume. The next thing we did, was create a new user, then, log in as the new user and try playing with the drive from that account. Wouldn't you know it, same problem.


Since we figured out how to unmount the drive, I decided to go ahead with my original "erase" plan. I logged back in to my main account. As soon as I logged in, I unmounted the volume (before the hijacker kicked in) and erased it. Once empty, I could unmount and remount the volume until I was blue in the face and had no issues (progress!). I copied my files back over to the volume. Once I did that, the problem came back. (insert several minutes of swearing, here). So I concluded that there must be some file in here that was causing the issue.


I erased the volume, again. Instead of copying everything back on to it at once, I, painstakingly, moved only 1 or 2 folders over at a time so I could zero in on where the offending file might be residing (I had about 250 GB of data to sort through, this took some time). I narrowed it down to a couple of older folders that I felt I didn't need to return to this volume. I burned those to DVD for archiving and expunged them from my computer. All the important stuff that I still need on that volume is still there and the volume is behaving as a normal volume should.


It's amazing how one or two files can cause so much havoc.

May 17, 2013 2:58 PM in response to Cerebro

Cerebro,


I am in the same boat but I think you could help me and many others by telling us what what in the folders that were keeping your G-Raid or HARD DRIVE from UNMOUNTING?


I can force quit.......and even force quit to get the DiskUtility to treat that like a unmount.....


but in my case I may have installed software from AUTODESK that uses WIRETAPPING on the EXTERNAL DRIVE because that is the AUTHORIZATION method and also the CONTENT method they use to allow me to use their software for FREE as a STUDENT or EDU.


But I tried to kill these processes in the Activity Monitor and it just comes back or creates new numbers..

so I am not sure if that is the culprit...


I had read other culprits....like other 3rd party BACKUP SOFTWARE (not Time MACHINE) that was hanging the computer......


I am wondering why you had APPLE CARE help you and they couldn't even find the solution....


so without you sharing with me even in a private email as you didn't share what the FOLDER was for software.


I would be much appreciated as if this is the similar case then I can contact them and just ask them the workaround if it is not an APPLE thing......


Most POWER USERS that understand MOUNTAIN LION or SNOW LEOPARD and UNIX for that matter know the TERMINAL like a second language...


I wish I did but I don't yet.....


I really need to take a class or just read these ADMINISTRATION BOOKS for APPLE CERTIFICATION to understand such things.....


Please let me know anyone else reading this if you have some good ideas? or IRC CHAT or other FORUMS that strictly deal and discuss APPLE OSX and UNIX PROGRAMMING as well as NETWORKING without the FILE SYSTEM.....most of this is ADMINISTRATION LEVEL or root level knowledge, and should be offered as a MANUAL when you buy the COMPUTER........or at least a FREE PDF instead of having to pay the 50 or 60 dollars for the current flavor of OSX.....


I paid a 3 dollars for SNOW LEOPARD was happy updating school MAC LABS in LAUSD with that knowledge...but now I am MOUNTAIN LION 10.8 so I am wondering is it really worth the upgrade BOOK is that SYSTEM that much DIFFERENT than SNOW LEOPARD? can anyone tell me?


thanks so much


singleton


PS- - my problem is the same I have a G-RAID that will not EJECT unless I FORCE QUIT the DRIVE.....

I can't figure out what is causing it to hang......how should I go about finding out exactly what it is?


thanks

😀

May 20, 2013 8:34 AM in response to Singleton Makin

Singleton,


I'm not sure if the cause lf my problem will be all that helpful to others.


As I mentioned, there was, apparantly, some program on the disk that my computer kept trying to use that prevented me from ejecting the disk. What I did to zero in on the cause was copy the contents of the disk to another volume, erase the disk, then copy everything back over the disk in small increments (a few folders at a time). After each increment, I tried ejecting the disk to make sure it was working properly. Once I returned to the point where the disk wouldn't eject, I knew that I had narrowed down the location of the offending file.


In my case, I used this disk to archive installers for numerous applications I've used over the years. I had a folder full of Classic (OS 9 and earlier) installers (yeah, yeah, I know...). Turns out, my Mac running Moutain Lion was, constantly, trying to access an installer for a Classic app. Don't ask me why. I can't remember which installer it was, but I did determine which installer it was by using What's Keeping Me?. In the end, I decided that those old Classic installers weren't anything I needed to keep readily available. I archived them to DVD so they no longer needed to reside on my drive. Problem solved.

Sep 4, 2013 7:26 PM in response to Cerebro

I'm currently in the exact same situation. I've got an external FW HD that refuses to unmount/eject normally, offering "Force Eject" as the only option (unless I power down my Mac and then turn it off manually). I've run Disk Utility to check disk integrity and permissions, and everything checks out OK.


Like you, I transferred the entire 1TB contents to a brand new freshly-formatted HD (which took about 6 hours), erased and reformatted the misbehaving HD, and then moved the contents back, folder-by-folder. After moving each folder, I would check to see if the HD would eject normally. Eventually the problem returned. Like you, I have many old files and apps archived, including classic OS9 stuff (I have an old PowerMac 7300/200 that I fire up from time to time. I like MYST - what can I say?). As it stands now, somewhere within a 200GB folder is a file or files that are causing this eject anomaly.


If I was savvy with Terminal, Activity Monitor, Console and Logs I might be able to figure out which file or folder is screwing up the works. As it is, I'll have to start the process over again, and move data back in smaller increments. This is time-consuming, frustrating, and just plain ridiculous.


I'll keep you up to date if/when I figure this out and hope you'll provide any more troubleshooting details if they come to mind. **** but this is annoying.


Best,

Tom

Oct 17, 2013 1:58 AM in response to Flavum

I believe you've come up with the answer to the issue to the inital thread as I had the exact same problem unmounting my USB3 Samsung disk. Unfortunately you ran into a second error and haven't addressed that.


I ran the sudo lsof -xf +d "/Volumes/[volume name]" command and noticed two mds processes accessing the disk and at first I could not add the drive to the privacy list for spotlight. I too got the error

"The item couldn't be added or removed because of an unknown error."


So, I tackled this error by dragging the largest folder on the USB3 disk into the privacy list first, then tried dragging all the other content in and then eventually the system would allow me to drag the entire volume in.


I'm not certain how your folder structure is laid out out the USB3 disk, but it might be worth creating a root folder with all the subfolders in

eg.

Disk

>root folder

>My Music

>My videos

>My etc etc


and dragging that root folder into the privacy pane, as then none of the items will get indexed on the disk and the prerformance ejecting it should improve, I hope this helps.


good luck

L

Aug 6, 2014 10:51 AM in response to asklewie

Try adding ".noindex" (dot-noindex) to the volume name: Select the disk in Finder-> File-> Get Info (command-i) -> Name & Extension

And get rid of spaces in filename while you are at it. For example, if name is "My Book" change it to "MyBook.noindex" instead.


Warning: I'm not sure, but I think the ".noindex" extension (since 10.4 maybe) tells mds (the metadata and/or spotlite) process to ignore the entire volume, so Spotlite cannot search it. I use EasyFind or FindFile or grep instead of Spotlite, so this is not an issue for me 😉


Details/Example... Had usb external hard-drive on 10.9.4 mac (with all updates as of today) that would not unmount no matter how many times I hit "Try again". As soon as I gave the volume a name ending in ".noindex" it ejected immediately without complaint. I'll leave it to the reader to determine exactly why it works (or doesn't work) in their particular case. But it sure seems like some sort of non-use indexing process is what is preventing unmount/ejecting.


-BD

P.S. While we are on the subject of ejecting, I've noticed that some the light on most older usb-storage devices stays on even after Disk Utility says the entire disk has been ejected (even tho lite may blink when you hit eject). But at least on some newer usb-storage devices (both flash and hd/ssd), such as Seagate BackupPlus usb3 drives, when ejected, after a second or two, the light on the drive turns off giving you a nice visual indication that it is now ok to unplug the usb cable. This helps prevent corruption, especially of easily corrupted TimeMachine volumes per this hint on how to quickly verify/repair TM volumes:

http://hints.macworld.com/article.php?story=20110829063745320

But note you may need to rename the volume something like TimeMach.noindex so you can unmount it in Disk Utility before doing the trick there such as:


sudo fsck_hfs -f -c 2200m /dev/disk1s2

Aug 6, 2014 1:01 PM in response to ncprius2

Actually, spoke too soon, maybe 😕... It now appears that just changing the name of the volume (with or withOUT a .noindex) is what makes it instantly ejectable. That is, adding .noindex may have no effect at all (perhaps a red-herring, perhaps not. I don't know.) The volume I was having problems ejecting was a time-machine volume for a different mac so that may be a clue. After I changed the name and unmounted it, but did not disconnect usb cable, Disk Utility then had problems mounting the renamed volume (tho other volumes on same disk mounted ok). Ejecting, then disconnecting usb-cable, and reconnecting usb-cable, all 3 volumes on disk mounted ok. And all 3 instantly unmounted when I clicked "Eject" button for entire disk in Disk Utility. Go figure.


I'll do some further testing, but it may be all we need is a shell-script or applescript named "eject-all-usb" that finds all the removable drives, temporarily changes the name of each volume in some insignificant way (like appending a # character to the name). The next time it runs, it could look for and just remove the trailing # character. I'll test some more to see if this does the trick, and post my results at some point (when I have time 😉)

Dec 12, 2014 2:48 AM in response to Cerebro

Hello All,


Since I was also in the same boat, I read through this posts, Steps I took below.


1. Copied 3rd Party software of the External HD and pasted it on Macbook Pro.


2. I tried to eject the Ext. HD.


Hurray.... It removed safely!


I believe its the 3rd Party Software on HD that causing this problem.. It is bit strange but that was the problem.


I hope this helps to others to as there seems to be many people facing this problem. 🙂

Mar 9, 2016 7:11 AM in response to Cerebro

When a volume won’t eject, sometimes force-quitting the Finder will let you eject it after the Finder relaunches. On the keyboard, enter Command-Option-Escape, and from the Force quit window that will appear, select the Finder. After the Finder relaunches, quickly eject the trouble volume before the problem reoccurs.


A utility named “What’s Keeping Me” will give you info on which files are open on a volume, and which apps have them open, which can prevent a volume from being ejected, but it may be more technical than most people want to deal with.


However, force-quitting the Finder or closing files and apps may not be a permanent solution for a volume that won’t eject. In most cases, when a volume still won't eject, Spotlight is the culprit. Normally, if Spotlight isn’t having any problems indexing a volume, you can eject that volume before Spotlight is finished indexing it. But sometimes Spotlight has difficulty indexing some files that contain data that Spotlight doesn’t understand, and when this happens, one or more of the specific processes that Spotlight uses (mds_stores, mdworker, mdimporter) will keep those problem files in some pseudo-open state that prevents the volume that they’re on from being ejected--Spotlight isn’t actually keeping these files open, but it continues to “track” them, preventing volume eject, so a more accurate description of this problem may be that Spotlight is keeping open its own index files on the trouble volume, or in some other state that prevents the volume that they’re on from being ejected (these index files are contained in the volume’s invisible folder named “.Spotlight-V100”). The ‘md’ processes aren’t hanging completely, since Spotlight can proceed with indexing the rest of the volume. This problem has existed intermittently in OS X ever since Spotlight was introduced—sometimes Apple seems to have fixed it, and then it breaks again with an updated version of OS X. Many people have been reporting that OS X El Capitan has brought back this problem in force.


As described in this thread, to see what processes are busy looking at a volume, and what files they’ve got open, enter this into Terminal:


sudo lsof "/Volumes/[volume name]” (the quotes allow you to enter a volume name that contains spaces, but if the trouble volume’s name doesn’t have spaces, you don’t need to enter the quotes)


The command “lsof” stands for “list open files”. Whether or not Spotlight seems to be actively busy indexing the volume, and whether or not Spotlight has trouble ejecting the volume, the list will show several instances of the process “mds_store” are keeping open the Spotlight index files contained on the volume. If a volume has been added to Spotlight’s “Privacy” tab in Spotlight’s System Preferences pane, and hence isn’t indexing that volume, the lsof command will still show one instance of the mds process is looking at that volume, but it won’t list any instances of mds_store keeping any Spotlight index files open on that volume.


However, all this does is confirm that Spotlight is looking at a volume, whether or not Spotlight has trouble ejecting the volume--it doesn’t tell us what the problem is. On rare occasion, the problem is a damaged volume directory, which Disk Utility or another utility may be able to repair, but far more often, as I mentioned, Spotlight is having trouble indexing the contents of specific files whose data Spotlight doesn’t understand. To confirm that this is happening, open the Console utility, at Applications/Utilities, and use it to view system.log. There, one of the clues that Spotlight is causing the problem, will be lines something like this, which pinpoint the “dissenter” that’s preventing eject, as the process ‘mds_stores’:


Mar 9 01:45:55 Admins-MBP storagekitd[1143]: Unmount of disk1s2 blocked by dissenter PID=201 (/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metada ta.framework/Versions/A/Support/mds_stores) status=0x0000c010 (Resource busy)


Ideally, you’ll also see error references in system.log to other ‘md’-related processes like mdworker, and the OS X utilities that run them, like mdimporter, where they specify the pathnames of the files that they’re having trouble indexing. In the example below, the culprit is a file named “facebook.gif”:


Mar 9 01:31:02 Admins-MBP sandboxd[127] ([873]): mdworker(873) deny file-read-data /Volumes/250 gig/Users/johnsawyer/Documents/facebook.gif (import fstype:hfs fsflag:4809018 flags:240000005E diag:0 isXCode:0 uti:public.html plugin:/Library/Spotlight/RichText.mdimporter - find suspect file using: sudo mdutil -t 604696)


As you can see by the text at the end of this error message, sometimes the error even tells you the Terminal command to find the offending file, but this just returns the same pathname as is contained in the error message.


What to do? As suggested in this thread, first add the trouble volume to Spotlight’s “Privacy” tab in Spotlight’s System Preferences pane. Sometimes this works immediately, and sometimes it takes a while to take effect before you can eject the trouble volume, since Spotlight may need some time to release its hold on the files it couldn’t index. You may have to force-eject the volume if this doesn’t work, but upon remounting the volume, usually it can then be ejected normally, since Spotlight will no longer be indexing the volume. Adding a volume to the Spotlight prefpane’s “Privacy” tab will also delete all of Spotlight’s hidden index files from that volume, so if the no-eject problem was caused by Spotlight having a corrupted index file, you can make Spotlight rebuild these index files by removing the volume from the Spotlight prefpane’s “Privacy” tab. However, if the real problem was due to files that Spotlight doesn’t understand, that won’t fix the no-eject problem.


If you don’t want to turn off Spotlight indexing for the entire volume, then if the trouble files are contained in folders you don’t need to have Spotlight index, you can add those specific folders to the Spotlight prefpane’s “Privacy” tab (the Privacy tab will accept only folders, not files).


However, adding volumes or folders to Spotlight’s “Privacy” tab will “fix” the problem with the non-ejecting volume only when it’s mounted under the same startup volume that was running the Mac at the time you put the trouble volume or its folders into Spotlight’s “Privacy” tab, since that privacy setting is stored only that particular startup volume--not on the trouble volume. So, if you mount the trouble volume under another startup volume, the problem is likely to return. If you want to prevent the trouble volume from being indexed by Spotlight no matter what startup volume it’s mounted under, create a plaintext file in TextEdit with no content, and save it to the top level of the trouble volume with the title of .metadata_never_index. In TextEdit, uncheck the option to use extension "txt”, or just delete the .txt suffix from the filename field in the Save dialog, and when TextEdit alerts you that filenames beginning with a dot will be invisible, click ‘Use “.”’. If you’re using TextEdit on a newer version of OS X, it may not have the option to not append an extension to the filename, even if you delete the .txt suffix from the filename field in the Save dialog, in which case it will automatically add the suffix ‘.rtf’. If this happens, after you save the file, you’ll need to use a utility that makes invisible files visible, and remove the .rtf extension manually.


Another way to put an end to the trouble volume’s specific cause for its eject problem, is to track down all the files on that volume that Spotlight is having trouble with (see below), and trash them (if you want to save them, back them up onto another volume you don’t normally use, or burn them to an optical disc), or archive them into a compressed file on the volume, which Spotlight won’t try to index.


There may be a Terminal command to list all the files (and their paths) that Spotlight is having trouble with, but I don’t know Terminal well enough to provide that (though the answer to that might be found somewhere else, like at http://www.thexlab.com/faqs/stopspotlightindex.html), but here’s another method:


To have Console display a list of the files that Spotlight is having trouble with, use Console’s ‘Search’ field to search system.log for this string, right after you find that you can’t eject the volume:


deny file-read-data [this will also return all instances of the string ‘deny(1) file-read-data’]


Unfortunately, looking through this list can be difficult, since it will also contain a lot of other text in addition to the pathnames of the trouble files. If the number of trouble files isn’t too large, you can backup/trash/compress them without too much trouble. But if it’s impractical to backup/trash/compress the trouble files (either because the list is too long, or because you need to keep these files on the volume and in an uncompressed state), or if you find that the problem remains even after trashing the trouble files (some other Spotlight bug might be at fault), then you can force-quit from Spotlight’s mds process, by entering this into Terminal:


sudo killall mds


...then unmount the volume quickly, before mds relaunches. If you added the volume to Spotlight’s “Privacy” tab in Spotlight’s System Preferences pane, then the next time you mount the volume under the same startup drive, it’s more likely (but not certain) to be unmountable. Sometimes Spotlight’s System Preferences pane ignores the contents of its Privacy tab. I don’t know the fixes for that. Also, there may be other issues with the volume, besides Spotlight, that prevent ejection, but I don’t have the fixes for those issues handy at the moment.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

MacBook Pro refuses to eject external disk - How do I make this stop?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.