this may sound like quite a trivial question, but could someone please confirm whether I need to unmount the hard drives before performing RAID
reconstruction using the mdadm tool? should i be booting into single user mode 1st? or should i boot up using a live cd, such as knoppix? which is the accepted or safest method? how would i accomplish this?
Here's the deal: I've been experimenting with Linux RAID
(md) and wanted to improve the availability of my server. So when everyone's asleep, I can replace the faulty drive with a new one.
I have /dev/sda and /dev/sdb mirrored (RAID1). Both sda and sdb have a "/" [md0] and "swap" [md1] partition. Also, both sda & sdb's MBR have GRUB installed. Now, when sdb gets unplugged (after powering off of course!), the system still boots into Linux
Reconnecting sdb and disconnecting sda reveals the same results - flawless booting!
All is good so far. Now, lets plug sda & sdb back and boot into Linux. Running "cat /proc/mdstat" and "mdadm --detail /dev/md0" reveals a degraded RAID
array (with sdb flagged as faulty/foreign). So using mdadm again, we can perform a "hot insert" of sdb. After a few moments, we can confirm (through /proc/mdstat and mdadm) that rebuilding was completed. OK, onto rebooting the system. First reboot after reconstruction seems flawless. So we shutdown the system again, and unplug sda again.
Bad news this time around. Powering on the system, we immediately notice GRUB's failed attempt to load the linux kernel, citing crc errors. And I thought this RAID1 mirror was perfect - even after reconstruction. So what went wrong? Here's GRUB's error message FYI:
Booting 'Debian GNU/Linux, kernel 2.6.8-2-386'
-- System halted
Am I correct in suspecting that mounted drives can't be mirrored (especially the boot blocks)? Is it possible that mounted drives have "locked" files or open "handles" which cannot be mirrored? Or am I way off the mark? Let me know. Looking forward to hearing your responses!!
edit: Whilst installing Debian 3.1 "Sarge", should you wait for RAID
to finish syncing during the partitioning phase (by going to console "Alt+F2" & running "cat /proc/mdstat"), or is it OK to go right ahead and format them and install base system files while syncing in the background?