megacli组建raid

由于需要将磁盘划分为两个raid,一是raid 1用于安装操作系统,另一个是raid 5用于存放大量数据,由于Dell powerEdge R730xd,不支持开机界面组建多raid,只能进入系统使用megacli来操作

查看已有raid 信息,目前是针对操作系统做了一个raid 1


  • [root@ns-xxx ~]# megacli -LDInfo -Lall -aALL

Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name :
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
Size : 5.457 TB
Is VD emulated : Yes
Mirror Data : 5.457 TB
State : Optimal
Strip Size : 64 KB
Number Of Drives : 2
Span Depth : 1
Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy : Disk's Default
Encryption Type : None
Default Power Savings Policy: Controller Defined
Current Power Savings Policy: None
Can spin up in 1 minute: Yes
LD has drives that support T10 power conditions: Yes
LD's IO profile supports MAX power savings with cached writes: No
Bad Blocks Exist: No
PI type: No PI

Is VD Cached: No

查看磁盘信息

  • [root@ns-xxx ~]# megacli -PDList -aALL |egrep 'Adapter|Enclosure|Slot|Firmware state'
    Adapter #0
    Enclosure Device ID: 32
    Slot Number: 0
    Enclosure position: 1
    Firmware state: Online, Spun Up
    Enclosure Device ID: 32
    Slot Number: 1
    Enclosure position: 1
    Firmware state: Online, Spun Up
    Enclosure Device ID: 32
    Slot Number: 2
    Enclosure position: 1
    Firmware state: JBOD
    Enclosure Device ID: 32
    Slot Number: 3
    Enclosure position: 1
    Firmware state: JBOD
    Enclosure Device ID: 32
    Slot Number: 4
    Enclosure position: 1
    Firmware state: JBOD
    Enclosure Device ID: 32
    Slot Number: 5
    Enclosure position: 1
    Firmware state: JBOD
    Enclosure Device ID: 32
    Slot Number: 6
    Enclosure position: 1
    Firmware state: JBOD
    Enclosure Device ID: 32
    Slot Number: 7
    Enclosure position: 1
    Firmware state: JBOD
    Enclosure Device ID: 32
    Slot Number: 8
    Enclosure position: 1
    Firmware state: JBOD
    Enclosure Device ID: 32
    Slot Number: 9
    Enclosure position: 1
    Firmware state: JBOD
    Enclosure Device ID: 32
    Slot Number: 10
    Enclosure position: 1
    Firmware state: JBOD
    Enclosure Device ID: 32
    Slot Number: 11
    Enclosure position: 1
    Firmware state: JBOD
    Enclosure Device ID: 32
    Slot Number: 12
    Enclosure position: 1
    Firmware state: JBOD
    Enclosure Device ID: 32
    Slot Number: 13
    Enclosure position: 1
    Firmware state: JBOD

根据Enclosure Device ID及Slot Number组成数据,r5为raid 5 ,a0为Adapter number

  • [root@ns-xxx~]# megacli -CfgLdAdd -r5 [32:2,32:3,32:4,32:5,32:6,32:7,32:8,32:9,32:10,32:11,32:12,32:13] -a0

组建raid时抛出异常

  • [root@ns-xxx ~]# megacli -CfgLdAdd -r5 [32:2,32:3,32:4,32:5,32:6,32:7,32:8,32:9,32:10,32:11,32:12,32:13] -a0
  • The specified physical disk does not have the appropriate attributes to complete
  • the requested command.
  • Exit Code: 0x26
    将其设置为good后再执行即可
  • [root@ns-xxx ~]# megacli -PDMakeGood -Physdrv [32:2,32:3,32:4,32:5,32:6,32:7,32:8,32:9,32:10,32:11,32:12,32:13] -force -a0
  • Adapter: 0: EnclId-32 SlotId-2 state changed to Unconfigured-Good.
  • Adapter: 0: EnclId-32 SlotId-3 state changed to Unconfigured-Good.
  • Adapter: 0: EnclId-32 SlotId-4 state changed to Unconfigured-Good.
  • Adapter: 0: EnclId-32 SlotId-5 state changed to Unconfigured-Good.
  • Adapter: 0: EnclId-32 SlotId-6 state changed to Unconfigured-Good.
  • Adapter: 0: EnclId-32 SlotId-7 state changed to Unconfigured-Good.
  • Adapter: 0: EnclId-32 SlotId-8 state changed to Unconfigured-Good.
  • Adapter: 0: EnclId-32 SlotId-9 state changed to Unconfigured-Good.
  • Adapter: 0: EnclId-32 SlotId-10 state changed to Unconfigured-Good.
  • Adapter: 0: EnclId-32 SlotId-11 state changed to Unconfigured-Good.
  • Adapter: 0: EnclId-32 SlotId-12 state changed to Unconfigured-Good.
  • Adapter: 0: EnclId-32 SlotId-13 state changed to Unconfigured-Good.
  • [root@ns-ceph-208205 ~]# megacli -CfgLdAdd -r5 [32:2,32:3,32:4,32:5,32:6,32:7,32:8,32:9,32:10,32:11] -a0
  • Adapter 0: Created VD 1
  • Adapter 0: Configured the Adapter!!
  • Exit Code: 0x00

查看组建后raid 5的raid卡状态

[root@ns-ceph-208205 ~]# megacli -ShowSummary -aALL

System
Operating System: Linux version 3.10.0-514.6.2.el7.x86_64
Driver Version: 06.811.02.00-rh1
CLI Version: 8.04.07

Hardware
Controller
ProductName : PERC H730 Mini(Bus 0, Dev 0)
SAS Address : 51866da07969d800
FW Package Version: 25.4.1.0004
Status : Optimal
BBU
BBU Type : BBU
Status : Healthy
Enclosure
Product Id : BP13G+EXP
Type : SES
Status : OK

PD
Connector : 00<Internal><Encl Pos 1 >: Slot 0
Vendor Id : ATA
Product Id : TOSHIBA MG04ACA6
State : Online
Disk Type : SATA,Hard Disk Device
Capacity : 5.457 TB
Power State : Active

Connector : 00<Internal><Encl Pos 1 >: Slot 1
Vendor Id : ATA
Product Id : TOSHIBA MG04ACA6
State : Online
Disk Type : SATA,Hard Disk Device
Capacity : 5.457 TB
Power State : Active

Connector : 00<Internal><Encl Pos 1 >: Slot 2
Vendor Id : ATA
Product Id : TOSHIBA MG04ACA6
State : Online
Disk Type : SATA,Hard Disk Device
Capacity : 5.457 TB
Power State : Active

Connector : 00<Internal><Encl Pos 1 >: Slot 3
Vendor Id : ATA
Product Id : TOSHIBA MG04ACA6
State : Online
Disk Type : SATA,Hard Disk Device
Capacity : 5.457 TB
Power State : Active

Connector : 00<Internal><Encl Pos 1 >: Slot 4
Vendor Id : ATA
Product Id : TOSHIBA MG04ACA6
State : Online
Disk Type : SATA,Hard Disk Device
Capacity : 5.457 TB
Power State : Active

Connector : 00<Internal><Encl Pos 1 >: Slot 5
Vendor Id : ATA
Product Id : TOSHIBA MG04ACA6
State : Online
Disk Type : SATA,Hard Disk Device
Capacity : 5.457 TB
Power State : Active

Connector : 00<Internal><Encl Pos 1 >: Slot 6
Vendor Id : ATA
Product Id : TOSHIBA MG04ACA6
State : Online
Disk Type : SATA,Hard Disk Device
Capacity : 5.457 TB
Power State : Active

Connector : 00<Internal><Encl Pos 1 >: Slot 7
Vendor Id : ATA
Product Id : TOSHIBA MG04ACA6
State : Online
Disk Type : SATA,Hard Disk Device
Capacity : 5.457 TB
Power State : Active

Connector : 00<Internal><Encl Pos 1 >: Slot 8
Vendor Id : ATA
Product Id : TOSHIBA MG04ACA6
State : Online
Disk Type : SATA,Hard Disk Device
Capacity : 5.457 TB
Power State : Active

Connector : 00<Internal><Encl Pos 1 >: Slot 9
Vendor Id : ATA
Product Id : TOSHIBA MG04ACA6
State : Online
Disk Type : SATA,Hard Disk Device
Capacity : 5.457 TB
Power State : Active

Connector : 00<Internal><Encl Pos 1 >: Slot 10
Vendor Id : ATA
Product Id : TOSHIBA MG04ACA6
State : Online
Disk Type : SATA,Hard Disk Device
Capacity : 5.457 TB
Power State : Active

Connector : 00<Internal><Encl Pos 1 >: Slot 11
Vendor Id : ATA
Product Id : TOSHIBA MG04ACA6
State : Online
Disk Type : SATA,Hard Disk Device
Capacity : 5.457 TB
Power State : Active

Connector : 00<Internal><Encl Pos 1 >: Slot 12
Vendor Id : ATA
Product Id : INTEL SSDSC2BX40
State : Unconfigured Good
Disk Type : SATA,Solid State Device
Capacity : 372.0 GB
Power State : Active

