Speeding Up MDADM RAID Rebuilds

Speeding Up MDADM RAID Rebuilds

Speeding Up MDADM RAID Rebuilds I’m slowly migrating a bunch of awesome things from a really old server, it’s still running Ubuntu 10.04.. to a really nice and shiny one. Which has 2 new 3TB HDDs in RAID 1, which are syncing..


cat /proc/mdstat
md3 : active raid1 sda4[0] sdb4[1]
1847478528 blocks super 1.2 [2/2] [UU]
[>....................] resync = 0.1% (2061952/1847478528) finish=28857.9min speed=1065K/sec

That’s like 40 days of syncing.. surely we can do better than that? Can’t we speed up this MDADM RAID 1 rebuild?

Speeding Up MDADM RAID Rebuilds

Sure we can, we’re awesome, I’m awesome, you’re awesome, can I get a hell yeah? HELL YEAH!

Likes lots of things that are tuneable, we have to do NASTY things to /proc. This bit sets the minimum speed we want mdadm to go at.


cat /proc/sys/dev/raid/speed_limit_min
1000

We’re greedy though and in the words of Tim Tool Time Taylor, MORE POWER. As root..


echo 50000 > /proc/sys/dev/raid/speed_limit_min

We’ve just made mdadm run FIFTY TIMES faster. FOR FREE. We didn’t even swap out the SATA disks for SAS SSDs, we just changed a number ..


md3 : active raid1 sda4[0] sdb4[1]
1847478528 blocks super 1.2 [2/2] [UU]
[=====>...............] resync = 26.0% (480866560/1847478528) finish=141.9min speed=160501K/sec

Now 10 minutes later we’re already over 1/4 the way through, 2 hours left baby. Hell yeah.

  1. Unmounting any filesystems on the drive temporarily will also cause the resync to run at the speed_limit_max value, which defaults to 200M/s. If you don’t need immediate access to the files, this is the way to go IMO.

Leave a Reply

Your email address will not be published. Required fields are marked *