Maintaining SSD drives in OS X

SSD drives in Mac systems are becoming very popular because of their performance, but though faster than mechanical drives, they may give lower performance over time.

As their prices fall and capacities increase, SSD drives are becoming a more popular option, not only for laptops but also for consumer and pro desktop systems. Apple began offering SSD drives in MacBook Air systems in 2009, but now you can get them as a CTO option for nearly all Mac configurations. These drives offer numerous benefits over older mechanical ones, including the use of less power, less heat generation, and reduced potential for mechanical damage. But a main reason for their increased use is much faster performance when compared with the average mechanical drive.

Even though performance is a major plus to these drives, there are a couple situations that can result in degraded SSD drive performance on Macs. We recently covered one of these situations where people were finding that SSD drives were taking abnormally long to boot, but another problem is more universal to the drives themselves, in that over time and use, the drive's speed will degrade.

The main reason for this has to do with the requirements needed for these drives to write data, where unlike mechanical drives, the SSD storage media needs to be in a ready or "empty" state before it can reliably accept data.

When data is deleted from a drive, the system does not remove the data itself, and instead just frees the blocks to be overwritten by modifying the drive's index and directory files. In mechanical drives this makes no difference because the drive can easily write over used blocks, modifying them to contain the new data in one sweep. In SSD drives, however, the blocks that still contain unused data will need to be properly erased and set to a ready state before they can accept new data. This procedure is done "on the fly" as the blocks are used, but it does take some overhead that will cut into performance.

New SSD drives are shipped with their storage blocks in a ready state, and as a result the drives are very fast; however, as the drive's blocks get progressively filled through use, the number of blocks that are left in the "ready" state will drop until eventually all writing processes by the system will have to wait for the drive to first reset the blocks being used. The performance will not necessarily make your system crawl, or even drop to the speed of mechanical hard drives (especially for second-generation SSD drives), but may be notably slower than the expected performance.

To combat this, drive manufacturers and various OS developers are including "garbage collection" routines that will slowly reset unused blocks on the drives in the background when the drives are not being accessed. These routines include the "TRIM" and "Secure Erase" ATA commands that, if supported in the drive's firmware, can be triggered by a software routine to perform the garbage collection routine on the drive.

While Apple has included SSD as options in its systems for a couple of years, the support for these garbage collection routines has only been implemented for the latest MacBook Pro systems, and only for SSD drives that are shipped with the systems. This means that if you purchase a third-party SSD drive that supports TRIM, OS X will not use it. To date, the most universal method for clearing up and reconditioning SSD drives in OS X has been to perform various erase routines:

  1. Formatting the drive
    One option people resort to is to format the entire drive by first backing it up using Time Machine or a cloning utility, and then using Disk Utility when booted off an alternative volume to partition the drive and erase it by writing zeros to disk. After this is done, restore the backup to the drive.

  2. Erase free disk space
    Another option similar to the first is to use Disk Utility's "erase free space" option to write zeros to all unused portions of the drive.

  3. Third-party solutions
    The use of Disk Utility is not the most optimal solution, especially on systems that do not already support TRIM, so for better results you can use a tool like "DiskTester" to perform a "recondition" routine on SSD drives, which should force the use of TRIM on the unused sections of the drive.

Keep in mind that of these three options that people use, only the last one will truly "recondition" the drive. The first two will write zeros to the drive, which will fill the media with data and not leave it in a "ready" mode unless the system already supports TRIM. As a result they even may cause some drives to report 0KB available to the OS, which can keep your system from booting. Additionally, since SSD cells have a limited number of reliable read and write routines, zeroing out data may reduce the life of the SSD (albeit by only a very small and likely insignificant amount).

Since TRIM support in OS X is relatively new, it likely is being limited in scope for now, and will sooner or later be expanded to support all SSD drives; however, if you would like to enable TRIM support in your system, there is an option to do it with TRIM Support Enabler, which installs a modified drive kernel extension to allow TRIM to work. After applying the patch you should see a line that says "TRIM Support: Yes" in System Profiler when you select your drive under the "Serial-ATA" section.

While TRIM and other garbage collection techniques should help SSD performance in the long run, there is question about the extent to which the average user might benefit from it. A benchmark test by bit-tech last year compared the performance of a MacBook Air using both a fresh and used (dirty) SSD drive, and found no appreciable difference in performance, suggesting this system would not benefit from the use of TRIM. However, the article noted the benchmark may not be conclusive because the overall low SSD performance on the MacBook Air may have masked any performance difference between the "clean" and "dirty" drive setups. On more-optimized systems, the performance difference might be easier to see, though its clear that the effect people see is graded and will be specific for a particular combination of drive, system, and the way the drive is used.

If you wish to try using TRIM Support Enabler on your system, while people have not currently experienced problems, keep in mind that modifying kernel extensions in OS X may cause kernel panics and otherwise destabilize the system. Unless you are experiencing persistent and notable performance issues with your SSD drive, it may be best to just keep the drive as is and not try to optimize its performance by erasing or formatting it. If you must run some sort of utility, be sure it is a program that can execute the TRIM command properly to reset the drive to a proper "ready" state.



Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.

Tags:
Computers
About the author

    Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.

     

    Join the discussion

    Conversation powered by Livefyre

    Show Comments Hide Comments