UPWORK/ODESK guru: Tips and Tricks for clients

skype: upwork.link , email: info@upwork.link

How to set the speed of MD RAID reconstruction

without comments

To see your Linux kernel speed limits:

root@rescue ~ # cat /proc/sys/dev/raid/speed_limit_max 
200000
root@rescue ~ # cat /proc/sys/dev/raid/speed_limit_min 
1000
root@rescue ~ # 

This means that the minimum guaranteed speed of the rebuild of the array is approx 1MB/s. The actual speed will be higher and will depend on the system load and what other processes are running at that time. In case you want to increase this minimum speed you need to enter a higher value in speed_limit_min. For example to set this to approx 50 megabytes per second as minimum use:

root@rescue ~ # echo 50000 > /proc/sys/dev/raid/speed_limit_min 
root@rescue ~ # 

Now you can return to the watch window to see it running, and hope that this will finish a little faster:

root@rescue ~ # watch mdadm --detail /dev/md1 
/dev/md1:
        Version : 1.2
  Creation Time : Wed Apr 25 16:52:28 2012
     Raid Level : raid1
     Array Size : 1073740664 (1024.00 GiB 1099.51 GB)
  Used Dev Size : 1073740664 (1024.00 GiB 1099.51 GB)
   Raid Devices : 2
  Total Devices : 2
    Persistence : Superblock is persistent

    Update Time : Sat Jun 15 22:11:26 2013
          State : clean, degraded, recovering
 Active Devices : 1
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 1

 Rebuild Status : 0% complete

           Name : rescue:2  (local to host rescue)
           UUID : e018a66f:5f11f802:a3e62e70:659ca7f7
         Events : 269785

    Number   Major   Minor   RaidDevice State
       3       8        3        0      spare rebuilding   /dev/sda3
       2       8       19        1      active sync   /dev/sdb3
root@rescue ~ # 

However, none of these settings will effect your raid sync speed if the system isnt already under high load. On an average system it will normally transfer as fast as possible and setting the minimum speed wont change things unless its under high load from other programs.

If you want to change the transfer speed in any meaningful sense you should use the commands ‘ionice’ and ‘renice’ to give higher IO and CPU priority to the rebuild. ionice will probably give you the best results if you give the raid processes realtime priority or at least higher priority.

root@rescue ~ # ps -eF|egrep md
root       352     2  0     0     0   7 Jun13 ?        00:00:00 [md]
root       465     2  0     0     0   4 Jun13 ?        00:00:00 [ksmd]
root      7740     2  0     0     0   3 20:36 ?        00:00:00 [md0_raid1]
root     11719     2  0     0     0   7 21:27 ?        00:00:00 [md1_raid1] <------------ this
root     11783     2  0     0     0   0 21:29 ?        00:00:00 [md1_resync] <------------ this
root     15320  7026  0  2589   864   0 22:13 pts/4    00:00:00 egrep md
root@rescue ~ # ionice -p 11783
none: prio 4
root@rescue ~ # 
root@rescue ~ # ionice -c 1 -p 11783
root@rescue ~ # ionice -p 11783
realtime: prio 4
root@rescue ~ # 
root@rescue ~ # renice -10 11783
11783: old priority 0, new priority -10
root@rescue ~ #
root@rescue ~ # renice -10 11719
11719: old priority 0, new priority -10
root@rescue ~ # 
 

Written by spectre

June 15th, 2013 at 10:06 pm

Posted in Arrays and Disks

Leave a Reply

*