Linux Software RAID 1

I was in the situation where the primary disk (hda) had dropped out of the RAID arrays it was in due to seek errors so needed to replace the primary disk.

URLs:

  • http://www.royong.com/showthread.php?t=16
  • http://www.linuxselfhelp.com/gnu/grub/html_chapter/grub_3.html
  • http://www.linuxquestions.org/linux/answers/Applications_GUI_Multimedia/Set_up_Grub_by_hand

Needed to install the boot loader onto the secondary disk as no doubt it hadn’t been setup.

Tried the grub-install command:

grub-install /dev/hdc

Thinking that this would do everything required I rebooted and took the primary disk out. The machie started booting up and then it kept printing to the screen “grub grub grub……”. Obviously not right so put the primary disk back in and rebooted.

This time ran the following:

grub
grub>find /grub/stage1
grub>device (hd0) /dev/hdc
grub>root (hd0,0)
grub>setup (hd0)
grub>quit

Then I rebooted and removed the primary disk… this time it booted up fine so I added the new disk.

Partition the new disk:

 fdisk -l /dev/hdc

And create the same partitions on the new machine.

sfdisk -d /dev/hdc | sfdisk /dev/hda

Or manually using fdisk.

Re-add the disks using mdadm…

mdadm /dev/md0 -a /dev/hda1
etc…

Leave a Reply

Your email address will not be published. Required fields are marked *