Do I need to stop services (Apache, MySQL) during software RAID 1 reconstruction on Linux?

Solution 1:

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.

Solution 2:

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.

Solution 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.