I created a script called "raid1ext4trim" (below) which is heavily based on Mark Lord's wiper.sh code.
It is a TRIM utility explicitly for live RAID1 mirrored drives with ext4 partition(s). I have tested it on a RAID1 setup I am using. ("--batch=512" is needed for Intel SSDs, BTW.)
I welcome any feedback. I have tried to be especially careful to make sure LBAs of the mirror and the constituent drives match, and are based on
the whole drive, before doing any actual TRIMs.
On Intel SSDs, the TRIM'ed blocks are zeroed by the device and thus RAID1 consistency tends to be maintained. Non-Intel SSDs may not zero blocks
after a TRIM, in which case a RAID1 verify will likely result in consistency corrections, theoretically resulting in the need for another TRIM.
Mark, if it is useful, feel free to include it in the hdparm package. Also, much thanks for wiper.sh and hdparm. It made writing this a breeze.
Attached: Version 1.1: Add automatic batch/max-ranges detection for Intel and OCZ Vertex2 SSDs.
Log in to post a comment.