Bob's Notes on MDADM RAID Stuff

If a RAID array comes up as /dev/md127 instead of /dev/md0, update the "Preferred Minor" that is seen with the following command:

  mdadm --detail /dev/md127
Now to fix it, you will need to assemble it with the following command:
  mdadm --stop /dev/md127
  mdadm --assemble --update=super-minor /dev/md0 /dev/sda1 /dev/sdb1

If an array will not assemble, you may need to specify the UUID. Example:

  mdadm --assemble --uuid 01234567:890abcde:01234567:890abcde /dev/md0
To find the UUID, use the examine command:
  mdadm --examine /dev/sda3 | grep UUID

To re-install GRUB from a rescue CD, try this:

  mount /dev/md0 /mnt/sysimage
  mount --bind /dev /mnt/sysimage/dev
  mount --bind /proc /mnt/sysimage/proc
  mount --bind /sys /mnt/sysimage/sys
  chroot /mnt/sysimage
  grub-install /dev/sda
An alternate manual Grub-install is this:
  grub  (to get the Grub> prompt, then do:)
    device (hd0) /dev/sda
    root (hd0,0)
    setup (hd0)

To resize a raid partition to something smaller, do this:

  mdadm /dev/md0 --fail /dev/sdb3 --remove /dev/sdb3  (this is to stop the mirroring)
  resize2fs /dev/md0 29999768K  (desired [30BG] size - 256k)
  mdadm --grow /dev/md0 -z 30000000K
  fsck.ext3 -f /dev/md0
Now go to fdisk, delete the partition, and re-add it with the new size. Reboot. Now add back in the other part of the raid.