The disk "..." wasn't ejected because one or more programs may be using it

Ever since I started using my Mac Mini M4 Pro (latest version of Sequoia) I'm constantly getting the message The disk "..." wasn't ejected because one or more programs may be using it with external backup drives, despite every time having quit all applications apart from the Finder. And, of course, the drive doesn't eject.


It isn't an issue with my 2021 iMac running Ventura.


I'm guessing it must be some OS process running in the background?


Any ideas of how to cure this, please?



Mac mini (M4)

Posted on Dec 2, 2024 11:02 PM

Reply
Question marked as Top-ranking reply

Posted on Jan 2, 2025 2:04 AM

Just to add


And Yes, have experienced this same issue on a M4 Mac Mini with Sequoia 15.1.1 and 15.2


Finding the offending file and application


If you've just seen a dialog that a volume can't be ejected, you can find the offending item in the Terminal application. Open the Terminal application and paste in the following:

sudo lsof | grep "CCC Backup"

Replace "CCC Backup" with the name of your own backup volume, then press the Return key. You will be prompted for your admin password; enter your password, then press the Return key again. The "list open files" utility will print a list of open files specific to that volume, and will include the name of the application that has the open file reference.

It's usually Spotlight

More often than not, some Spotlight process is retaining an open file on the backup volume and preventing it from being unmounted. If you find "mds" or "mds_stores" listed in the lsof output, you can disable Spotlight on your backup volume to prevent the interference. To disable Spotlight, open System Settings > Spotlight, scroll down and click "Search Privacy…", then drag the backup volume into the Privacy table. This only affects the selected volume, and it's reversible, you can remove it from that list should you decide that you want to re-enable indexing.

Once you have disabled Spotlight indexing, Spotlight should immediately cease indexing activity on that volume. The same underlying problem that might be causing Spotlight to fail to release an open file, however, (e.g. a stall) may also prevent Spotlight from ceasing the indexing activity. If you are still unable to unmount the volume after a) confirming that it was Spotlight with an open file, and b) adding the volume to the Spotlight Privacy table, you can either terminate the mds and mds_stores processes in the Activity Monitor application, or simply restart the system.

Sometimes Spotlight is so hung up, you can't add the volume to the Spotlight privacy list


We have recevied several reports from Sequoia users that the suggestion to add the backup volume to Spotlight's privacy table does not work; System Settings issues an error, "The item couldn’t be added or removed because of an unknown error". Clever users have attempted to use the mdutil command-line utility to disable Spotlight on the backup volume, but that also fails, "Error: unable to perform operation. (-400)". If you find yourself in this position and you're comfortable in the Terminal application, you can try the following steps to manually exclude a volume from Spotlight indexing:


  • Quit the Terminal application if it is open
  • Grant Full Disk Access to the Terminal application in System Settings > Privacy & Security > Full Disk Access
  • Open the Terminal application and then open the Spotlight configuration file on your backup disk for editing:
  • sudo pico "/Volumes/CCC Backup/.Spotlight-V100/VolumeConfiguration.plist"
  • Add this block right after the "<dict>" line towards the top:
  • <key>Exclusions</key>
  • <array>
  •     <string>/</string>
  • </array>
  • Press Control+X, then type 'Y' to save and exit.
  • Unmount the backup volume (forcefully, if necessary), then remount the volume. Spotlight indexing should now be disabled on that volume.


4 replies
Question marked as Top-ranking reply

Jan 2, 2025 2:04 AM in response to BlueberryiMac

Just to add


And Yes, have experienced this same issue on a M4 Mac Mini with Sequoia 15.1.1 and 15.2


Finding the offending file and application


If you've just seen a dialog that a volume can't be ejected, you can find the offending item in the Terminal application. Open the Terminal application and paste in the following:

sudo lsof | grep "CCC Backup"

Replace "CCC Backup" with the name of your own backup volume, then press the Return key. You will be prompted for your admin password; enter your password, then press the Return key again. The "list open files" utility will print a list of open files specific to that volume, and will include the name of the application that has the open file reference.

