Contribute
Register

[Guide] Fix issue of "Disk not ejected properly"

Joined
Aug 4, 2015
Messages
83
Motherboard
iPhone 5s
CPU
E3-1230 v3
Graphics
nVidia Geforce 8600GT
Mac
iMac, MacBook Pro
Mobile Phone
Android, iOS
Overview

On OS X/Mac OS X, some people may suffer from the issue that the external disk was not ejected properly after sleep. This problem dates back to the period of the coming of Mavericks, even on a real Mac!
Unknown.png


Overview of the tools/solutions


AFAIK, there's two solutions to fix this problem till now:


  • Install Jettison from Mac App Store.
  • Use sleepwatcher to unmount the external devices before system go to sleep.

But for me, install Jettison is not free of charge, and this application will place icon on the right corner of the statue bar once get installed, which is not a good solution from my point of view.

The latter one is open source and free of charge, which means I can know clearly what this application/daemon has done and add as many functions I want to it. With the help of sleepwatcher, there's various script to unmount/mount disk upon sleep, but none of it is so easy to read and some require sleep time delay settings, that's really strange! That's the reason why I started to create my "own" version of script to fix this issue. I optimized the whole progress as well as the installation progress. No more wake/sleep delay time settings! No more complicated command line, no more wake script, just one sleep script for unmount the external devices, once you resume from sleep, all the external devices will mount by system spontaneously. After following this guide step-by-step, no more "Disk not ejected properly" error will occur upon sleep.

Download the latest fixUSB.sh by entering the following command in a terminal window:
Code:
[/B][COLOR=#333333][FONT=Consolas]git clone https://github.com/syscl/Fix-usb-sleep[/FONT][/COLOR][B]
Note: If it was the first you execute command "git", please install it by the tips from OS X online(Click "Install"), and then run the above command line again.

This will download the fixUSB.sh to ~/Fix-usb-sleep/ and the next step is to change the permissions of the file(add +x) so that it can be run:
Code:
[/B][B]chmod +x ~/Fix-usb-sleep/fixUSB.sh[/B][B]
Run the fixUSB.sh in a terminal window by:
Code:
cd ~/Fix-usb-sleep
./fixusb.sh
If all this procedure has done correctly, you will see the following message
Snip20160318_3.png

Hope you all enjoy this script and all feedbacks are welcome! Post issue on
HTML:
https://github.com/syscl/Fix-usb-sleep
Credit:
Bernhard Baehr (bernhard.baehr@gmx.de): without his great sleepwatcher, this project/script will not be created.

RehabMan: I was first inspired by his configuration of launch dameon of VoodooPS2.(refer:
HTML:
https://github.com/RehabMan/OS-X-Voodoo-PS2-Controller/wiki/How-to-Install
)
 
Joined
Feb 13, 2011
Messages
239
Motherboard
Asus Vivobook S15 / x510UAR
CPU
i5-8250U
Graphics
UHD 620
Mobile Phone
Android
[EDIT]: not working all of the time on all drives in High Sierra 10.13.3 :( See my sig below for my rig.

I'm now using Jettison, which does always work.

Remember that sleepwatcher is outdated (Aug. 18, 2011) and surely not made for High Sierra.
--- old post:
great thank you, @syscl, working just perfectly on both, USB 2.0 and USB 3.0 drives in .

However, I ran sudo ./fixusb.sh, then restarted because it did not work right away - restart was required (not sure if sudo was required, too, but obviously it did not hurt, either).
 
Last edited:
Joined
Feb 7, 2016
Messages
11
Motherboard
gigabyte z170x
CPU
i7core processor
Graphics
Nvidia GTX 1060
Mac
iMac
Hi there everyone! I tried running this command in Terminal and I got it all the way through to say Done! Please reboot to see change. However, my disk still ejects improperly among sleep. Is there anything else I can do?

I have a i7core processor, gigabyte z170x, Nvidia GTX 1060 graphics card, and a Samsung 850 evo drive. I am running Sierra 10.12.6
 
Joined
Feb 13, 2011
Messages
239
Motherboard
Asus Vivobook S15 / x510UAR
CPU
i5-8250U
Graphics
UHD 620
Mobile Phone
Android
Last edited:
Joined
Jul 24, 2015
Messages
2,332
Motherboard
MSI H81i
CPU
i5-4570
Graphics
RX 580
Hi there everyone! I tried running this command in Terminal and I got it all the way through to say Done! Please reboot to see change. However, my disk still ejects improperly among sleep. Is there anything else I can do?

I have a i7core processor, gigabyte z170x, Nvidia GTX 1060 graphics card, and a Samsung 850 evo drive. I am running Sierra 10.12.6
I believe the cause of this problem is the USB definitions in OEM ACPI tables. Have you tried Rehabman's method/guide to generating an SSDT for USBInjectAll?
 
Joined
Aug 14, 2010
Messages
1,072
Motherboard
GA-Z97X-UD5H-BK Rev 1.0 Bios F8
CPU
i7-4790k OC 4.9ghz
Graphics
GT 740
Mac
MacBook Pro, Mac mini, Mac Pro
Classic Mac
Power Mac
Mobile Phone
iOS
Hope you all enjoy this script and all feedbacks are welcome! Post issue on
HTML:
https://github.com/syscl/Fix-usb-sleep
Credit:
Bernhard Baehr (bernhard.baehr@gmx.de): without his great sleepwatcher, this project/script will not be created.

RehabMan: I was first inspired by his configuration of launch dameon of VoodooPS2.(refer:
HTML:
https://github.com/RehabMan/OS-X-Voodoo-PS2-Controller/wiki/How-to-Install
)
Many thanks for this - I just used it with a Mojave build on a 7th Generation Gigabyte Brix.
 
Top