I’m setting up software raid on a running server and it is taking forever for the initial sync of the raid drives on the 1TB hard disks. It has been running for about 6 hours and says that it will take about 5 days (7400 minutes) as this pace:
[root@host ~]# cat /proc/mdstat md1 : active raid1 sdb3[1] sda3[2] 974559040 blocks [2/1] [_U] [>....................] recovery = 3.9% (38109184/974559040) finish=7399.1min speed=2108K/sec
I did some read and write tests directly to the drives using dd to make sure that they were working okay, and they can operate at about 100 MB/s
[root@host ~]# dd if=/dev/zero of=/dev/sda2 bs=1024 count=1024000 1048576000 bytes (1.0 GB) copied, 10.8882 seconds, 96.3 MB/s [root@host ~]# dd if=/dev/zero of=/dev/sdb2 bs=1024 count=1024000 1048576000 bytes (1.0 GB) copied, 11.1162 seconds, 94.3 MB/s [root@host ~]# dd if=/dev/sda2 of=/dev/null bs=1024 count=1024000 1048576000 bytes (1.0 GB) copied, 10.2829 seconds, 102 MB/s [root@host ~]# dd if=/dev/sdb2 of=/dev/null bs=1024 count=1024000 1048576000 bytes (1.0 GB) copied, 10.5109 seconds, 99.8 MB/s
What I failed to realize is that there is a configurable limit for the min and max speed of the rebuild. Those parameters are configured in /proc/sys/dev/raid/speed_limit_min and /proc/sys/dev/raid/speed_limit_max. They default to a pretty slow 1MB/s minimum which was causing it to take forever.
Increasing the maximum limit didn’t automatically make it faster either. I had to increase the minimum limit to get it to jump up to a respectable speed.
[root@host ~]# echo 100000 > /proc/sys/dev/raid/speed_limit_min
[root@host ~]# watch cat /proc/mdstat Every 2.0s: cat /proc/mdstat md1 : active raid1 sdb3[1] sda3[2] 974559040 blocks [2/1] [_U] [=>...................] recovery = 7.7% (75695808/974559040) finish=170.5min speed=87854K/sec
Now it is up around 87 MB/s and will take just a few hours to complete the rest of the drive.
Thanks a lot for this! Really helped me out. I didn’t want to wait another 4 days for my raid1 to recover.
Thanks for this.This can be a big help to me. You truly saved my day. I can’t wait to try this.