Contribute
Register

USB drives Not Properly Ejected on wake from sleep. [Yet another solution but this one is free!]

Status
Not open for further replies.
Are you using 10.14.5? Mine does not work.. still not ejected properly.. :(

EDITED - Got my info a little wrong and now corrected.

OK, I registered just to try and help you here. I have been trying for a couple of days to get various things to work, trying the githuib on which didn't't work for me, and neither did the one in this thread to start with, but having a look at the rc.sleep and rc.wakeup scripts and running them in terminal trying different things, I finally got it to work!

I noticed that the format was 'disk[0-9]s.*' whereas the disks are actually labelled disk11s1, disk11s2 etc, the '.*' part wouldn't work. So I changed to 's*' removing the dot. And it worked!

So in summary I changed rc.sleep to:

#!/bin/sh
/usr/sbin/system_profiler SPUSBDataType | grep -e 'disk[0-9]s*' | sed 's/.*\(disk[0-9].*\)/\1/' | xargs -I{} /usr/sbin/diskutil unmount {}

And the first part of rc.wakeup to:

#!/bin/sh
disks=$(/usr/sbin/system_profiler SPUSBDataType | grep -e 'disk[0-9]s*' | sed 's/.*\(disk[0-9].*\)/\1/')

And it now all works! It's best if you uninstall first, then show the package contents of the app to get to rc.sleep and rc.wakeup. Then edit both with Text edit and save. Then install again.

This is working on 10.14.5 for me.

Hope that helps!

Cheers.
 
Last edited:
EDITED - Got my info a little wrong and now corrected.

OK, I registered just to try and help you here.

So in summary I changed rc.sleep to:

#!/bin/sh
/usr/sbin/system_profiler SPUSBDataType | grep -e 'disk[0-9]s*' | sed 's/.*\(disk[0-9].*\)/\1/' | xargs -I{} /usr/sbin/diskutil unmount {}

And the first part of rc.wakeup to:

#!/bin/sh
disks=$(/usr/sbin/system_profiler SPUSBDataType | grep -e 'disk[0-9]s*' | sed 's/.*\(disk[0-9].*\)/\1/')

And it now all works! It's best if you uninstall first, then show the package contents of the app to get to rc.sleep and rc.wakeup. Then edit both with Text edit and save. Then install again.

This is working on 10.14.5 for me.

Hope that helps!

Cheers.

THANK YOU!


Have been around the forum and others to see how to make this work and couldnt find anything that actually does. Removing the simple dot did the trick and now everything on my first Hackintosh works thanks to you! I tried to get the Hack to sleep for a minute and also for an hour. Both works perfectly now. Much appreciated sir!

Now im wondering if theres any other way to get this working normally like how a mac works, without ejecting the drives on sleep with SafeSleep method.. and what causes the drives get forced eject on sleep..?

not that I need it after making it work with SafeSleep + soniferousfox's help. Just curiosity..
 
THANK YOU!

Have been around the forum and others to see how to make this work and couldnt find anything that actually does. Removing the simple dot did the trick and now everything on my first Hackintosh works thanks to you! I tried to get the Hack to sleep for a minute and also for an hour. Both works perfectly now. Much appreciated sir!

Now im wondering if theres any other way to get this working normally like how a mac works, without ejecting the drives on sleep with SafeSleep method.. and what causes the drives get forced eject on sleep..?

not that I need it after making it work with SafeSleep + soniferousfox's help. Just curiosity..

Glad it helped! I had been trying to get this and the other script to work for a while, so it was a relief when I got there! As for the cause, I found a thread about the memory XMP profile affecting it, and sure enough, if I turn XMP off in the BIOS, the message stops, but that also means losing a fair bit of bandwidth, so didn't want to do that. Still doesn't explain why it's happening though.
 
Glad it helped! I had been trying to get this and the other script to work for a while, so it was a relief when I got there! As for the cause, I found a thread about the memory XMP profile affecting it, and sure enough, if I turn XMP off in the BIOS, the message stops, but that also means losing a fair bit of bandwidth, so didn't want to do that. Still doesn't explain why it's happening though.

Hi again!

Unfortunately the Drives started to Eject Not Properly on Wake again after I put it to Sleep over night. Not sure what caused this, but I'm wondering if it has the same issue on your Hack.. Out of curiosity, can you share your Energy Save settings? Did you check the "Put hard disks to sleep when possible" option?
 
Hi again!

Unfortunately the Drives started to Eject Not Properly on Wake again after I put it to Sleep over night. Not sure what caused this, but I'm wondering if it has the same issue on your Hack..

Unfortunately yes, I noticed yesterday that when left for a long time (say overnight) it still does it. I thought it may be to do with Power Nap, so I turned that off last night. But after just waking my PC, the messages are there still. So it seems it works short term, but not long term. I suspect more to do with the sleep watcher daemon than the script itself - I am actually using the other GitHub script now and still getting the same, the daemon being the thing they have in common. Probably when it wakes and sleeps quickly during the night for some reason and sleep watcher doesn't catch it or something.

I can just about live with the message over night as long as I don't get them regularly during the day. I shall continue to look at it though - I may try some different Darkwake setting in Clover to see if that makes a difference. I'll let you know if it does.

Cheers.
 
@xplorick : I use the Github script on my MBP early 2011 so it happens on real Macs too...
 
Unfortunately yes, I noticed yesterday that when left for a long time (say overnight) it still does it. I thought it may be to do with Power Nap, so I turned that off last night. But after just waking my PC, the messages are there still. So it seems it works short term, but not long term. I suspect more to do with the sleep watcher daemon than the script itself - I am actually using the other GitHub script now and still getting the same, the daemon being the thing they have in common. Probably when it wakes and sleeps quickly during the night for some reason and sleep watcher doesn't catch it or something.

I can just about live with the message over night as long as I don't get them regularly during the day. I shall continue to look at it though - I may try some different Darkwake setting in Clover to see if that makes a difference. I'll let you know if it does.

Cheers.

I've finally got my USB 3.0 and 2.0 working normal after sleep/wake. I replaced the port limit with a DSDT on my initial installation but did not add: change EC0 to EC and change H_EC to EC on ACPI. Adding these fix the issue and now its no longer showing any "Disk Not Eject Properly" after wake for USB 3.0 and 2.0, even without SafeSleep or other Apps with Eject on Sleep feature.. This is all working with Auto XMP on my BIOS and used Clover Config to set the XMPDetection to 1. I have only tried this method for 1-2 hours Sleep. Need to try for longer sleep now.

As for the USB 3.1 Gen 2 Type A and C that comes with my motherboard, it's still Ejecting Not Properly on Sleep/Wake and I still can't figure out how to fix it. So for now I'm trying CleanMyDrive 2 App's "Eject On Sleep" feature to see if it can properly eject my USB-C External Hard Drive on long sleep.

Will let you know the results of both of this.
 
Last edited:
Frustrated having this issue in 2019.
Fwiw the original script unmount and made errors go away but doesn't remount upon wake. :(
Mojave 10.14.6
Will try other solutions tomorrow. This was a real party pooper today. Wanted to backup a clean copy of my new system with everything working and this has been a real eyesore lol.
 
Last edited:
I've finally got my USB 3.0 and 2.0 working normal after sleep/wake. I replaced the port limit with a DSDT on my initial installation but did not add: change EC0 to EC and change H_EC to EC on ACPI. Adding these fix the issue and now its no longer showing any "Disk Not Eject Properly" after wake for USB 3.0 and 2.0, even without SafeSleep or other Apps with Eject on Sleep feature.. This is all working with Auto XMP on my BIOS and used Clover Config to set the XMPDetection to 1. I have only tried this method for 1-2 hours Sleep. Need to try for longer sleep now.

As for the USB 3.1 Gen 2 Type A and C that comes with my motherboard, it's still Ejecting Not Properly on Sleep/Wake and I still can't figure out how to fix it. So for now I'm trying CleanMyDrive 2 App's "Eject On Sleep" feature to see if it can properly eject my USB-C External Hard Drive on long sleep.

Will let you know the results of both of this.

Any updates? Thanks
 
Any updates? Thanks
Hi!

I have tried multiple apps for the Eject on Sleep to 'trick' the USB 3.1 Gen 2 not ejecting properly. Unfortunately none of them works for a longer/deep sleep. The drives I had on the slots just keep on ejecting, and it does it multiple times depending on how long the Hack went to sleep. So I removed the apps since it does not help me with my workflow.

So basically what I know so far is the drives gets ejected on sleep just fine using these apps, but somehow the Hack re-mounts it during sleep and force eject the drives after..

and as for now, my only solution is to only use the USB 3.1 Gen 2 strictly for transfering data. I do video editing, so having the option to edit on a USB 3.1 Gen 2 drives would help me a lot, but for now, I store the Project Files that I'm currently working on my internal SSD and have the Project Assets (materials) on both the internal and external SSD. So whenever I need to edit on the go with my Macbook, I just need to copy the Project Files.. Can't think of other more efficient workflow for my needs.

Still hoping for a real solution for this..
 
  • Like
Reactions: CN7
Status
Not open for further replies.
Back
Top