Optimize Linux SW RAID rebuild speed

    • Optimize Linux SW RAID rebuild speed

      Change rebuild minimum speed:
      By default the rebuild minimum speed quite low by today's HD standard. Regular mechanical HD easily performs 50MB+ and SSD easily performs between 250-500MB. The default RAID rebuild minimum speed is 1MB and maximum is 200MB.

      While the maximum is fine but the minimum isn't. Let's increase that to 50MB. But keep in mind by raising the speed it might tax the overall system usage a little higher.
      sysctl -w dev.raid.speed_limit_min=50000

      If you want to hard set this put following in /etc/sysctl.conf file.

      Source Code

      1. dev.raid.speed_limit_min = 50000

      Set Bitmap:
      Bitmap optimizes rebuild time. Turn on during rebuild and turn it off after rebuild.

      Turn on:
      mdadm --grow --bitmap=internal /dev/md0

      Turn off:
      mdadm --grow --bitmap=none /dev/md0

      Disable NCQ:
      If you have five disk drives, run following to disable NCQ.

      Source Code

      1. for v in sd{a..e}; do
      2. echo 1 > /sys/block/$i/device/queue_depth
      3. done

      Set readahead to 512-byte sectors.

      blockdev --setra 65536 /dev/md0

      Stripe cache size:
      Only available on RAID-5 or RAID-6.

      This cache is used when synchronizing both read and write operations. Default is 256KB. Maximum is 32MB. If you have enough memory just set to max.

      echo 32768 > /sys/block/md0/md/stripe_cache_size
      I like cars and taking pictures! 8)