IMac trim setting: How to enable TRIM command on 3rd party SSDs?
SSD has a different principle of operation than HDD. The methods of the operating System for cleaning or formatting are focused on working with sectors and cells of standard hard drives. Applying the same principle to the memory of a solid-state drive causes a decrease in write speed when working with previously used pages and, accordingly, SSD blocks. Activating the TRIM command will help to fix this problem.
With the advent of solid-state drives, the question of providing SSDs with a sufficient number of rewrite cycles, comparable to standard hard drives, has become acute. Since the SSD initially has a different operation principle, separate from the hard disk drive (HDD) operation, the standard methods of the operating System for cleaning or formatting are focused on working with sectors and cells of traditional hard drives. Applying the same principle to an entirely differently organized memory matrix of a solid-state drive causes a decrease in write speed when working with previously used pages and, accordingly, SSD blocks.
Further, it is worth explaining a little the need for the TRIM command in the ATA interface.
The fact is that during most of the development and improvement of the interface, including serial ATA, it was necessary to work exclusively with hard drives, flash drives appeared relatively recently, and their mass introduction as the primary System drives occurred even later.
In hardware, the processes of recording, rewriting, and deleting data on HDD and SSD are fundamentally different:
First of all, it is essential to know that during the standard operation of deleting a file in the operating system. The information itself is not physically deleted. Only the corresponding place in the file table is cleared (the most suitable one is “The book was not thrown out of the library, but the record in the card index was deleted”). In this case, the repeated writing of the file to the space cleared in this way is done “over” the information remaining there.
Deleting (clearing) writing to a free HDD cell is physically the same process. The important thing here is that the read / write head works with the specified cell, regardless of whether it currently contains information or not (writing to a “blank” cell and “over” data is performed at the same speed).
Reading and writing data on an SSD, as you know, is much faster than on an HDD, but it is essential to understand that we are talking only about writing to free pages. It is an elementary element that stores data on an SSD is a page, then the pages are combined into blocks, by analogy: cells and sectors in the HDD. However, the physical location and organization principle are different.
Due to certain physical features – data is written to SSD only in free pages, but if “overwriting” is required. The block data is first written to the cache, modified, that is, “unnecessary” pages are deleted from them, the entire block is cleared and written again. Such a process (Boost write) significantly reduces the speed of the SSD and reduces its resource.
The TRIM command was introduced into the standardized ATA interface precisely to reduce the amplified entries. It allows the System to mark cleared pages as unused. In the future, provide the SSD controller with the opportunity to optimize the drive’s operation (this is done in various ways and will not be considered further).
The TRIM command was introduced to Apple computers with the release of the first MacBook Pro with a pre-installed SSD. With Mac OS Lion version 10.6.6, TRIM has become part of the Apple operating system. Initially, TRIM’s work with third-party solid-state drives (with a self-upgrade of the computer) was blocked, which led to a significant drop in solid-state or hybrid drives’ performance after a while. However, today for all versions of Mac OS, starting from 10.6.6 and higher, there is a way to activate the TRIM system.
You can check TRIM support by going to the “About This Mac” menu and selecting “System Report”, then from the “Hardware” menu, select “Serial ATA”, click on the name of the SSD drive being used in the right menu and find the line “TRIM Support.” If you are using a third-party SSD, this line will display “No.”
IMac TRIM is configured through the terminal. At the same time, you should avoid third-party utilities for activating TRIM since they can directly affect the system kernel and lead to irreversible consequences. It is also worth abandoning TRIM activation on an iMac equipped with an SSD with a SandForce controller of the 2000 series (the serial number starts with 2 and looks like SF2xxx).
Before you start configuring TRIM on your iMac, you should back up your editable data. To do this, do the following in the terminal:
These commands must be entered without quotes and on one line. This and subsequent commands will require an administrator password.
If your computer is running Mac OS 10.10 Yosemitte, you need to boot your computer in a mode that allows editing drivers. To do this, enter the following lines:
The command will restart the computer in the required mode. For Mac OS version 10.9 and below, you should skip this step.
Next, you can start activating TRIM on your iMac (or other Apple device). To do this, enter the following command:
This command will look at the driver file, find the line containing “Apple” (looks like “APPLE SSD” and is responsible for TRIM blocking for third-party solid-state drives), and replaces it with blank values (zeros). In other words, the team will patch a driver for the iMac to use TRIM for third-party SSDs.
After all operations, you need to clear the driver cache with the reset command and restart the computer.
If necessary, you can disable TRIM by returning the original values to the driver file with the following command:
As a last resort, it is possible to restore the file from the copy. To do this, you need the created backup:
By following the steps above, we got the TRIM system working on an iMac with a third-party SSD installed. The SSD will then run faster and last much longer.
In addition to this method, the TRIM command for third-party SSDs can still be activated with specialized utilities. The most popular among them are Trim Enabler and Chameleon SSD Optimizer. By the way, the latter is capable of activating the TRIM command, including on a self-created Fusion Drive, which is a specially organized RAID array (and, as you know, the TRIM command sometimes does not work correctly on some RAIDs). Among other things, you can also activate TRIM on Fusion Drive (as well as create it) through the system Terminal.
As a result, when choosing a new drive (if it is not the original one supplied by Apple), you should pay attention to its volume and speed characteristics and the controller model. This determines the operation of an SSD for iMac in the future (in particular, the ability to enable and the effectiveness of using the TRIM command).