Sunday, October 30, 2005

Fix the RAID

Yesterday, I found that one of my harddisk in my Old PC has bad sectors. I decided not to replace the bad harddisk but to relocate the root partition to other free spaces in the harddisk. Originally, the RAID of root filesystem contains the hda8 and hdc8 partitions. The bad sectors were found in hda8. I try to search whether there exists unused partition on hda. I find hda7 is not used and the size matches the hdc8. To add hda7 to the RAID:
raidhotadd /dev/md0 /dev/hda7
From "/proc/mdstat", it shows hda7 is adding to md0. Wait for a while, mirroring of data from hdc8 to hda7 finished. I restart the PC.

After startup, it fails. The OS still try to use hda8 as the RAID. After some inspection, it is due to the configuration problem. First, it needs to correct the "/etc/mdadm/mdadm.conf" file. Second, it needs to regenerate the initrd image using the "mkinitrd" command. Lastly, it needs to correct the GURB config. Then, I restart te PC and this round, it works!

No comments: