码迷,mamicode.com
首页 > 其他好文 > 详细

megacli组建raid

时间:2018-05-17 13:55:11      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:raid gpt 分区

由于需要将磁盘划分为两个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.csdn.net/z_yttt/article/details/53020797

megacli组建raid

标签:raid gpt 分区

原文地址:http://blog.51cto.com/bingdian/2117433

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!