Jump to content
Welcome to InsanelyMac.com - No more ads! And some exciting news... Read more... ×
syscl

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

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 ([email protected]): without his great sleepwatcher, this project/script will not be created.

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

 

////

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 .

Share this post


Link to post
Share on other sites

Hey

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

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

@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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

  • Similar Content

    • By ITzTravelInTime
      Hi guys, this thread is to show you a new and open source app, created by me, that I called TINU:
       
      The name means: TINU Is Not #####, the U refers to a popular software that is used to create macOS hackintosh installers (that for good reasons is banned on this forum), but the aim of the name is to explain that this app is a totally different thing from that software and works in a totally different way.
       
      This app basically is a graphical interface for the createinstallmedia executable that is inside the macOS and Mac OS X installer apps, it is capable to create a bootable installer completely vanilla like what you do using the command line method, and also this method is recommended by apple itself. In addition to this, this app provvides you simplicity and flexybility, and lets you to avoid most of the tedious steps or problems of other simlar apps.
       
      TINU allows you to create easily a bootable macOS installer without messing around with command line stuff and without using disk utility, all you need to do is use the app and then install your bootloader of choiche on the usb (or just leave it as is if you want to use it on a real Mac).
       
      Features:
      - Simple-to-use UI that allows you to easily start the bootable macOS installer creation process.
      - It can work with every macOS installer app that has the createinstallmedia executable inside its resources folder (including also beta and newly released installers).
      - You can use any erasable volume that is at least 7 GB of size (if the volume's drive is not in GUID format, TINU will re-format it accordingly).
      - Can work with the Mac OS recovery system, so you can create a bootable macOS installer from the macOS installer itself or from the macOS recovery partition, and you can use TINU to install macOS, too.
      - 100% clean: The bootable macOS installers created with this tool are vanilla, just as if you created them using the command line "createinstallmedia" method in Terminal.
      - Open Source: You can verify what this program does on your computer and you can create your own version by downloading and playing with the source code.
      - Does not require any special preparations. Just open the program, make sure you have a USB drive plugged in and have a macOS installer app on your disk.
      - No need to use Disk Utility. TINU can format your drive or partition for you.
      - Integrated EFI partition mounter tool.
      - Works using the latest versions of macOS and will also support newer Mac installers out of the box without requiring an update.
      - Offers advanced features to customize your bootable macOS installer.
       
       (To sugegst a new feature please contact me on github)
       
      Requirements:
      - A computer that runs Mac OS X Yosemite or a more recent version (Mac OS X El Capitan is required to use TINU in a macOS recovery or installer).
      - A drive or a free partition (on a drive which already supports GUID) of least 7 GB that you want to turn into a macOS/Mac OS X installer.
      - A copy of a macOS/Mac OS X installer app (Maveriks or newer versions are supported) in the /Applications folder or in the root of any storage drive on your machine (excepted the drive or volume you want to turn into your macOS install media).
       
      Download:
      - All downloads:
      https://github.com/ITzTravelInTime/TINU/releases
      - Reccommended download for Catalina and Big Sur users:
      https://github.com/ITzTravelInTime/TINU/releases/tag/3.0_BETA_4_(82)

      Frequently asked questions:
      https://github.com/ITzTravelInTime/TINU/wiki/FAQs
       
      Useful links:
      Thread (english) on insanelymac.com:
      - http://www.insanelymac.com/forum/topic/326959-tinu-the-macos-installer-creator-app-mac-app/
      Thread (italian) on insanelymac.com:
      - https://www.insanelymac.com/forum/topic/333261-tinu-app-per-creare-chiavette-di-installazione-di-macos-thread-in-italiano/
      Thread (english-german) on hackintosh-forum.de:
      - https://www.hackintosh-forum.de/index.php/Thread/33630-TINU/
      Post on Reddit:
      - https://www.reddit.com/r/hackintosh/comments/a1h61d/tinu_vanilla_bootable_macos_installer_creation/
      Facebook hackintosh help and beta testing (Italian only):
      - https://www.facebook.com/groups/Italia.hackintosh/?fref=ts
      Contact me (project creator):
      - Insanelymac.com profile: http://www.insanelymac.com/forum/user/1390153-itztravelintime/
      - email: [email protected]
       
      Note that:
      - This software is under GNU GPL v3 license so any new branch/mod/third party release must be open source and under the same license.
      - We (the project creator and othe people involved with active developmment) assume no responsibility for any use of this app and this source code, and also for any kind of hardware and software damage to any computer and any device or peripheral that may come from this app or source code during it's use and outside it's usage
      - We do not guarantee support to you, this is only an open source project, not a product released by a company!
      - This project is born only for educational and demonstrative purposes, it's not intended to be used for commercial purposes and it will never be.
      - This is a no-profit project, born only to let people to create macOS install medias in a more simple way and also to learn how to create this kind of apps.
       
      Credits:
      - Apple for macos and installer apps and scripts
      - People that helped me a lot:
      Francesco Perchiazzi, Nicola Tomarelli, Roberto Sciortino, Raffaele Sonnessa, Ermanno Nicoletti, Tommaso Dimatore, Michele Vitiello Bonaventura, Massimiliano Faralli, Davide Dessì, Giorgio Dall'Aglio, Peter Paul Chato.   
      - Special thanks to Italian Hackintosh group!! for help (https://www.facebook.com/groups/Italia.hackintosh/?fref=ts)
      - Thomas Tempelmann for help with the UI
      - Pietro Caruso (ITzTravelInTime) for creating, maintaing and developing this project
       
      Here are also some screenshots inside this spoiler tab
       
       
       
         
    • By gekko.be
      I have an old Hackintosh that I have brought back to life. An ASUS P5KPLAM-SE mobo, Intel Core 2 Quad, with a Sapphire HD 5670 1GB graphics card. It used to work just fine on High Sierra 10.13.3 (I think it was .3) However I only used the DVI port. Updated to 10.13.6 and with AMD kexts rollback to the previous versions I got everything o wrk just fine: boot, HDMI video, HDMI audio etc etc. The only problem I face is that my USB keyboard and mouse freeze/hang seemingly very random... I can not seem to get it right. Unplugging and replugging the USB device makes it work again, sometimes for a few seconds sometimes for an hour ... No idea what's wrong... Have tried tons of options in clover, USBInjectall.kext with port limit patch, whatever I could find... Would there be anyone out there who would have an idea of what could be the problem?
    • By Dradis
      I finally got my Opencore Hackintosh up and running, but I'm still having trouble with the USB ports.  My USB 2.0 Ports work just fine, but my 3.0 ports don't work at all.  Absolutely nothing happens when I plug anything into a 3.0 port.  I'm trying to follow the guides for mapping USB ports, but one of the first steps is to use Hackintool to identify your ports. Hackintool shows that I have no USB ports at all, not even the ones that work.  Btw, a flash drive and my keyboard were plugged into USB 2.0 ports and working at the time this screen shot was taken.  USBInjectAll.kext is in use.  Kernel > Quirks > XHCIPortLimit is set to TRUE in config.plist.  Can anyone please tell me how to make these USB ports work?  Thank you.  
      System:   
      Asus Prime B460M-A  
      Intel i5 10400  
      Intel UHD 630 iGPU  
      Opencore 0.6.0   
      macOS 10.15.6

    • By jrbros1
      Hi there,
       
      So I have my Windows computer, used a USB with Clover setup to boot into Mojave OS that I installed on the SD card in the computer. The world was a great place and all was well!

      Then I did the steps to partition the pc system to now include the additional drive that I would put Clover on. Here's where I messed up: Instead of directly copying over the full Clover folder into the EFI folder of the new drive (which just had the Boot & Microsoft folders in it), I replaced the EFI's boot folder with Clover's boot folder. So the EFI folder now contains a Microsoft folder, a Clover folder, and Clover's Boot folder only.

      Now, I only can access the Clover boot up menu, the macOS, but no Windows at all. Even if I go into BIOS and pick Windows Boot Manager or Partition 1 for the start up, I get a black screen for both. I can still access the macOS as well as Shell, but I don't know what that does other than displaying all of the yellow text fly by..

      Is there a kind soul out there that can help me get Windows back to boot? Keep in mind I'm a bit of a newbie here so laying out the common-sense steps would be helpful!

      Thank you in advance!
    • By danieldbird
      Hi all,
      Wondering if anyone has seen this issue before. My cursor started jumping to a fixed position every say 10 seconds, then all of a sudden just gets stuck in that position and any attempt to move it does nothing and the cursor reverts to the same fixed position. Everything was fine for ages, then this started occurring.

      Here is a short video of it:
      Cursor stuck
       
      Any help or guidance greatly appreciated.
×