Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This may sound silly, but is there a way to intentionally reduce the speed of a rebuild in a Linux Software RAID? (Basically reducing the throughput of all of the disks so that it's not maxing out.)

The RAID itself is just a bunch of drives connected via external SATA to a Slackware 13.37 box running software RAID (everything controlled by mdadm). The drives aren't of the highest quality (it's a budget home system) and I'd just like the peace of mind that I'm not pushing them too much.

Maybe there's a way to pause and unpause the rebuild, which I can script to happen from time to time?

share|improve this question
    
Can you add up the reasons why you want this behavior, because as far I'm concerned, RAID builds once when you set-up and rebuilds when you add/replace a disk. –  Braiam Jul 30 '13 at 2:11
    
@Braiam: As mentioned in the question, it's mostly about peace of mind. The drives are consumer-grade Western Digital drives with firmware patches to remove the TLER problem with software RAID. There are occasional false failures. Sometimes the devices have the same number of RAID events and can just be re-assembled, sometimes they don't and the false failure needs to be re-built. I'd just like to re-build slowly to avoid another false failure while it's in progress. –  David Jul 30 '13 at 2:14
    
Worries not, I was just trying to determine how silly your reason was ;) –  Braiam Jul 30 '13 at 2:30
    
I'm facing a similar issue, as my Synology NAS is shutting down from time to time when there's heavy disk usage. Bad thing is that RAID resync does a lot of stress on the disk, so the NAS reboots, then runs the resync, then reboots... It never ends. So thanks a lot for the question, and the answer! –  Yvan Sep 4 at 11:42

1 Answer 1

up vote 4 down vote accepted

You can pause a rebuild with this:

echo "idle" > /sys/block/md0/md/sync_action

Assuming md0 is your md device. However, mdadm will commence rebuilding on an "event" which it isn't clear what that would be. I suspect a read or write to the array will kick off the rebuild again - so often this command does nothing obvious as the rebuild stops and then immediately restarts. If you have multiple md devices, then this will cause mdadm to rebuild the next one that needs it.

To throttle the rebuild, you can use:

echo 5000 > /proc/sys/dev/raid/speed_limit_max

This will limit the rebuild maximum throughput to 5Mb/s. You can see the current resync speed by doing

cat /proc/mdstat
share|improve this answer
    
I really like that speed_limit_max option. (Which I'm also now seeing confirmed in my local man page for md, which is awesome.) The first option would probably work for me since the file system on the array is un-mounted while the rebuild is in progress. But the speed_limit_max option seems more straightforward. –  David Jul 30 '13 at 2:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.