# Determine RAID level of disk in RAID 10

## onkelfusspilz

Hi,

I have a RAID 10 with 4 disks. 

```
cat /proc/mdstat
```

 tells me that one of the disks are failed. I did a SMART check on the other disks and I have some warnings on one of them. Now I want to replace two disks.

If the two disks with error or warning state are in one stripe-set (RAID 0), I should be able to remove both of them, replace them and do a resync, right? If the disks are members of each mirrored stripe set, both of them would fail and so would the whole RAID 1.

Is there a chance to find out if I can remove these two disks at the same time?

The rebuild would be needed only once instead of two times, saving me a lot of time.

Kind regards

Andreas

----------

## frostschutz

So you want to do it in one go, right?

```
mdadm /dev/md1 --add /dev/newdisk1 /dev/newdisk2 --replace /dev/failingdisk1
```

----------

## onkelfusspilz

 *frostschutz wrote:*   

> So you want to do it in one go, right?
> 
> ```
> mdadm /dev/md1 --add /dev/newdisk1 /dev/newdisk2 --replace /dev/failingdisk1
> ```
> ...

 

Basically: Yes. But since I don't have additional free ports/bays for harddisks on this particular machine, I need to remove the drive(s), shut the machine down, replace them and add the new disks to the RAID10 array. I would prefer to replace the two disks in one step, but I need to make sure that I remain with a valid stripeset while removing the disks.

Would mdadm give me a warning when I try to remove a disk and this action would degrade the array?

----------

## NeddySeagoon

onkelfusspilz,

You could try running a repair before you do the replacement.

If the repair works, your raid will appear to be good again.  mdadm will read the raid set and copy data that fails to read on one part of the mirror from the other part of the mirror.

This normally causes the failed sector to be relocated.

You get into trouble if you have a failed sector in the same place on both parts of the mirror, or if sector relocation takes so long, the kernel decides that the drive has gone offline.

Then it gets kicked out of the array.

----------

## frostschutz

For a definite answer, please show mdadm --detail /dev/md?? and mdadm --examine /dev/sd?? for this RAID.

The huge advantage of --replace is that it kicks the to-be-replaced disk out only after the new disk is fully populated; until then the old disk may help serve data for the new disk. Thus --replace may succeed in cases where regular old fail/remove/add might not.

If you can't replace both at once due to lack of slots (USB3 might work) then I'd just --replace first and then add the new disk, never mind that you have to rebuild twice to do so. Rebuilding just takes time, failing to rebuild loses data.

You can grow a RAID10 array to RAID0 and it will kick out the redundancy disks for you, this is a fool proof way to not kick out an essential disk out of a RAID10 array, however you don't get to choose which disk to keep this way. You simply lose redundancy.

----------

