Understand SSD
- page 01: Flash memory
- page 02: MLC and SLC
- page 03: Sectors, pages, blocks...
- page 04: Wear-leveling
- page 05: TRIM
- page 06: Garbage collector
- page 07: Every day usage
- page 08: Conclusion
TRIM
As the same logical sector is not necessarily written on the same page, it is important for the controller to constantly have access to the most reliable information regarding the accuracy of stored data. Indeed, when deleting one file, the OS simply erase its ID in the file system description, but does not erase it physically, as it is not required on a disc-based HD (as one can write new data without requiring first erasing the sector). On a SSD, such a process might lead to unnecessary writing steps. Let's consider a block of 512 KB containing 256 KB belonging to a file, and 256 KB of erasable pages. If one deletes the file, then subsequently writes a 128 KB file on the same block, the controller will read the 256 KB corresponding to the erased file, then wipe the block, rewrite the erasable block, then the new 128 KB file. So, the controller will write 3 times more data than really required, it slows the process for the new file, and will lead to a block containing 128 KB of data.
The solution to this problem is the TRIM command. It will be included in the future evolution of the ATA protocol. When a file will be erased, the OS will send this command to the SSD to notify the list of logical sectors corresponding to the deleted file. The controller will then tag the corresponding pages as being erasable. So, if one considers the same example, the controller will consider the block as a 512 KB erasable unit, and not as a block containing 256 KB of data and 256 KB of erasable data. So, it will erase the entire block and directly write the new 128 KB file on it.
There is currently no SSD on the market natively and officially supporting the TRIM command. So far, the only OS to have implemented the command is Linux. It will be integrated in windows 7. Several SSD manufacturers already announced that they will release new models supporting the TRIM command, and will offer firmware update for current SSD models.
While we wait for these new OSes and devices, in the meantime all SSD models based on the Indilinx Barefoot controller (OCZ Vertex & Agility, G.skill Falcon, SuperTalent Ultradrive ME & LE...) implement a TRIM command by default. It currently only works on Windows XP, Vista and Windows 7 beta, via a utility to be launched from time to time to analyze the file system and send the TRIM command for all free sectors. This solution is of course less effective, as asynchronous, but also not really handy as it might not work when having a SSD-based RAID volume (the controller must support this command). From a more practical point of view, the TRIM command is rather effective, bringing performance levels to the original ones for SSDs. Future firmware updates should bring native support for the TRIM command.
If you are using a SSD and a TRIM-aware OS you will have to take particular care when backing up your data: in case of accidental erasing, the data will be definitely lost.
