Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

5 Answers

up vote 12 down vote accepted

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.

share|improve this answer
    
I do have backups, of course ! –  Julien Tartarin Jun 5 '09 at 14:10
    
:) You have to check. Most people tend to forget about them :) –  David Pashley Jun 5 '09 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 '09 at 15:00
add comment

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.

share|improve this answer
    
Upvoted, agreed completely. Performance WILL suck, due to rebuild. –  Greg Meehan Jun 5 '09 at 13:03
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.