I want to know if I have a RAID 5 system that had a failed drive, I replaced it with the wrong drive and it started to rebuild. I need to know if I can pull that drive while it is rebuilding and replace it with a new (and correct) drive and expect it to all rebuild as close to normal as possible?
Yes, it shouldn't be a problem, as long as you are replacing the drive that is currently rebuilding and not another drive. RAID 5 can only suffer one hard drive loss.
After you replace the drive, the rebuilding should restart. I usually swap drives while the system is shut down, just to be safe, but this isn't 100% necessary.
RAID controllers are smart enough to restart or resume rebuilding when they detect the status of the array. If a new drive is there, it will rebuild. If the server is restarted, it will resume on next boot.
It shouldn't be rebuilding at all - you essentially have two failed drives (The dead one, and the one you wrongly replaced) and that's more than raid 5 should be able to handle. Its a wierd situation. I wonder if you have hot spares, and the drive had been replaced quietly, which is the only way I see this working.
I'd suggest letting it rebuild first, and this is the advice we got from the vendor who sold us the disk array. Basically, since there's heavier load on the drives while you rebuild and other drives might fail. Letting it rebuild and replacing the drive means you minimise the load on the disk controllers and reduce the risk of something going on. Doubly so since if you replace the 'wrong' drive, you essentially have two drive failures right now.
Let it rebuild. Swap the 'dead' drive for the 'old' drive that you just pulled, preferably after wiping the old drive. Check your data
Backups would let me sleep better at night should something like this happen.
This is very much dependent on the controller (or software) and its behavior. In general, you can pull the failed drive and the replacement drive, insert a new one, and have it rebuild the array.
It does this by calculating parity from the healthy drives, then rebuilding the data on the last. E.g. if you have a 4-drive RAID 5, you have one failed drive, 3 healthy. If you have a 5th drive in that's replacing #4, you can pull 4 and 5.. as long as 3 of the original 4 stay healthy and online.
However, some controllers are quirky. They can have bugs and other issues that complicate it.
If this is a hardware RAID, I'd strongly recommend calling manufacturer support to confirm. They may have some special procedure they want done.