9394952

导航

PVE9上安装MegaCli管理RAID阵列卡

参考:

YYNIO/Megacli64

下载:megacli_8.07.10-2_all.deb
安装:dpkg -i megacli_8.07.10-2_all.deb
安装依赖包:apt install libncurses5

### 上面这步可以不做直接用新版本的       libncurses

ln -s /usr/lib/x86_64-linux-gnu/libncurses.so.6 /usr/lib/x86_64-linux-gnu/libncurses.so.5
ln -s /usr/lib/x86_64-linux-gnu/libtinfo.so.6 /usr/lib/x86_64-linux-gnu/libtinfo.so.5


使用:/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL -NoLog 列出当前所有阵列信息

 

在我的情况想强制打开M5110e的JBOD模式失败

/opt/MegaRAID/MegaCli/MegaCli64 -AdpSetProp EnableJBOD 1 -a0 -NoLog

Adapter 0: Failed to Set Adapter Properties.

Exit Code: 0x01

失败了,只能使用旧办法RAID0了

# 1. 既然不能 JBOD,就直接把 Slot 5 做成单盘 RAID 0

~# /opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r0 [252:5] -a0 -NoLog

Adapter 0: Created VD 2

Adapter 0: Configured the Adapter!!

Exit Code: 0x00

0x00创建成功,然后

# /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -a0 -NoLog | grep -E "Virtual Drive|Target Id"
Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Virtual Drive: 1 (Target Id: 1)
Virtual Drive: 2 (Target Id: 2)
Virtual Drive: 3 (Target Id: 3)
Virtual Drive: 5 (Target Id: 5)

看到了!你的输出里出现了一个很有意思的断层:
0, 1, 2, 3 后面直接跳到了 5。

这说明你刚刚创建的单盘 RAID 0 对应的就是 Virtual Drive: 5 (Target Id: 5)。

既然拿到了准确的编号 -L5

~# /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp WB -L5 -a0 -NoLog

Set Write Policy to WriteBack on Adapter 0, VD 5 (target id: 5) success

Exit Code: 0x00

返加0x00,说明修改 WriteBack 成功

# /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp RA -L5 -a0 -NoLog

Set Read Policy to ReadAhead on Adapter 0, VD 5 (target id: 5) success

Exit Code: 0x00

修改 ReadAhead 成功

~# /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp Cached -L5 -a0 -NoLog

Set Cache Policy to Cached on Adapter 0, VD 5 (target id: 5) success

Exit Code: 0x00

修改 允许 Cached 成功

 

# 2. 强行刷新 PVE 的 SCSI 存储总线
rescan-scsi-bus.sh

echo "- - -"> /sys/class/scsi_host/host0/scan

# 3. 检查盘是否出来
lsblk

 

### 由于是做了raid0代替JBOS,所以当有磁盘坏并更换新盘的时侯,无法由raid卡进行修复,而且raid卡仍有缓存cache,所以也不能直接创建新VD

# /opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r0 [252:4] -a0 -NoLog

 Adapter 0: Configure Adapter Failed

 FW error description:
   The current operation is not allowed because the controller has data in cache for offline or missing virtual disks.

  Exit Code: 0x54

# /opt/MegaRAID/MegaCli/MegaCli64 -GetPreservedCacheList -aALL -NoLog

Adapter #0

Virtual Drive(Target ID 02): Missing.

Exit Code: 0x00

 

# 1. 先清理RAID卡的CACHE

# /opt/MegaRAID/MegaCli/MegaCli64 -DiscardPreservedCache -L2 -a0 -NoLog

Adapter #0

Virtual Drive(Target ID 02): Preserved Cache Data Cleared.

Exit Code: 0x00

# 2. 重新创建RAID0会成功

~# /opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r0 [252:4] -a0 -NoLog

Adapter 0: Created VD 2

Adapter 0: Configured the Adapter!!

Exit Code: 0x00

 

posted on 2026-06-24 11:04  9394952  阅读(7)  评论(0)    收藏  举报