Frank, Thank you for the in-depth explanation. I need to do some study before commenting further other than to say so far I'm finding different comments depending on whether it's an SSD or an M.2 drive. Much appreciated, Mark On Sun, Apr 16, 2023 at 11:08 AM Frank Steinmetzger wrote: > Am Sun, Apr 16, 2023 at 08:08:59AM -0700 schrieb Mark Knecht: > > > If you have an SSD or nvme drive installed then fstrim should be > > installed and run on a regular basis. However it's not 'required'. > > > > Your system will still work, but after all blocks on the drive have > > been used for file storage and later deleted, if they are not > > written back to zeros then the next time you go to use that > > block the write will be slower as the write must first write > > zeros and then your data. > > > > fstrim does the write to zeros so that during normal operation > > you don't wait. > > That is not quite correct. Trimming is about the oppisite of what you say, > namely to *not* rewrite areas. Flash memory can only be written to in > relatively large blocks. So if your file system wants to write 4 KiB, the > drive needs to read all the many kB around it (several hundreds at least, > perhaps eben MiBs, I’m not certain), change the small part in question and > write the whole block back. This is called write amplification. This also > occurs on hard drives, for example when you run a database which uses 4 > kiB > datafile chunks, but on a file system with larger sectors. Then the file > system is the cause for write amplification. > > If the SSD knew beforehand that the area is unused, it does not need to > read > it all in and then write it back. The SSD controller has no knowledge of > file systems. And this is where trim comes in: it does know file systems, > detects the unused areas and translates that info for the drive > controller. > Also, only trimmed areas (i.e. areas the controller knows are unused) can > be > used for wear leveling. > > I even think that If you read from a trimmed area, the controller does not > actually read the flash device, but simply returns zeroes. This is > basically > what a quick erase does; it trims the entire drive, which takes only a few > seconds, and then all the data has become inaccessible (unless you address > the memory chips directly). It is similar to deleting a file: you erase > its > entry in the directory, but not the actual payload bytes. > > AFAIK, SMR HDDs also support trim these days, so they don’t need to do > their > SMR reshuffling. I have a WD Passport Ultra external 2.5″ HDD with 5 TB, > and > it supports trim. However, a WD Elements 2.5″ 4 TB does not. Perhaps > because > it is a cheaper series. Every laptop HDD of 2 (or even 1) TB is SMR. > > -- > Grüße | Greetings | Salut | Qapla’ > Please do not share anything from, with or about me on any social network. > > “It is hard to be a conquering hero when it is not in your nature.” > – Captain Hans Geering, ’Allo ’Allo >