Eject Photos external drive used by Library scan and Media analysis macOS processes

Photos library on an external hard drive - how to safely eject it when it is being used by photoanalysisd or photolibraryd or mediaanalysisd or Spotlight ?


so I guess many people are doing it somehow - what is the best way guys?


just now happened to me - and I've done the good old lsof


it of course returned a whole bunch of processes - then I had to Quit them


and in case of photolibraryd - this process was a stubborn one, I had to kill it with Force Quite eventually, it didn't want to give up.


any more elegant way to do this? Maybe there is a central Force Eject or parent process that I can gracefully quit, so free up the hard drive ?


% sudo lsof /Volumes/T5SSD
COMMAND     PID    USER   FD   TYPE DEVICE    SIZE/OFF  NODE NAME
mds         571    root   24r   DIR   1,25         576     2 /Volumes/T5SSD
photolibr 28517 MYUSEDIR  txt    REG   1,25    18612224 57654 /Volumes/T5SSD/Photos Library.photoslibrary/database/Photos.sqlite-shm


MacBook Air (M5, 2026)

Posted on May 25, 2026 8:03 PM

Reply
33 replies

May 27, 2026 2:37 PM in response to Jeff Donald

what did work was diskutil with force


first one showed the offending process - then second one very quickly did the job


% diskutil unmount /Volumes/T5SSD     
Volume T5SSD on disk7s1 failed to unmount: dissented by PID 766 (/System/Library/PrivateFrameworks/MediaAnalysis.framework/Versions/A/mediaanalysisd)
Dissenter parent PPID 1 (/sbin/launchd)

% diskutil unmount force  /Volumes/T5SSD
Volume T5SSD on disk7s1 force-unmounted

May 26, 2026 8:17 AM in response to realaaa

While it hasn't happened to me, yet, unplugging the drive may risk corruption. This can be subtle and cumulative. You need to be sure that you have a backups. While you say "So far un-plugging and re-plugging the drive didn't do anything ," I thought that was the concern that led you here.


One way to eject a disk is to turn off the computer. I'd like to think it shuts everything down safely. Another method I'm not sure of is to log out without shutting down. Fast user switching may do that, too, but I haven't tried it with a stuck drive. I will the next time, though, now that I've thought of it.


I have a small 4 TB SSD that weighs just an ounce that I carry with my MacBook. I use that to hold enough files that I can keep my System Library on the internal drive. I also have Time Machine on a separate volume on this drive that I use for backups.

May 26, 2026 4:07 PM in response to Barney-15E

thank you Barney !


alright so yesterday evening after reconnecting the drive, I did get a little scare yes - Photos got frozen couple times, and it wouldn't open - kind of similar to this one - https://discussions.apple.com/thread/254376220?sortBy=rank


so I just left it overnight to sit with SSD connected, and this morning Photos opened without any issues, and no library re-scan etc


OK then - lesson learned, don't do what I did kids ! if there are such processes still busy on the external drive, I guess safest way is to do full shut down, this should stop all of such background processes properly


however I am still curious, there must be a way to emulate such shut down just for the external drive

May 26, 2026 6:46 AM in response to realaaa

Are you using iCloud Photos? That would make it especially cumbersome to use Photos on an external drive with a MacAir. Plugging and unplugging the drive may cause Photos to re-scan the entire Library to see what changed.


Of course, that can happen even without iCloud. Do you plug and unplug the drive multiple times? That may be the very thing that's causing the trouble.


I use a MacBook, so I have the same concerns, and I generally recommend that people with laptops not keep their System Libraries on external drives. I keep a smaller "Favorites" Library on my MacBook internal drive, and that's connected to iCloud. I keep less "watchable" Libraries on external drives. I connect those when I need to find something from way back (like I did last night!) or if I need to transfer images between Libraries.


Some Libraries refuse to give up the connection, and I try a few times and then do a Force Eject. Since these aren''t my System Library, and since I have multiple backups, I don't worry much, and I haven't seen issues. No Shamans required.

May 26, 2026 1:13 PM in response to realaaa

but anyways yeah, I guess my main immediate issue at hand will be if I want to quickly umount this SSD drive, it might be every time a dance with shaman rituals, chasing and killing processes etc

