Cannot load from raid with grub
- by Andrew Answer
I have a RAID1 array on my Ubuntu 12.04 LTS and my /sda HDD has been replaced several days ago. I use this commands to replace:
# go to superuser
sudo bash
# see RAID state
mdadm -Q -D /dev/md0
# State should be "clean, degraded"
# remove broken disk from RAID
mdadm /dev/md0 --fail /dev/sda1
mdadm /dev/md0 --remove /dev/sda1
# see partitions
fdisk -l
# shutdown computer
shutdown now
# physically replace old disk by new
# start system again
# see partitions
fdisk -l
# copy partitions from sdb to sda
sfdisk -d /dev/sdb | sfdisk /dev/sda
# recreate id for sda
sfdisk --change-id /dev/sda 1 fd
# add sda1 to RAID
mdadm /dev/md0 --add /dev/sda1
# see RAID state
mdadm -Q -D /dev/md0
# State should be "clean, degraded, recovering"
# to see status you can use
cat /proc/mdstat
After bebuilding completion "fdisk -l" says what I have not valid partition table /dev/md0. So
1) "update-grub" find only /sda and /sdb Linux, not /md0
2) "dpkg-reconfigure grub-pc" says "GRUB failed to install the following devices /dev/md0"
I cannot load my system except from /sdb1 and /sda1, but in DEGRADED mode...
This is my partial fdisk -l output:
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000667ca
Device Boot Start End Blocks Id System
/dev/sdb1 * 63 940910984 470455461 fd Linux raid autodetect
/dev/sdb2 940910985 976768064 17928540 5 Extended
/dev/sdb5 940911048 976768064 17928508+ 82 Linux swap / Solaris
Disk /dev/md0: 481.7 GB, 481746288640 bytes
2 heads, 4 sectors/track, 117613840 cylinders, total 940910720 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/md0 doesn't contain a valid partition table
Anybody can resolve this issue? I have big headache with this.