Connector : 00<Internal><Encl Pos 1 >: Slot 13
Vendor Id : ATA
Product Id : INTEL SSDSC2BX40
State : Unconfigured Good
Disk Type : SATA,Solid State Device
Capacity : 372.0 GB
Power State : Active

Storage

Virtual Drives
Virtual drive : Target Id 0 ,VD name
Size : 5.457 TB
State : Optimal
Operation In Progress : Background Initialization
RAID Level : 1

Virtual drive : Target Id 1 ,VD name
Size : 49.117 TB
State : Optimal
RAID Level : 5

可以看出已经有一个target id为0,一个target id为1的两个raid了,至此raid组建完毕

parted用于格式化大于1T的raid磁盘,文件系统为xfs

  • [root@ns-xxx ~]# parted /dev/sdb
  • (parted) mklabel
  • New disk label type? gpt
  • Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
  • Yes/No? yes
  • (parted) mkpart
  • Partition name? []? registry
  • File system type? [ext2]? xfs
  • Start? 0%
  • End? 100%
  • (parted) quit
  • Information: You may need to update /etc/fstab.

    格式化后,查看信息

    • [root@ns-xxx ~]# mkfs.xfs -f /dev/sdb1
  • meta-data=/dev/sdb1 isize=512 agcount=50, agsize=268435455 blks
  • = sectsz=4096 attr=2, projid32bit=1
  • = crc=1 finobt=0, sparse=0
  • data = bsize=4096 blocks=13184925184, imaxpct=5
  • = sunit=0 swidth=0 blks
  • naming =version 2 bsize=4096 ascii-ci=0 ftype=1
  • log =internal log bsize=4096 blocks=521728, version=2
  • = sectsz=4096 sunit=1 blks, lazy-count=1
  • realtime =none extsz=4096 blocks=0, rtextents=0
  • [root@ns-xxx ~]# parted /dev/sdb print
  • Model: DELL PERC H730 Mini (scsi)
  • Disk /dev/sdb: 54.0TB
  • Sector size (logical/physical): 512B/4096B
  • Partition Table: gpt
  • Disk Flags:
  • Number Start End Size File system Name Flags
  • 1 1049kB 54.0TB 54.0TB xfs registry

查看对应的分区uuid信息并写入fstab开启自动挂载

  • [root@ns-xxx ~]# blkid
  • /dev/sda2: UUID="fd2db1bd-a0c8-441e-854d-0490ce3fbed6" TYPE="xfs" PARTUUID="226fa127-f1bc-47ed-a2d3-1f1d03767e22"
  • /dev/sda3: UUID="1a060266-8b5e-40b6-956e-694e73eb8e84" TYPE="swap" PARTUUID="efdc9bdf-50e8-4535-a3ac-ba9d3cc4d94b"
  • /dev/sda4: UUID="412ebd90-52d2-417c-8f5f-b7d6edf5885f" TYPE="xfs" PARTUUID="58d856f7-82f8-4d2a-8040-e2eb606ee5aa"
  • /dev/sdb1: UUID="88afcd28-cd54-432a-b72b-b879068d44ac" TYPE="ext4" PARTLABEL="registry" PARTUUID="eb457d79-56d6-4dd5-8f02-9be866b19527"
  • /dev/sda1: PARTUUID="c8ffa803-6674-4128-a2f9-f2589249275a"
  • [root@ns-xxx ~]# cat /etc/fstab
  • ....
  • UUID=412ebd90-52d2-417c-8f5f-b7d6edf5885f / xfs defaults 0 0
  • UUID=fd2db1bd-a0c8-441e-854d-0490ce3fbed6 /boot xfs defaults 0 0
  • UUID=1a060266-8b5e-40b6-956e-694e73eb8e84 swap swap defaults 0 0
  • UUID=293ea69f-15b4-42ca-a10e-a5fa9a6a8759 /registry xfs defaults 0 0

查看硬件信息
[root@ns-xxx ~]# dmidecode |more

参考链接:
https://serverfault.com/questions/331807/megacli-is-killing-me-any-help-appreciated
http://support.huawei.com/huaweiconnect/enterprise/zh/thread-430333-1-1.html
http://fibrevillage.com/storage/374-megacli-raid-0-1-5-6-and-raid50-raid60-creation-examples
https://blog.youkuaiyun.com/z_yttt/article/details/53020797

<think>好的,我现在需要帮助用户了解如何使用MegaCLI创建RAID 10。用户之前已经询问过使用storcli的方法,现在转向MegaCLI,可能是因为他们使用的工具不同,或者想比较两种方法。 首先,我需要确认用户的环境。他们之前的信息显示使用的是LSI/Avago/Broadcom控制器,路径是/a0/c32/dX,而MegaCLI和storcli都是管理这些控制器的工具。用户可能有两个工具可用,或者他们的系统上现在需要用到MegaCLI。 接下来,回顾用户之前的问题,他们提供了四块未配置的SSD,现在想创建RAID 10。用户可能已经尝试过storcli,现在想用MegaCLI实现同样的目的,或者他们需要在不同环境中使用不同的工具。 我需要确保给出的命令准确,并且参数正确。例如,在MegaCLI中,控制器的编号可能不同,需要确认用户是否使用正确的控制器号,比如/c0对应之前的/a0。同时,创建RAID 10需要指定驱动器列表,可能需要使用Enclosure和Slot的信息,和storcli中的格式可能不同。 另外,用户之前的信息中有Enclosure 32,但在MegaCLI中,Enclosure ID可能需要转换。比如,用户之前的路径是/a0/c32/d0,这里c32可能代表Enclosure 32,但在MegaCLI中,Enclosure ID可能不是直接对应,可能需要检查实际的Enclosure ID,比如通过MegaCLI命令查看。 需要注意MegaCLI和storcli的参数差异,比如storcli使用drives=32:0-3,而MegaCLI可能需要逐个列出每个驱动器,比如-drive 32:0,32:1,32:2,32:3。同时,RAID级别在MegaCLI中可能用不同的数字表示,比如RAID 10对应的是1+0,可能需要确认正确的参数。 另外,用户可能需要知道如何验证控制器编号和驱动器列表是否正确,所以需要建议他们运行MegaCLI的命令来查看现有配置,比如MegaCli64 -AdpAllInfo -aAll,以确认控制器编号和Enclosure信息。 还要提醒用户注意数据丢失的风险,确保所有磁盘都是未配置的,并且备份重要数据,尽管用户之前提到磁盘状态是Unconfigured(good),但再次强调是必要的。 最后,需要补充创建后的步骤,比如初始化阵列、分区和创建文件系统,以及如何检查RAID状态,确保用户能够完成整个配置过程。</think>以下是使用 **MegaCLI** 工具(适用于 LSI/Broadcom RAID 控制器)创建 RAID 10 的详细说明: --- ### == == == **基础条件** == == == 1. **磁盘状态**:4 块 SSD 均处于 `Unconfigured(good)` 状态(可安全配置) 2. **容量匹配**:所有磁盘容量相同(1.746TB),满足 RAID 10 要求 3. **物理路径**:控制器路径为 `/a0/c32/dX`(对应 Enclosure 32, Slot 0-3) --- ### == == == **创建 RAID 10 的命令** == == == ```bash MegaCli64 -CfgSpanAdd -r10 -Array0[32:0,32:1] -Array1[32:2,32:3] -sz1.746TB -a0 ``` *参数说明:* - `-CfgSpanAdd`: 创建跨磁盘组的阵列(RAID 10 需两个镜像对跨阵列条带化) - `-r10`: 指定 RAID 级别为 10 - `-Array0[32:0,32:1]`: 第一组镜像(Enclosure 32, Slot 0 和 Slot 1) - `-Array1[32:2,32:3]`: 第二组镜像(Enclosure 32, Slot 2 和 Slot 3) - `-sz1.746TB`: 指定单盘容量(避免自动检测误差) - `-a0`: 控制器编号(对应 `/a0` 中的控制器 0--- ### == == == **关键注意事项** == == == 1. **控制器与磁盘验证**: - 查看控制器列表:`MegaCli64 -AdpAllInfo -aAll` - 查看物理磁盘状态:`MegaCli64 -PDList -aAll` (确认 `Enclosure Device ID: 32` 和 `Slot Number: 0-3`) 2. **容量计算**: - RAID 10 可用空间 = 单盘容量 × (磁盘总数/2) = 1.746TB × 2 = **3.492TB** 3. **高级优化**: - 修改读写策略(提升 SSD 性能): ```bash MegaCli64 -LDSetProp -WB -Immediate -L0 -a0 # 启用 WriteBack 缓存 MegaCli64 -LDSetProp -Cached -L0 -a0 # 启用预读缓存 ``` 4. **操作后验证**: ```bash MegaCli64 -LDInfo -L0 -a0 # 查看逻辑磁盘状态 MegaCli64 -PDList -aAll # 确认物理盘状态变为 "Online" ``` --- ### == == == **对比 storcli 与 MegaCLI** == == == | 特性 | MegaCLI | storcli | |--------------------|----------------------------------|---------------------------------| | 命令复杂度 | 参数格式较
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值