It's usually Spotlight

More often than not, some Spotlight process is retaining an open file on the backup volume and preventing it from being unmounted. If you find "mds" or "mds_stores" listed in the lsof output, you can disable Spotlight on your backup volume to prevent the interference. To disable Spotlight, open System Settings > Spotlight, scroll down and click "Search Privacy…", then drag the backup volume into the Privacy table. This only affects the selected volume, and it's reversible, you can remove it from that list should you decide that you want to re-enable indexing.

Once you have disabled Spotlight indexing, Spotlight should immediately cease indexing activity on that volume. The same underlying problem that might be causing Spotlight to fail to release an open file, however, (e.g. a stall) may also prevent Spotlight from ceasing the indexing activity. If you are still unable to unmount the volume after a) confirming that it was Spotlight with an open file, and b) adding the volume to the Spotlight Privacy table, you can either terminate the mds and mds_stores processes in the Activity Monitor application, or simply restart the system.

Sometimes Spotlight is so hung up, you can't add the volume to the Spotlight privacy list


We have recevied several reports from Sequoia users that the suggestion to add the backup volume to Spotlight's privacy table does not work; System Settings issues an error, "The item couldn’t be added or removed because of an unknown error". Clever users have attempted to use the mdutil command-line utility to disable Spotlight on the backup volume, but that also fails, "Error: unable to perform operation. (-400)". If you find yourself in this position and you're comfortable in the Terminal application, you can try the following steps to manually exclude a volume from Spotlight indexing:


  • Quit the Terminal application if it is open
  • Grant Full Disk Access to the Terminal application in System Settings > Privacy & Security > Full Disk Access
  • Open the Terminal application and then open the Spotlight configuration file on your backup disk for editing:
  • sudo pico "/Volumes/CCC Backup/.Spotlight-V100/VolumeConfiguration.plist"
  • Add this block right after the "<dict>" line towards the top:
  • <key>Exclusions</key>
  • <array>
  •     <string>/</string>
  • </array>
  • Press Control+X, then type 'Y' to save and exit.
  • Unmount the backup volume (forcefully, if necessary), then remount the volume. Spotlight indexing should now be disabled on that volume.


Dec 3, 2024 10:36 AM in response to BlueberryiMac

The most likely cause is Finder. Relaunch Finder using the "Force Quit Applications" menu (cmd-option-esc) and then try ejecting.


If that doesn't work then the next most likely thing is that Spotlight is indexing it. Have you added the disc to Spotlight's Privacy list in Settings?


If it's not these then get the app "What's Keeping Me". This will tell you which applications are using the disc so you can either quit them or work out why they are using it.

Dec 3, 2024 10:25 AM in response to BlueberryiMac

BlueberryiMac wrote:

Ever since I started using my Mac Mini M4 Pro (latest version of Sequoia) I'm constantly getting the message The disk "..." wasn't ejected because one or more programs may be using it with external backup drives, despite every time having quit all applications apart from the Finder. And, of course, the drive doesn't eject.

It isn't an issue with my 2021 iMac running Ventura.

I'm guessing it must be some OS process running in the background?

Any ideas of how to cure this, please?



See if there is anything here—

USB drive can't be unmounted because it's… - Apple Community


Jan 2, 2025 12:10 AM in response to BlueberryiMac

Having the same issue here. My brand-new MacBook Pro running Sequoia 15.1 won't eject attached USB storage or SD cards. I don't think it's a Spotlight issue. Along with relaunching the Finder, I've also tried logging out and logging back in to no avail. This feels like a big bug, because earlier versions of macOS also had Spotlight running in the background and didn't suffer from this glitch.


Something similar used to happen a long time ago when opening media files on attached storage with Quicktime. Even if the file had been closed, if Quicktime was still running then the Finder wouldn't allow ejecting the drive that held the media file. Only quitting Quicktime would free up the drive to be ejected.


I wonder if there's some background process other than Spotlight that's hanging on to any USB drive that gets connected?

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.

The disk "..." wasn't ejected because one or more programs may be using it

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