LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   RAID 1 disk is maked as Spare after replacement (https://www.linuxquestions.org/questions/linux-server-73/raid-1-disk-is-maked-as-spare-after-replacement-909773/)

aasami 10-24-2011 05:28 AM

RAID 1 disk is maked as Spare after replacement
 
Hi, one of two disks in my RAID 1 died so I replaced it.
When new disk has been added to array the sync process started and few minutes later it has become a Spare.
How can I "force" the disk to be a regular part of an array?

Code:

# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
      401472 blocks [2/2] [UU]
     
md1 : active raid1 sdb2[2](S) sda2[0]
      487982336 blocks [2/1] [U_]
     
unused devices: <none>

As you can see partition sdb1 is regular part of array md0.
But sdb2 is marked as Spare and won't get added to md1.

The old disk was 500GB with 512B sectors and the new one is 1TB with 4KiB sector size. Can this be the root of the problem?

Old disk had the same geometry as sda. The new disk is sdb.
Code:

# fdisk -l /dev/sda

Disk /dev/sda: 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: 0x000dda75

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          63      803249      401593+  fd  Linux raid autodetect
/dev/sda2          803250  976768064  487982407+  fd  Linux raid autodetect

Code:

# fdisk -l /dev/sdb

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1  *        2048      809343      403648  fd  Linux raid autodetect
/dev/sdb2          809344  976774159  487982408  fd  Linux raid autodetect

I have made sdb2 one block larger then sda2 (487982408 vs. 487982407+)
So I assume all should be good.

It's Fedora 2.6.35.14-97.fc14.x86_64
I'll welcome any advice.

Thanks, Aas.

macemoneta 10-24-2011 07:43 AM

Did you follow the correct procedure?

aasami 10-24-2011 10:19 AM

md0 is synced unlike md1 what does it mean?
 
Yes, that's what I've done. Except I haven't done sfdisk because the drives are not identical. So I partitioned the drive manualy to align partitions with physical sectors.

But I've noticed one interresting thing: "Note that in Linux Software RAID you can create RAID Arrays by mirroring partitions and not entire disks."

This is imortatnt, because md0 is synced OK. So this has nothing to do with 4k sectors I assumed previously.

Thank you for the link.

Are there any other ideas that might help?

I have tried to mark sdb2 as failed and readd it, but nothing changed.

aasami 10-26-2011 09:51 AM

Lost in the dark.
 
I haven't found any clues that might suggest why this partition become a "spare".
Please any advice where may I look? There are precious customer's data in the RAID.

Any advice is welcome here.

Thaks. Aas.

macemoneta 10-26-2011 11:00 AM

The procedure has always worked, both for me and others, as far as I'm aware. Are you sure you didn't skip any steps?

aasami 11-02-2011 02:23 AM

Except sfdisk, no. As I've said before, I had to manually partition the new drive because of it's 4KiB sector size, to align partitions to physical sectors.

Maybe it is because of the new 4KiB sector size disk, but I just can't figure out why this could be a problem or how to get it working. This is not my first disk replacement and it worked well every other time. So I assume the cause is the new disk's geometry.

lqman 11-02-2011 02:54 AM

Quote:

So I assume the cause is the new disk's geometry.
I agree with U.
U must create the partition scheme identically to make RAID type1 works corectly.

Try not to skip the sfdisk step.

aasami 12-29-2011 03:48 AM

Solved
 
I finaly found the root cause of the sync problem.
It was because the other disk had some bad blocks so the sync process failed at some point.
I created new md2 device and added it to vg00 as a new PV.
Then pvmove all data off the bad md1 array, destroyed it, rebuilt initrd,
removed the second disk and booted up off the new one.
Thank you for the support.
I hope this helps someone.


All times are GMT -5. The time now is 10:31 AM.