Trim on SMR HDDs works similarly but also very differently than for SSDs.
On both technologies the disk is divided into large areas which are written at once, and in both cases the TRIM helps the firmware to make more efficient writes - but once you get into the details they work very differently indeed.
SSDs have cells containing many sectors and can read and write each sector individually, however you can only write to an erased sectors - when you want to overwrite a used sector, then you need to:
- read the contents of the existing cell;
- change the sector you want to overwrite;
- write the contents of to a completely erased cell;
- send the original cell to a background queue to be erased for reuse
This need to read an entire cell just to write one sector is called "write amplification". And there is a mapping that allows cells to be mapped to LBA ranges to make this work.
When you delete files, the TRIM command tells the SSD firmware that the relevant sectors are no longer in use, and the firmware can then:
- check if cells have all sectors TRIMmed and if so send the cell for erasure;
- for partially empty cells, decide whether it is worth copying the non-TRIMmed cells to an empty cell ready for the TRIMmed sectors to be written to at a later time.
SMR HDDs are different in that you can read sectors individually, but you can only write the entire cell. So, to write a single sector, if a cell is used then you need to read the entire cell, change the sector and write the entire cell back again similar to SSDs, but if the disk knows that the cell is completely empty it can simply write to it without reading the existing contents which is twice as fast. SMR drives have a CMR cache where writes are written first, and then in the background it destages these writes to the main SMR area. (And if you are doing bulk writes of random blocks, you can fill up the cache far faster than it can be destaged in the background, and then everything slows down by a factor of (say) 100.)
Having now thought about this, IMO I consider it likely that this means that for SMR HDDs:
TRIM is only effective when you have large contiguous empty areas of disk - this happens only when the disk is relatively new or when you have created such areas by running defrag. If you don't do defrag, it becomes increasingly likely that every cell has at least one sector used, and then bulk write performance becomes universally poor - but if you do defrag to create large areas of contiguous free space, then bulk performance will be better.
Whilst TRIM and automated regular defrag is supported as standard on Windows and windows file systems and has a GUI, other operating systems may not turn trim on automatically for SMR drives or may not defrag automatically.
I am unclear whether defrag programs have been enhanced to issue trim commands during defrag (which would be important for defrag speeds) or at the end of defrag (for future write speeds) or whether the operating system will handle one or both of these as sectors are marked unused by defrag.
Some file systems simply do NOT have a defrag capability (e.g. ZFS) - so over time it is likely that bulk writes with ZFS on SMR drives will slow to a crawl.
The performance of SMR drives during resilvering of redundant RAID1/5/6 or ZFS mirrors or RAIDZ will very much depend on whether the resilvering code TRIMS the entire drive before starting to write and whether the writes are then done sequentially across the drive or randomly - with ZFS RAIDZ the writes are done randomly and thus the time for resilvering can be exponentially larger.