Hetzner Hardware-RAID设置

官方指导 https://wiki.hetzner.de/index.php/LSI_RAID_Controller/en

在Rescue模式下连接ssh

查看已有raid信息

megacli -LDInfo -Lall -Aall

示例 RAID 1:

Adapter 0 -- Virtual Drive Information:
Virtual Disk: 0 (Target Id: 0)
Name:
RAID Level: Primary-1, Secondary-0, RAID Level Qualifier-0
Size:697.560 GB
State: Optimal
Stripe Size: 64 KB
Number Of Drives:2
Span Depth:1
Default Cache Policy: WriteBack, ReadAhead, Cached, Write Cache OK if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, Cached, Write Cache OK if Bad BBU
Access Policy: Read/Write
Disk Cache Policy: Enabled
Encryption Type: None

Exit Code: 0x00

设置raid

查看 Enclosure Number 和 Slot Number

megacli -PDList -aAll | egrep "Enclosure Device ID:|Slot Number:|Inquiry Data:|Error Count:|state"

注意,如果status是”Unconfigured (bad)”,请使用以下命令(未验证)

megacli -PDMakeGood -PhysDrv[<Enclosure#>:<Slot#>] -a0

清除已有设置

删除所有逻辑分区

megacli -CfgClr -aAll

设置raid0

megacli -CfgLdAdd -r0 [<Enclosure#1>:<Slot#1>,<Enclosure#2>:<Slot#2>,...] WB RA Direct CachedBadBBU -a0

<Enclosure#1> 磁盘1的 Enclosure Number
<Slot#1> 磁盘1的 Slot Number

设置可启动阵列

查看可启动阵列,可启动阵列不存在

megacli -AdpBootDrive -get -a0

Adapter 0: No Virtual drive or Physical Drive is configured as boot drive.

Exit Code: 0x00

设置a0位为可启动阵列

megacli -AdpBootDrive -set -L0 -a0

Boot Virtual Drive is set to #0 (target id #0) on Adapter 0

Exit Code: 0x00

例1:300gSAS,两块3T盘

megacli -CfgLdAdd -r0 [252:2] WB RA Direct CachedBadBBU -a0
megacli -CfgLdAdd -r0 [252:0,252:1] WB RA Direct CachedBadBBU -a1

例2:3*3T

megacli -CfgLdAdd -r0 [252:0,252:1,252:2] WB RA Direct CachedBadBBU -sz60GB -a0
megacli -CfgLdAdd -r0 [252:0,252:1,252:2] WB RA Direct CachedBadBBU -sz140GB -a0
megacli -CfgLdAdd -r0 [252:0,252:1,252:2] WB RA Direct CachedBadBBU -sz800GB -a0
megacli -CfgLdAdd -r0 [252:0,252:1,252:2] WB RA Direct CachedBadBBU -sz1024GB -a0
megacli -CfgLdAdd -r0 [252:0,252:1,252:2] WB RA Direct CachedBadBBU -sz1024GB -a0
megacli -CfgLdAdd -r0 [252:0,252:1,252:2] WB RA Direct CachedBadBBU -sz1024GB -a0
megacli -CfgLdAdd -r0 [252:0,252:1,252:2] WB RA Direct CachedBadBBU -a0