SSDs, TRIM, and the Recovery of Deleted Data
SSDs are known for their stability and speed, but what is not well understood is what happens with modern SSD drives with TRIM-enabled SSD recovery when files are deleted. So first of all:
What is TRIM?
TRIM is a command that must be supported by both the computer’s operating system and the SSD within that computer. In short, TRIM is a way to extend the life of your SSD and avoid the inevitable performance degradation that occurs over time if TRIM is not active.
The reason why SSDs degrade over time is very simple. There is a performance hit with each write attempt because in order to accept new data from the SSD area the old data must be removed first, and then each page must be read first (to see if the page is empty or not) and then effectively written out. Twice, once clears the original data and once more writes the new data to the page.
The more it gets deleted over time, the more likely it is that some or all of the pages you are writing will have to first erase the current data. In the early days of SSD drives, these slowdowns resulted in a speed advantage that could eventually result in SSDs being slower than traditional hard disks.
This problem is known as write amplification and becomes a big and unwanted problem on expensive SSDs.
More info on write amplification.
The phenomenon of write amplification exists because the flash cell must be empty before writing. There is another problem that complicates the way this is handled within the SSD, and it depends on the basic way the SSD behaves.
Data is divided into various units on the SSD, and SSD’pages’ and SSD’blocks’ are considered here. When data is written to the SSD, it is written to a page, which is usually 2KB or 4KB. But when the erase cycle occurs, it must happen in the block. This block consists of several pages, let’s say five for this article.When a small file or part of a large file is written to a page within a block, there may be different pages used by different data. SSDs have no problem storing data in this way. Files on the same page are deleted.
We’ve already discussed that to optimize your SSD you need to clear deleted data with TRIM, but there are additional issues that can slow down your SSD even further. The problem with this is the fact that the SSD can only erase the contents of the used area one block at a time. This adds additional overhead as data that occupies the same block and has not been deleted must be cached by the SSD, and a block erase has to be performed and then rewritten when the erase is performed.
For this reason, write amplification can degrade performance several times over the SSD’s known write speed, and in some cases can increase up to 1000%. If it isn’t handled effectively, you can clearly see this is a big problem.
How does TRIM work?
With TRIM-capable SSDs and computers, you don’t need these for non-SSD drives as the extra work takes place when data is deleted.
Typically, when a file is deleted, the records for that file within the file system are removed or marked as available (or both depending on the specific file system/operating system combination). In the case of standard hard drive, it saves time and overhead as there are no issues like the slow performance mentioned above when overwriting existing data.
In TRIM-enabled systems, additional commands are sent to the SSD drive. Otherwise, you don’t know what’s going on at the file system level when files are deleted. This command tells the SSD which pages contain deleted data so that the SSD can erase these pages during the garbage collection cycle.
How does TRIM affect data recovery?
It’s a simple question to answer. If you use TRIM to erase your data, it cannot be recovered. Data is zeroed in a way that leaves no trace of previous content.
After the TRIM command erases the data, the deleted data cannot be recovered from the TRIM-supported SSD/operating system. All file undelete programs that have saved people from lost data from their old hard disk drive are no longer available once TRIM is launched. If the prevalence of SSDs continues, file recovery software may soon be a thing of the past or resign with limited use where data is not deleted and the system fails or becomes corrupted.