Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#22 TRIM on RAID1 full-disk arrays with live ext4 filesystems

open
nobody
None
5
2014-08-22
2010-05-25
Chris Caputo
No

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.

Discussion

  • Chris Caputo
    Chris Caputo
    2010-05-25

    TRIM on RAID1 full-disk arrays with live ext4 filesystems

     
    Attachments
  • Chris Caputo
    Chris Caputo
    2010-05-25

    Also for 1.1, "--batch=512" command line option is revised in favor of roadrunner2's "--max-ranges" option.

     
  • Chris Caputo
    Chris Caputo
    2010-06-01

    Version 1.2 contains a bugfix relating to failing to double quote contents of an echo command.

     
  • Chris Caputo
    Chris Caputo
    2010-06-01

    TRIM on RAID1 full-disk arrays with live ext4 filesystems

     
    Attachments
  • Chris Caputo
    Chris Caputo
    2010-07-22

    TRIM on RAID1 full-disk arrays with live ext4 filesystems

     
    Attachments
  • Chris Caputo
    Chris Caputo
    2010-07-22

    Version 1.3 fixes problem in which tempfile was not removed on some failure scenarios.

     
  • Chris Caputo
    Chris Caputo
    2010-10-28

    TRIM on RAID1 full-disk arrays with live ext4 filesystems

     
    Attachments
  • Chris Caputo
    Chris Caputo
    2010-10-28

    Version 1.4: Add SIGPIPE trap and display temp filename.

     
  • Chris Caputo
    Chris Caputo
    2012-07-05

    TRIM on RAID1 full-disk arrays with live ext4 filesystems

     
    Attachments
  • Chris Caputo
    Chris Caputo
    2012-07-05

    Version 1.5: isdigit() bugfix and parameter parsing fix.