007revad / Synology_HDD_db

Add your HDD, SSD and NVMe drives to your Synology's compatible drive database and a lot more
MIT License
2.72k stars 180 forks source link

Feature: Add ability to speed up RAID Resyncs and Reshaping #383

Open madereddy opened 2 weeks ago

madereddy commented 2 weeks ago

Providing the ability to speed up RAID Resyncs and Reshaping would be very helpful. This gist has alot of details on it.

  1. Add ability to capture the defaults for the following commands
    cat /sys/block/md2/md/stripe_cache_size
    cat /proc/sys/dev/raid/speed_limit_min
    cat /sys/block/md2/queue/read_ahead_kb
    cat /sys/block/md2/md/sync_max
  2. Set new max values to help speed up the RAID operation
    $ echo 32768 > /sys/block/md2/md/stripe_cache_size   # This is the max value, and it takes up 32Mib to synchronize read/write operations while the array is degraded
    $ echo 50000 > /proc/sys/dev/raid/speed_limit_min    # This is a hint that you want more focus on the sync-expansion task
    $ echo 32768 > /sys/block/md2/queue/read_ahead_kb    # This is how far ahead of a read request the drive array will preload
    $ echo max > /sys/block/md2/md/sync_max
  3. After RAID operation completes have a command to set the values back to the default captured in step 1.

Details on how much faster the RAID operation was by setting the different values in this gist comment.