Jump to content
22 posts in this topic

Recommended Posts

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!

post-950366-0-63441000-1458318999_thumb.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. 

 

Feel free to change whatever you want if you do not satisfy with my script: https://github.com/syscl/Fix-usb-sleep

 

How to use?

  • Download the latest fixUSB.sh by entering the following command in a terminal window:
git clone https://github.com/syscl/Fix-usb-sleep

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 your current folder (./) and the next step is to change the permissions of the file(add +x) so that it can be run:
chmod +x ~/Fix-usb-sleep/fixUSB.sh
  • Run the fixUSB.sh in a terminal window by:
cd ./Fix-usb-sleep
./fixusb.sh

If all this procedures have done correctly, you will see the following message in the terminal window

post-950366-0-25227200-1458318931_thumb.png

Hope you all enjoy this script and all feedbacks are welcome! Post issue on 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.

 

  • Like 12
  • Thanks 1
  • 2 weeks later...
  • 3 months later...

My output doesn't seem to match yours... and it also seems to freeze after step 2 (been waiting 15 minutes).

See below. Any ideas?

 

 

iMac:~ xxxxxx$ git clone https://github.com/syscl/Fix-usb-sleep

Cloning into 'Fix-usb-sleep'...

remote: Counting objects: 132, done.

remote: Compressing objects: 100% (7/7), done.

remote: Total 132 (delta 0), reused 0 (delta 0), pack-reused 125

Receiving objects: 100% (132/132), 52.43 KiB | 39.00 KiB/s, done.

Resolving deltas: 100% (72/72), done.

Checking connectivity... done.

iMac:~ xxxxxx$ chmod +x ~/Fix-usb-sleep/fixUSB.sh

iMac:~ xxxxxx$ cd ./Fix-usb-sleep

iMac:Fix-usb-sleep xxxxxx$ ./fixusb.sh

Password:

OK  ]  Create /Users/simondavis/Fix-usb-sleep/tools/tools.

OK  ]  Download sleepwatcher.

  • 5 weeks later...

My output doesn't seem to match yours... and it also seems to freeze after step 2 (been waiting 15 minutes).

See below. Any ideas?

 

 

iMac:~ xxxxxx$ git clone https://github.com/syscl/Fix-usb-sleep

Cloning into 'Fix-usb-sleep'...

remote: Counting objects: 132, done.

remote: Compressing objects: 100% (7/7), done.

remote: Total 132 (delta 0), reused 0 (delta 0), pack-reused 125

Receiving objects: 100% (132/132), 52.43 KiB | 39.00 KiB/s, done.

Resolving deltas: 100% (72/72), done.

Checking connectivity... done.

iMac:~ xxxxxx$ chmod +x ~/Fix-usb-sleep/fixUSB.sh

iMac:~ xxxxxx$ cd ./Fix-usb-sleep

iMac:Fix-usb-sleep xxxxxx$ ./fixusb.sh

Password:

OK  ]  Create /Users/simondavis/Fix-usb-sleep/tools/tools.

OK  ]  Download sleepwatcher.

Try the latest one as my guide.

 

////

Just wanted to say that this appears to have fixed the problem for me.  Thank you for putting this together!!!

 

 

10.11.6

Clover

GA-EP45-UD3P

Feel free to star that project if it work then I can count how many people benefit from that project ;)

  • 3 weeks later...

Recent update log

 

2016-9-16

  • Fixed an issue that will potentially mount external EFI partitions see issue #5 by @brousseau6933
  • Fixed typo: "${gFrom}/tools" --> "${gFrom}"

2016-7-16

  • Switch to curl cmd instead of git clone cmd.

2016-5-26

  • Mount points at wake to fix MacBook issue #2 .
  • Like 1
  • 1 month later...
  • 4 weeks later...

Hey

I just tried this on my GA Z170X-Ultra Gaming and it doesn't seem to work. Mac Os Sierra 12.1

 

 

Hello, could you please provide some information under https://github.com/syscl/Fix-usb-sleep/issuesso that I can help you with your issue.

 

syscl

Recent update log

 

 

2016-12-08

 

  • credit ralexx's detail information such that I added patches to fix PCI/PCIe USB devices sleep issue

 

syscl

  • 2 weeks later...

Hey

I just tried this on my GA Z170X-Ultra Gaming and it doesn't seem to work. Mac Os Sierra 12.1

 

 

 

I too can confirm it does not work on Z170 Ggabyte Designaire.

Thanks for the feedback, please provide information like diskutil list when plug in external storage, I want to see what's wrong.

 

syscl

  • 2 weeks later...
  • 4 weeks later...

Installed fine, but didn't work on my EliteBook. Sierra 10.12.2. diskutil list attached.

Thanks for the feedback, but I do not see there's possible issue.

 

Could you please provide more details, for example, diskutil info disk1, ioreg, something like that.

 

I may write a log version for your case to log out some information...

 

syscl

 

Thanks for the feedback, but I do not see there's possible issue.

 

Could you please provide more details, for example, diskutil info disk1, ioreg, something like that.

 

I may write a log version for your case to log out some information...

 

syscl

 

 

Thanks. Files attached.

 

Console is a screenshot of console to see what happened when laptop went to sleep, not sure if that has any processes related to this, but the ones in it were the only ones that were related to disks.

 

ioreg.zip

install.rtf

console.zip

diskutil.rtf

  • Like 1

I will give it a try to find out if it resolved my issue with my USB external drive.

 

However if think that my problem is related to something other because , i want to boot from a multi partition external drive and get back all volumes after sleep.

 

If i boot from internal hd i have no trouble.

I can also report that it is not working as intended on Sierra. When entering sleep on El Capitan, everything ejects and runs fine. However, on my separate installation of Sierra, I get the "Disk not ejected properly" warning that I had on El Capitan before I had installed this week. This and the Shiki Maxwell kext are the only things keeping me from switching to Sierra as my daily driver because El Capitan is so stable right now.

 

syscl, is there anything I can provide you that will help in diagnosing the problem? Specs are identical for installations because the machine is the same with two separate SSDs holding different Operating Systems. 

 

EDIT: CPU 6600K, GPU GTX 950, IGPU HD 530 (Disabled in BIOS), OS 10.11.6, 10.12.2

  • 2 weeks later...

@Amble @pippox0 @superchase9000 Thank you guys, I will see if there's something wrong. 

 

Though I don't know what change cause this disk eject issue on Sierra, but in my case(Dell Precision M3800 QHD+), there's no disk eject issue on Sierra 10.12.3.

 

If you have any clues, please don't hesitate to place here or place in my GitHub, I will look into it. But as for now, I am too busy refining 80.nvram script and some other stuff. 

 

I apology for my late reply.

 

Have a good day,

syscl

  • 9 months later...
  • 3 months later...

great thank you, @syscl , working just perfectly on both, USB 2.0 and USB 3.0 drives in High Sierra 10.13.3. See my sig below for my rig.

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).

BIG THUMBS UP for you B)!

  • Slice pinned this topic
  • 2 months later...
×
×
  • Create New...