Wednesday, February 19, 2014

SSDs, TRIM and the Recovery of Deleted Data -By Christopher Steven Sampson


SSDs are well-known for their reliability and speed, but what does not seem to be quite as well understood is what happens on a modern SSD drive that has TRIM enabled when a file is deleted. So first of all:
What is TRIM?

TRIM is a command that has to be supported by both the computer's operating system as well as the SSD within that computer. In short TRIM is a method of both prolonging an SSD's life as well as preventing the inevitable degradation in performance that will occur over time if TRIM is not enabled.
The reason that SSDs degrade over time is quite simple. For an area of the SSD to accept new data, the old data must first be removed, creating a performance hit on each write attempt because each page must first be read from (to determine whether or not the page is empty) then effectively be written to twice, once to clear the original data and once more to write the new data to the page.
The more deletion that takes place over time, the more likely it is that some or all of the pages being written to will need to be cleared of their current data first. In the early days of SSD drives this performance hit eventually resulted in any speed benefits that may have existed eroding to the point that the SSD would become slower than a traditional hard disk.
This problem is known as write amplification and quickly becomes a big and unwanted issue on your expensive SSD.
More on Write Amplification
The write amplification phenomenon exists due to the requirement for flash cells to be empty before they can be written to. There is a further issue compounding the way in which this issue is handled within the SSD and that is down to the fundamental way in which an SSD works.
Data is split up on an SSD into various units, here we are considering SSD 'pages' and SSD 'blocks'. When data is written to an SSD it is written in pages, these pages are normally 2 or 4KB. When an erase cycle takes place however, it must take place on a block. This block will be made up of a number of pages, lets say 5 for the sake of this article.
When a small file, or a portion of a larger file is written to a page within a block, there may be other pages which are used by other data, there is no problem with the SSD storing data in this way, until one of the files occupying the same page is deleted. We have already discussed that in order for the SSD to be optimised, this deleted data must be cleared by TRIM, but we are presented with a further issue that can slow down the SSD even further. This issue is the fact that the SSD can only clear the contents of a used area a block at a time. Because of this a further overhead is added as the data which occupies that same block and has not been deleted needs to be cached by the SSD whilst it carries out the clearing of the block and then re-written again once the clearing has taken place.
For this reason write amplification may have a performance hit many times the advertised write speed of your SSD, in some cases this may be up to a 1000% increase. It is clear to see that this is a big problem if it is not effectively dealt with.
How does TRIM Work?
With a TRIM enabled SSD and computer some extra things go on when data is deleted, these things are not required for non-SSD drives.
Normally when a file is deleted, the record for that file within the file system is removed or marked as usable (or both, depending upon the particular file system/operating system combination). For a standard hard drive this results in the saving of time and overheads as there is no such problem as the above mentioned performance degradation in overwriting existing data.
On a TRIM enabled system an extra command is sent to the SSD drive, which otherwise would be unaware of what is going on at the file system level, when a file is deleted. This command tells the SSD which pages contain deleted data, allowing the SSD to clear these pages during its garbage collection cycles.
How does TRIM affect Data Recovery?
This is a simple question to answer. Once the data has been cleared using TRIM it is not recoverable. The data is zeroed out in a way that leaves no remaining trace of the previous content.
It is not possible to recover deleted data from a TRIM enabled SSD/operating system once the TRIM command has cleared the data. All of those file un-delete programs that have saved people from lost data from their traditional hard disk drive are no longer of any use once TRIM has come into play.
If the prevalence of the SSD is to continue, file recovery software may soon become a thing of the past or at least resigned to limited usage where the system has failed or become corrupted rather than the data having been deleted.
Christopher Sampson
TRC Data Recovery Ltd
United Kingdom
Recover data from an SSD drive
Article Source: http://EzineArticles.com/6936742

No comments:

Post a Comment