Blog Post

The TRIM command on SSD and HD SMR

The TRIM command on SSD and HD SMR

TRIM is a command for the ATA (Advanced Technology Attachment) interface that allows the operating system to inform the device controller which data blocks are no longer in use. This enables the controller to proactively "clean" them internally, anticipating the need for writing and improving the efficiency of the storage device.

This standard specifies the ATA interface between host systems and storage devices. It provides a common connection interface for system manufacturers, system integrators, software vendors, and storage device vendors. It standardizes not only the connections, defining the connectors and cables for the physical and electrical interconnection and logical characteristics of the signals, but also the protocols for transport commands, data and interface status. Therefore a HDD SATA ( Serial ATA), for example, follows a standard that allows it to work on any CPU Board manufacturer and on any Operating System. Everyone follows this pattern. And TRIM is one of the commands present in this protocol.

It is a crucial feature for maintaining and optimizing performance on solid-state drives (SSDs, for example). It addresses a recurring problem in this type of device: the management of data blocks already used and marked as deleted by the Operating System.

In SSDs, data writing occurs in pages and blocks and is done first by zeroing and then writing. This is how NAND Flash memory works: to receive a new recording, that region must be reset. So, when the operating system deletes a file, it marks the blocks associated with that file as available for reuse and after a "cleaning" process, it will be possible to write to these blocks again.

This can result in a phenomenon known as "performance degradation", in which writing to already used blocks becomes slower as the SSD becomes more full. This is where TRIM comes in.

At first only SSDs and devices with memory Flash (memory cards, for example) made use of it. Recent families of HDDs also started to use the TRIM command.

What impact does this have on Data Recovery?

On a device without TRIM, when a file is deleted, the operating system marks in its internal file table that the file was deleted and will not show it in its file listing, for example. It does not clean the region where the file is present; it only removes it from its list. This allows, in a data recovery process, the file to be recovered if necessary.

On a device with TRIM enabled, when a file is deleted, the operating system will inform the device that the blocks of that file will no longer be in use and that they can be reset. Remember the SSD recording process – first reset and then make a new recording. Then, when the equipment is idle, these routines are activated, resetting all blocks of the deleted file and leaving it ready to receive new recordings.

The TRIM command

TRIM command active on an SMR HD

In this scenario, if you need to recover what was deleted in a data recovery process, the file can be recovered, but its contents will be completely reset, so it will no longer work.

Data recovery companies have procedures to stop the TRIM process, but if it has already been run by the device, there is nothing more that can be done.

Therefore, in the case of data loss due to formatting or deleting files on a device with TRIM activated, it is recommended to turn it off immediately and look for professional help.

Related Posts