Just built myself a new drive (M.2 in a Thunderbolt 4 enclosure) and I'm affected by thus issue. Pretty bad and I'm also worried I might corrupt data on it. I guess the only way is to not put the computer to sleep.
Nope. While sleep is viewed as a popular catalyst, I think sleep only MIGHT play a role in it. I actually believe the sleep perception is driven by the
TIME that passes vs. the actual sleep. I think this problem is tied to passage of time whether Mac is awake or asleep. With some of my enclosures, I have had it "unexpectedly eject"
while transferring files to or from it. No way either end was asleep during a file transfer.
Oh mine never sleeps. It happed while iMac was awake. I don't think it matters if its sleeping or awake, it just happens
Correct. Some people claim using apps like Amphetamine to keep the hard drive perpetually awake resolved the issue for them but I still believe sleep only gets the blame for a different actual cause.
My hypothesis goes back to the roots of macOS which is iOS, which is focused on working energy drain down to minimums to maximize battery life. I think as it works it down if goes too low for some enclosures and they unexpectedly eject. I suspect anti-sleep apps might trick this process some of the time so that it doesn't work the energy sip down below the threshold.
Hypothesis #2 says that it is port management software in general. For example, there are several threads that basically talk about the ethernet port regularly "crashing" and seeming to "reboot." It doesn't take a lot of time but internet seems down while it reboots. What if the other ports also occasionally crash & reboot. That would create seemingly random "unexpected ejections."
Nope, since at least Big Sur. There are
many threads where enclosures were fine pre-Big Sur but then had this problem since Big Sur. In some cases, upgrades from pre-Big Sur to newer macOS showed this issue and owners downgraded again back to the pre-Big Sur macOS: enclosure was fine again. All other variables were the same.
I find connecting SSDs to a self powered Thunderbolt 3 dock (Intel Titan Ridge JHL7440) solves it for me.
The dock handles the USB protocol and supplies power better than the Mac.
Some people have reported this and there's logic that if some other tech is managing the power, perhaps the iOS power sipping algorithms wouldn't potentially contribute here. However this seems as hit or miss as trying different enclosures. Some seem to work, some don't. And if the port crashing hypothesis plays a role here (too?), power management would only be a portion of the catalyst.
Wow even after erase all contents and new setup SSD plugged directly on iMac still ejects suddenly.
Yes, many have assumed perhaps a full re-format need might be needed... myself included... to then find it would not resolve the problem.
What I can offer is that I've actually invested a LOT of time in this problem, digging lots of retired and new enclosures out of storage to see if I could deduce some workaround. I've tried multiple hubs powered & unpowered, multiple cables, etc... basically trying to find something to tangibly blame or resolve
outside of macOS. Best I can deduce,
this is a macOS issue and only Apple can fix it.
For those who want to hypothesize blame into cable, enclosure, firmware, drives, power supply, user error, etc, eject the drive and hook it to any PC or any Mac running macOS older than Big Sur and it will probably magically "just work"- no "keep awake" apps, no settings alternations, etc required. Then bring it back to the new Mac and it will probably "unexpected eject." If the new Mac is able to run on a pre-Big Sur macOS version, install macOS on a boot drive and boot with that drive and watch the problematic enclosure work with the very same Mac with all other variables "as is"... until you switch back to using macOS Big Sur or newer.
I'd LOVE this to be one someone could crack by changing settings, installing an app, etc. but I'm about 95%+ confident only Apple can fix this one and wish they would get on with it. I miss "just works" Apple. I miss the U in USB meaning what it is supposed to mean. I miss easy access to a BIG RAID enclosure that still works just fine on pre-Big Sur Mac or any PC... just not on the "cutting edge Mac Silicon" for more than about 3 hours max.