A fault in OS X may exist for some users, where external drives unexpectedly eject and cause the system to display a “Disk ejected improperly” warning message. This usually occurs when the system is idling, such as when it is asleep, but at times may happen in the middle of file transfers or when browsing the drive for various files. When this happens, the drive’s view will disappear and all activity from it will halt, interrupting the transfer process.
Generally hard drives randomly ejecting suggests a hardware-based problem such as loss of power to the device or faulty cabling. As a result, the first step in tackling this problem is to try various combinations for managing power and connections:
- Plug devices directly into your Mac
- Avoid daisy-chaining
- Use a dedicated power supply for the device
- Use a powered hub for devices that do not have dedicated power
- Replace cables
Despite these approaches, you may find a drive will continue to eject, but when the same drive is attached to another Mac or to a PC, then it will be stable and not show the same random behavior.
If this is the case with your Mac, then unfortunately the problem may be in a nuance bug with OS X that has yet to be extinguished. In an ongoing Apple Discussion thread about this problem, numerous drives of different types, different makes, and different connections all show the same behavior. With no common hardware configuration to suggest a compatibility error, this suggests the problem is occurring from the way OS X is handling the drives.
As a result, while no universal solution has been found, there are several potential workarounds for this issue that may help stabilize your situation, before ultimately having to purchase a new drive to maintain stability:
Turn off background services that may regularly use the drive
Unless its power related, a drive randomly ejecting will come primarily from some program or service that is interacting with it. Unfortunately simply reading and writing to the drive is not the root cause of the problem, but doing what you can to reduce access to the drive will help prevent spurring of the underlying problem. Therefore, try adding the drive to Spotlight’s Privacy list and ensuring it is listed in Time Machine’s exclusion list (available by clicking the Options button in the Time Machine system preferences).
Turn off drive sleep and system sleep
Go to the Energy Saver system preferences and uncheck the option to put hard disks to sleep when possible. Be sure to do this for all power profiles (Battery, Power Adapter, etc.). In addition, drag the slider settings for system sleep to the far right so they are in the “Never” position, which will prevent the system from going to sleep. Note that for laptop systems, the Battery power profile will not have an option to prevent sleep; however, for Power Adapter you should have a slider or checkbox to prevent sleep mode.
Verify and repair your drive
An often overlooked issue with drives is the health of the partition scheme and filesystem. To check these, open the Disk Utility program and then hold the Command key and click the device name as well as any indented volume names listed under it to select them all at once. Then use the Verify Disk option in the First Aid tab to check the drive for errors. If any errors are found, attempt to repair them.
Turn off Encryption
If you have encrypted your external drive, then try decrypting it to see if the problem will go away. To do this, right-click the drive and choose the option to decrypt from the contextual menu. Once your password is supplied, the drive will begin the decryption process, which may take a few hours to complete, but when done, should reduce the layers of complexity through which OS X will access your data.
Uninstall drive management tools and drivers
OS X contains all of the drivers and services needed for accessing and mounting a locally-attached hard drive, so for the most part, hard drives you use with your Mac should not require any third-party drivers. Despite this, they sometimes ship with drivers that manufacturers recommend you install. If these are a requirement, then consider switching to a different device, but if not then consider uninstalling any drive management tools you are using. These are developed separately from OS X, and it is possible any small update to OS X could cause compatibility issues with these tools and drivers. If your drive is a special RAID array or other setup that requires custom driver software, then be sure you have both it and your drive’s firmware updated to the latest versions.
Format your drive
Granted this last approach is the last resort option, but is an often-overlooked detail. When you purchase a drive for your system, it will likely be formatted to FAT32 and perhaps have a custom partitioning scheme to work with different operating systems and provide you with backup software, drivers, and other offerings. While you should be able to use the drive as-is, the best approach is to fully partition the drive and format it freshly for use with your Mac, the instructions for formatting your Mac’s drive can be found here.
Even if you have already formatted your drive, problems may have cropped up that are not being detected by Disk Utility’s drive verification routines. These can be with the formatting, but also with some nuance configuration file or two that OS X stores on the drive, which may be the root of the error. Therefore, do what you can to back up all contents of the drive, and then use Disk Utility to fully partition and format the drive. When done, copy your data back to the drive and see if regular use of it is more stable.