said by trparky:
I thought that TRIM was supposed to be done even if Windows does it itself.
No no no. Absolutely not!
said by trparky:
I know that Windows performs a TRIM when you delete files but what about when you overwrite a file?
Microsoft hasn't exactly been very forthcoming with their policy on the TRIM command that's built into the OS. When does a TRIM happen?
The answer lies within truly understanding what TRIM does. The entire point of the TRIM command (more specifically DATA SET MANAGEMENT; that's what it's called per ATA spec) is to allow an OS or host controller to tell the underlying SSD "these LBA ranges are no longer used". Meaning: the entries in the FTL map can be released, and the SSD internally knows anything from LBA x to LBA y is no longer cared about.
Obviously this is used during file deletions; the OS deletes the file from the underlying filesystem ("I no longer care about this file"), and issues the appropriate TRIM command to the controller saying "LBA x through y are no longer used" (and possibly in repeated chunks, since that ATA CDB only supports up to 65536 worth of LBAs). This command can take some time to run (depends on a lot of things I'd rather not get into), and it's atomic.
File overwrites are done similarly -- you need to think about the two conditions that correlate with a file overwrite.
Say you have a file that is 12345 bytes on an NTFS filesystem that uses a 4096-byte cluster (or unit) size. This file takes up 4 clusters/units (4*4096 = 16384). You edit this file, and the new size is 19590 bytes (i.e. is larger). In this case TRIM is not used because there's no removal of data. The file now takes up 5 clusters/units (5*4096 = 20480), despite only 19590 being used.
Understand so far? Okay.
Now alternately let's say you edit the file (in its original state), and the new file size is 7810 bytes. The underlying filesystem shortens the number of clusters/units associated with this file -- it now only requires 2 clusters/units (2*4096 = 8192). The original 2 are no longer used by anything. TRIM is issued on the LBA range that makes up those 2 no-longer-used clusters/units.
TRIM does not operate on byte ranges, it operates on LBA ranges, and the filesystem knows which LBA ranges aren't in use based on file deletions or resizing or whatever else.
So like I said: understanding what TRIM does actually answers the question.
If you have concerns or questions over how your operating system (Windows) behaves, you should ask Microsoft. The best I can find is a Windows 8 API document that briefly describes the behaviour (see last paragraph of "What is TRIM?") except it doesn't mention file truncation (documentation author or engineer who wrote that did not think about the bigger picture): »msdn.microsoft.com/en-us/library ··· %29.aspx--
Making life hard for others since 1977.
I speak for myself and not my employer/affiliates of my employer.