I migrated my external hard drive from a USB enclosure to an OWC miniStack STX thunderbolt enclosure and started getting the "Drive not ejected" messages non-stop when the computer went to sleep. Computer is a MacBook Air M1. Things I tried that did not work:
- Boot into safe mode & reboot
- Reset PRAM
In the end, what did work:
- Open a Terminal window and set the disk drive sleep time to a longer interval (in my case, from 10 minutes to 20):
sudo pmset -c disksleep 20
(the -c option sets the power management settings for when the Mac is connected via a charger). Slightly shorter durations (e.g. 15 minutes might work as well, I've not tested that, but I suspect that you need to make the disksleep duration > displaysleep)
You can verify your newly changed settings via: sudo pmset -g live
Here's what mine are now set to:
System-wide power settings:
Currently in use:
standby 1
Sleep On Power Button 1
hibernatefile /var/vm/sleepimage
powernap 1
networkoversleep 0
disksleep 20
sleep 1 (sleep prevented by sharingd, bluetoothd, powerd)
hibernatemode 3
ttyskeepawake 1
displaysleep 10
tcpkeepalive 1
lowpowermode 0
womp 1