I don’t know that that will be possible until all of those processes complete their initial scans which could be days.Even after that, I’m not sure if it locks onto it while Photos is open or not. I do keep my Photos library on an external drive, but it’s connected to a desktop Mac so I don’t ever need to disconnect it. You may need to either log out or maybe even shut down when you need to “quickly” disconnected, which really won’t be quickly.


well, I don’t purposely disconnect that drive, it is connected with either a flaky cable or a flaky port on the drive itself and when the cable gets bumped or moved, it will drop the connection and I don’t think I’ve experienced any corruption after having that happen a few times anyway

May 27, 2026 4:10 PM in response to Jeff Donald

sheesh that long ago ! yeah I guess so maybe it was couple more years when I got it, my memory is a bit vague


might be a time for the next and bigger SSD then ..


meanwhile the Photos finished their Restoring part, and now back to normal - well I guess there is that, I'll probably do that for now (diskutil force) or otherwise full shut down


thanks to you all !

May 28, 2026 6:56 AM in response to Barney-15E

Barney-15E wrote: …they added the drive to Spotlight privacy to prevent indexing.

I think I prefer for my Mac to know what's on my disks. Searching is important for me. A thumb drive, though, doesn't usually have much on it, and they are exceptionally slow-- so maybe no indexing for them.


Still, a re-start of my Mac is safe, and it takes way less time than most of the "make it eject" strategies.

May 26, 2026 6:07 AM in response to Barney-15E

thanks ! yeah, it is also interesting actually to deconstruct given this issue as opportunity, what and how is using the drive, one peculiar process is this mediaanalysisd it seems like


but anyways yeah, I guess my main immediate issue at hand will be if I want to quickly umount this SSD drive, it might be every time a dance with shaman rituals, chasing and killing processes etc


which is fun of course, but I am sure there is a better way to it, gotta be ! I can see lots of people are moving their Photo library to external drives, so I can't be the only one with such question (hopefully)

May 26, 2026 7:50 AM in response to Richard.Taylor

Thanks Richard ! yes I am using iCloud and MacBook Photos is really only to have occasional overall overview of the entire library, and perhaps to generate some Memories across last 15 or so years


also one of the reasons I moved it to external drive, is that I FINALLY imported all the other photos to it, from Google and OneDrive and whatever other Android phones I had over the years. So before doing all that import / upload non-sense, I just moved the library to external 1TB drive, as I don't want all that stuff to live (and most of the time do nothing) on main MBA.


I really only will need it on occasion, and at that time I will have the external SSD plugged in.


So far un-plugging and re-plugging the drive didn't do anything yet, of course I am also mindful and careful NOT to run Photos while the drive is not inserted, so hopefully it doesn't bork on me at some stage, if it suddenly decides to re-scan all those 80k + objects it won't be much fun..


I guess having those other secondary libraries is a way - but for the time being I do want though to keep the entire copy in iCloud for convenience purposes (plus I want to stress test those Memories see what I can get Apple AI to generate for me now), that is until I decide to de-Apple maybe (but that's another story anyways).


Let's see maybe I am the weird one after all ! But I thought there are many people doing the same

May 26, 2026 8:21 AM in response to Richard.Taylor

yes now I have this concern about corruption, thanks mate ahaha :) but yeah nah, I think I should be OK there, but I will let you guys know here, if my Photos library goes mad at some stage


I am usually quite OCD about ejecting properly, so yeah I definitely won't just yank it off while Photos is running or anything like that, it's just those pesky background processes that bug me


mostly the question is two fold


  1. is there a way to stop macOS from trying to muck around with this external drive, when Photos is not running. This part may be solvable by disabling some of these services, and making them manual start only, when I start Photos app.
  2. when this does happen - i.e. I want to eject the drive, but these services are using it, is there a Global Eject or Parent Kill that I can do, to do that a bit more quickly - than doing lsof and then killing by process name / ID

May 26, 2026 8:39 AM in response to realaaa

Sorry about putting the corruption bug in your head! It's the sort of thing that I think about when someone says that it's been OK so far…


#1 No. When you use Photos, you are asking it to muck around in the background with the Library. That's what it does; that's its job.


#2 I don't think that killing a process guarantees a soft landing. I'm pretty sure that shutting down or logging off does. I just tried fast user switching, and that isn't the answer.


I'm not expert at this, by the way…

Eject Photos external drive used by Library scan and Media analysis macOS processes

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