4

Do I need to stop or limit services (Apache, MySQL, ...) during software RAID 1 reconstruction on Linux ?
Is there a risk of corrupting or losing data ?

I am using Linux MD devices (with mdadm) on Debian 5.

Thanks

5 Answers 5

13

As has been commented, there is very little risk of any data corruption during a rebuild. You are obviously still at risk of losing another drive until it has completed. You should make sure your backups are up to date and working. You do have backups don't you?

The rebuild obviously is going to use IO, but running processes will have higher priority. This means that heavy IO bound processes are going to make your rebuild take longer.

Linux has a couple of tuning knobs to change how fast the process runs at:

/proc/sys/dev/raid/speed_limit_min
/proc/sys/dev/raid/speed_limit_max

On my machine they are set to 1000 and 200,000 respectively. The minimum is not all that reliable as I believe userspace IO still trumps it. Just echo new values in to those files to change them. You can see the current speed by checking /proc/mdstat. You can have a nice updating display using:

watch cat /proc/mdstat

Press ctrl-c to exit.

3
  • I do have backups, of course !
    – Julien
    Jun 5, 2009 at 14:10
  • :) You have to check. Most people tend to forget about them :) Jun 5, 2009 at 14:51
  • I've rebuilt several software raid 1 with no problems with the system "online" with no problems. However, if you can afford to take the system offline during the rebuild process it will speed things up and reduce the chances of anything happening.
    – David
    Jun 5, 2009 at 15:00
7

If you're rebuilding your RAID,

A) You should make backups first

B) Your performance will suck. You'd be better off to move any critical services to another host while this is happening, in which case yes, I'd turn off the various daemons.

1
  • Upvoted, agreed completely. Performance WILL suck, due to rebuild. Jun 5, 2009 at 13:03
3

Agreed with what the others have said. But just to pick on the last point of your question:

There's no risk of corrupting or losing data if you continue to use the drives during the re-sync period.

1

While it is not required that you stop services from running on the system you will find that performance will be degraded due to the disk IO caused by the rebuild process. If you watch the rebuild processes speed you will see that the process does free up resources to other processes so that the system continues to work.

If you want to speed the rebuild up then it would be advantageous to stop unnecessary processes and let the box just rebuild or if this is not possible to move some of the load off to another system.

0

Yes, resyncing seriously affects disk performance. Depending on the size of your RAID partition, you cold throttle down resync speed (as root):

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

for instance throttles resync at a rate of 10MB/sec. You can throttle it down as much as needed to leave I/O capacity for your services.

The disadvantage is that the more you throttle it down, the longer it takes until the RAID is redundant again. Thus more time for the remaining drive to fail as well and taking the entire array with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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