HowTo: Speed Up Linux Software Raid Building And Re-syncing

Sometimes when assembling a raid array, you may find that it is going to take hours, even worse, days to complete.  Luckily there are ways to increase the assemble time with some useful commands which should decrease the time considerably.

To increase the rebuild speed, enter:

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


sysctl -w

In this example, set it to 60000 K/Sec, enter:

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


sysctl -w

If you want to override the default settings you could add these two lines to /etc/sysctl.conf: = 60000 = 200000

Bitmap Option

Bitmaps optimize rebuild time after a crash, or after removing and re-adding a device.

Turn it on by typing the following command:

mdadm –grow –bitmap=internal /dev/md0

Once array rebuild or fully synced, disable bitmaps:

mdadm –grow –bitmap=none /dev/md0

The net result

The rebuild rate jumps from 4k to 61k:

cat /proc/mdstat

Sample outputs:

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
md5 : active raid1 sde2[2](S) sdd2[3](S) sdc2[4](S) sdb2[1] sda2[0]
      530048 blocks [2/2] [UU]
md0 : active raid6 sde3[4] sdd3[3] sdc3[2] sdb3[1] sda3[0]
      5855836800 blocks level 6, 64k chunk, algorithm 2 [5/5] [UUUUU]
      [============>........]  resync = 61.7% (1205475036/1951945600) finish=242.9min speed=61204K/sec

HowTo: resolve the ‘/bin/rm: Argument list too long’ error

You may of come across this error like us when running the command rm -rf *, fortunately there is a workaround that should help:-

find . -name ‘test-*’ | xargs rm

In the above example the command will forcefully delete all of the files in the current directory that begin with test-. You can replace the parameter test-* with anything you like. You can also use * if you want to simply remove all the files

find . -name ‘*’ | xargs rm

Hopefully by running these commands will help you remove the files you want without getting stuck with the error.