# Replace Megaraid Drive

[One set of hints at this URL](http://lucasbrasilino.com/posts/how-to-add-a-new-disk-as-hot-spare-with-megacli/)</br>
[Though I preferrend this one](https://www.thomas-krenn.com/en/wiki/Managing_an_MegaRAID_Controller)</br>
[Another Cheat Sheet](https://www.advancedclustering.com/act_kb/replacing-a-disk-with-megacli/)

on vm1.sea, a megaraid controller on a cisco ucs, i want to remove phys disk 9, [24:10], which is currently an array member but smart says is dying

```
-- ID  | Type | Drive Model              | Size     | Status          | Speed    | Temp | Slot ID  | LSI ID | Path
c0u0p9 | HDD  | 9XF0TKYHST9500620NS CC02 | 464.7 Gb | Online, Spun Up | 6.0Gb/s  | 32C  | [24:10]  | 17
```

and replace with phy disk phys disk 12, [24:13], a new drive, [installed as hot spare and spun up](https://wikitech.wikimedia.org/wiki/MegaCli)

```
-- ID  | Type | Drive Model              | Size     | Status            | Speed    | Temp | Slot ID  | LSI ID | Path
c0uXpY | HDD  | 9XF21BHBST9500620NS SN03 | 464.7 Gb | Hotspare, Spun Up | 6.0Gb/s  | 29C  | [24:13]  | 20     | N/A
```

i was not completely comfortable with removing [24:10] from the array and causing it to fail over to the hot spare on [24:13].   [reading](https://support.siliconmechanics.com/portal/en/kb/articles/replace-failed-drive-using-megacli)
i try

```
megacli -PDOffline -PhysDrv [24:10] -a0
```
and it will fall over to the hot spare magically?  then

```
megacli -PDMarkMissing -PhysDrv [24:10] -a0
```

and set for removal

```
megacli -PDPrpRmv -PhysDrv [24:10] -a0PDPrpRmv
```

remove the drive, insert the new one and mark as hot spare

```
megacli -PDHSP -PhysDrv [24:10] -a0PDPrpRmv
```

Blinky Blinky

```
megacli -PdLocate -start -PhysDrv [24:0] -a0
```

Add to array
```
megacli -PDOnline -PhysDrv [24:2] -a0
```

Make hot spare
```
megacli -PDMakeGood -PhysDrv [24:2] -a0
megacli -PDHSP -Set -PhysDrv [24:2] -a0
```

---

2023.04.30