I had a harddisk failure in one of my servers. The disk (/dev/sda
) is part of a Linux software RAID-1 with 2 partitions. The datacenter support replaced the failed disk, and now I'm trying to add it back into my software RAID.
Adding the partition for the swap volume worked fine:
root@server:~ # mdadm /dev/md0 -a /dev/sda1
mdadm: added /dev/sda1
But when I tried adding the partition for the root volume mdadm
complained about the size, even though I created the partition with the same size as the corresponding one:
root@server:~ # mdadm /dev/md1 -a /dev/sda2
mdadm: /dev/sda2 not large enough to join array
Looking at fdisk
output the new partition had less sectors than the one on the other disk:
root@server:~ # fdisk -l
...
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 4209029 4206982 2G fd Linux raid autodetect
/dev/sda2 4210688 312492031 308281344 147G fd Linux raid autodetect
...
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 4209029 4206982 2G fd Linux raid autodetect
/dev/sdb2 4209030 312576704 308367675 147G fd Linux raid autodetect
So I deleted the partition again and re-created it with slightly larger size:
root@server:~ # fdisk -l
...
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 4209029 4206982 2G fd Linux raid autodetect
/dev/sda2 4210688 314589183 310378496 148G fd Linux raid autodetect
...
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 4209029 4206982 2G fd Linux raid autodetect
/dev/sdb2 4209030 312576704 308367675 147G fd Linux raid autodetect
But mdadm
still complained that /dev/sda2
was not large enough to join the array.