Linux工具篇--Raid卡操作

837 阅读9分钟
Raid卡型号与操作

Raid卡市场主要是LSI、Adaptec、Highpoint、Promise等厂商提供。Adaptac被PMC收购后,提供的Raid卡即为PMC,简称为P卡。LSI公司提供的Raid卡,即为L卡。

Raid卡配置操作方式

Raid配置可以通过BIOS启动后进入Raid的配置页面进行配置,也可以进入系统后通过对应的操作工具进行配置。

PMC配置操作工具为: arcconf

LSI配置操作工具为:storcli

Arcconf介绍

下载:

storage.microsemi.com/en-us/speed…

使用:
  • arcconf list controller_id 查询RAID卡的基本信息, controller_id 硬盘所在RAID卡的ID

[root@localhost ~]# arcconf list 1 Controllers found: 1

Controller information

Controller ID             : Status, Slot, Mode, Name, SerialNumber, WWN

Controller 1:             : Optimal, Slot 1, RAID (Hide RAW), MSCC Adaptec SmartHBA 2100-8i, 7A4563EDE26, 50000D1703F07180


Array Information

Array ID                 : Status (Interface, TotalSize MB, FreeSpace MB)

Array 0                   : Has Failed Logical Drive (SATA, 19077120 MB, 0 MB) Array 1                   : Ok (SATA, 9538560 MB, 5343744 MB)


Logical device information

Logical ID               : Status (RAID, Interface, Size MB) Name

Logical 0                 : Failed (10, Data, 4194304 MB) A Logical 1                 : Optimal (10, Data, 5344246 MB) B Logical 2                 : Optimal (1, Data, 2097152 MB) Logical Drive 3


Physical Device information

Physical ID               : State (Interface, BlockSize, SizeMB, Vendor, Model, Type) WWN, [Location]

Physical 0,8             : Online (SATA, 512 Bytes, 4769307MB, ATA     , HUS726050ALE610 , Hard Drive) 500E004AAAAAAA00, [Enclosure 1, Slot 0(Connector 0:CN0)] Physical 0,9             : Online (SATA, 512 Bytes, 4769307MB, ATA     , HGST HUS726050AL, Hard Drive) 500E004AAAAAAA01, [Enclosure 1, Slot 1(Connector 0:CN0)] Physical 0,10             : Online (SATA, 512 Bytes, 4769307MB, ATA     , HGST HUS726050AL, Hard Drive) 500E004AAAAAAA02, [Enclosure 1, Slot 2(Connector 0:CN0)] Physical 0,11             : Online (SATA, 512 Bytes, 4769307MB, ATA     , HGST HUS726050AL, Hard Drive) 500E004AAAAAAA03, [Enclosure 1, Slot 3(Connector 0:CN0)] Physical 0,12             : Online (SATA, 512 Bytes, 4769307MB, ATA     , HGST HUS726050AL, Hard Drive) 500E004AAAAAAA04, [Enclosure 1, Slot 4(Connector 0:CN0)] Physical 0,13             : Online (SATA, 512 Bytes, 4769307MB, ATA     , HGST HUS726050AL, Hard Drive) 500E004AAAAAAA05, [Enclosure 1, Slot 5(Connector 0:CN0)] Physical 2,0             : Ready (SES2, Not Applicable, Not Applicable, 12G SAS, Expander, Enclosure Services Device) 500E004AAAAAAA1F, [Connector 0:CN0, Enclosure 1] Physical 2,3             : Ready (SES2, Not Applicable, Not Applicable, MSCC   , Virtual SGPIO, Enclosure Services Device) 50000D1703F07180, [Not Applicable]

Command completed successfully.

  • arcconf getconfig controller_id AD 查询RAID卡的基本信息

命令格式功能
arcconf getconfig controller_id AD查询适配器信息
arcconf getconfig controller_id LD查询所有LD的信息
arcconf getconfig controller_id LD LD_id查询特定LD的信息
arcconf getconfig controller_id PD查询所有物理硬盘的信息
arcconf getconfig controller_id PD physical_id查询特定物理硬盘的信息
arcconf getconfig controller_id AR查询所有Array的信息
arcconf getconfig controller_id AR AR_id查询特定Array的信息
  • arcconf setcontrollermode controller_id mode 设置RAID卡工作模式 , 默认为“Mixed” 。 mode = 2: HBA 3: RAID 5: Mixed

./arcconf setcontrollermode 1 3 Controllers found: 1

Command completed successfully.

  • arcconf getconfig 1 查询raid卡工作模式

  • arcconf list 查询所有适用arcconf工具的RAID卡

[root@localhost ~]# arcconf list Controllers found: 1

Controller information

Controller ID             : Status, Slot, Mode, Name, SerialNumber, WWN

Controller 1:             : Optimal, Slot 1, Mixed, MSCC Adaptec SmartHBA 2100-8i, 7A4563EDE26, 50000D1703F07180

Command completed successfully.

  • arcconf setboot controller_id logicaldrive LD_id type boot_type 设置启动盘, LD_id 为 LD的ID , boot_type 为 启动项的类型 , Primary : 将LD或PD设置为第一启动设备, Secondary :将LD或PD设置为第二启动设备。

  • arcconf setboot controller_id device physical_id type boot_type 设置启动盘, physical_id 为 硬盘的physical ID ,boot_type 为 启动项的类型,Primary : 将LD或PD设置为第一启动设备, Secondary :将LD或PD设置为第二启动设备。

[root@localhost ~]# arcconf setboot 1 logicaldrive 1 type primary Controllers found: 1 Do you wish to change the boot type of the selected device. Press y, then ENTER to continue or press ENTER to abort: y

Command completed successfully.

  • arcconf setarrayparam controller_id array_id sparetype mode 设置磁盘为热备模式,mode 热备盘的类型 , 1:Dedicated 2:Autoreplace

[root@localhost ~]# arcconf setarrayparam 1 0 sparetype 1 Controllers found: 1

Command completed successfully. [root@localhost ~]#

磁盘电灯:
命令功能
arcconf identify controller_id device physical_id time time对特定的物理硬盘进行点灯,time为可选项*,*表示点灯持续的时间,单位为秒。
arcconf identify controller_id device physical_id对特定的物理硬盘持续点灯,按任意键会停止点灯。
arcconf identify controller_id all time time对所有的物理硬盘进行点灯,time为可选项*,*表示点灯持续的时间,单位为秒。
arcconf identify controller_id all stop对所有的物理硬盘停止点灯
arcconf identify controller_id logicaldrive LD_id time time对特定的LD进行点灯,time为可选项*,*表示点灯持续的时间,单位为秒。
arcconf identify controller_id logicaldrive LD_id对特定的LD停止点灯
arcconf identify controller_id array array_id time time对特定的Array进行点灯,time为可选项*,*表示点灯持续的时间,单位为秒。
arcconf identify controller_id array array_id对特定的Array停止点灯

[root@localhost ~]# ./arcconf identify 1 device 0 0 Controllers found: 1 Only devices managed by an enclosure processor may be identified The specified device(s) is/are blinking. Press any key to stop the blinking.

创建和删除raid
  • arcconf create controller_id logicaldrive option size level physical_id physical_id...... 创建raid, option为可以设置的选项: Stripesize 条带大小,取值为 16/32/64/128/256/512/1024 ; Name LD的名称; LDcache Controller Cache ; SSDOverProvisioningOptimization SSD的特性,取值为 enable / disable 只有当RAID组由SSD组成时,才能设置该属性。 该选项设置为“Enabled”后,会在数据写入SSD之前重新分配所有使用的块来优化SSD,可以加快初始化的速度。 DataLD 被加速的LD的ID

  • arcconf delete controller_id logicaldrive ld_id noprompt 删除raid

[root@localhost ~]# ./arcconf create 1 logicaldrive max 0 0 7 Controllers found: 1

Do you want to add a logical device to the configuration? Press y, then ENTER to continue or press ENTER to abort: y

Creating logical device: LogicalDrv 1

Command completed successfully.

[root@localhost ~]# ./arcconf delete 1 logicaldrive 1 noprompt Controllers found: 1

WARNING: Deleting this logical device will automatically delete array 1 because it is the only logical device present on that array. All data in logical device 1 will be lost. Deleting: logical device 1 ("LogicalDrv 1")

Command completed successfully.

磁盘cache:
  • arcconf getconfig controller_id ad 查询cache详情

  • arcconf setcache controller_id drivewritecachepolicy drivetype cachepolicy drivetype cachepolicy... 设置cache, drivetype : 要设置写Cache策略的硬盘类型 , Configured:设置RAID/Mixed模式下RAID组成员盘的写Cache策略。 Unconfigured:设置RAID/Mixed模式下非RAID组成员盘的写Cache策略 。 HBA:设置HBA模式下硬盘的写Cache策略; cachepolicy : 硬盘写Cache策略 , 0:Default(将硬盘的写Cache保持为默认状态) 。 1:Enabled(打开硬盘的写Cache功能) 。 2:Disabled(关闭硬盘的写Cache功能)

设置Configured状态的硬盘Cache写策略为Enabled,设置Unconfigured状态的硬盘Cache写策略为Disabled

[root@localhost ~]# ./arcconf setcache 1 drivewritecachepolicy Configured 1 Unconfigured 2 Controllers found: 1 Enabling controller drive write cache can increase write performance but risks losing the data in the cache on sudden loss.

Command completed successfully.

查询当前的硬盘写Cache策略

[root@localhost ~]# ./arcconf getconfig 1 ad Controllers found: 1

Controller information

Controller Statue             : Optimal Controller Mode               :Mixed Channle description           :SCSI

...

Physical Drive Write Cache Policy Information

Configured Drives               :Enabled Unconfigured Drives             :Disabled HBA Drives                       :Default

...

storcli介绍

安装:

官网下载www.broadcom.com/site-search… rpm包安装

使用:

  • storcli64 -h 获取帮助信息

  • storcli64 show[all] 显示某一块raid卡的版本、功能、状态、以及raid卡下的物理磁、逻辑盘信息

  • storcli64 /cx show 显示控制器0的信息

  • storcli64 /cx show freespace 显示剩下的磁盘空间

  • storcli64 /cx set rebuildrate=x1 设置rebuildrate速度

  • storcli64 /cx show rebuildrate 显示重建速率

  • storcli64 /cx set patrolread=on or off 开启或关闭patrolread

  • storcli64 /cx set cc=on or off 开启或关闭rate

  • storcli64 /cx download file=filepath 升级raid卡固件,需要重启

  • storcli64 /cx flushcache 清除raid卡、物理磁盘cache

  • storcli64 /cx/eall/sall show 显示物理磁盘信息

  • storcli64 /cx/eall/sall show all 显示详细物理磁盘信息

  • storcli64 /cx/ex/sx set good/offline/online/missing 设置某块磁盘的状态

  • storcli64 /cx/ex/sx start locate 开启定位某块磁盘

  • storcli64 /cx/ex/sx stop locate 关闭磁盘定位

  • storcli64 /cx/ex/sx show rebuild 显示rebuild

  • storcli64 /cx/ex/sx start rebuild 开始rebuild

  • storcli64 /cx/ex/sx stop rebuild 停止rebuild

  • storcli64 /cx/ex/sx add hostsparedrive dgs=x 设置模块磁盘为diskgroup x 的热备盘

  • storcli64 /cx/ex/sx delete hostsparedrive 删除磁盘热备盘

磁盘JBOD:
  • storcli64 /cx[/ex]/sx set jbod 设置单盘jbod

  • storcli64 /cx[/ex]/sx show jbod 显示单盘jbod

[root@localhost ~]# /opt/MegaRAID/storcli/storcli64 /c0/e0/s1 show jbod CLI Version = 007.1017.0000.0000 May 10, 2019 Operating system = Linux 3.10.0-957.el7.x86_64 Controller = 0 Status = Failure Description = No JBODs have been configured

Detailed Status :


Drive     Status ErrCd ErrMsg

/c0/e0/s1 Failure   255 Drive is not a JBOD --------------------------------------------

  • storcli64 /cx[/ex]/sx del jbod [force] 删除磁盘jbod模式

  • storcli64 /cx show jbod 显示JBOD配置

[root@localhost ~]# /opt/MegaRAID/storcli/storcli64 /c0 show jbod CLI Version = 007.1017.0000.0000 May 10, 2019 Operating system = Linux 3.10.0-957.el7.x86_64 Controller = 0 Status = Success Description = None

Controller Properties :


Ctrl_Prop Value

JBOD     OFF ----------------

  • storcli64 /cx set jbod=<on|off> [force] 设置raid控制器为JBOD模式

  • storcli64 /cx show jbodwritecache 显示raid控制器JBOD写cache配置

  • storcli64 /cx set jbodwritecache=on|off|default 设置磁盘写cache

磁盘CACHE:
  • storcli64 /c0/vall show all 显示raid虚拟设备的详细信息,Write Cache(initial setting)代表为raid卡的写cache,WriteThrough为关闭模式,WriteBack为开启cache,;Disk Cache Policy代表物理磁盘的cache

[root@localhost ~]# /opt/MegaRAID/storcli/storcli64 /c0/v12 show all VD12 Properties :

Strip Size = 256 KB Number of Blocks = 7812499456 VD has Emulated PD = No Span Depth = 1 Number of Drives Per Span = 1 Write Cache(initial setting) = WriteBack Disk Cache Policy = Enabled Encryption = None Data Protection = Disabled Active Operations = None Exposed to OS = Yes OS Drive Name = /dev/sdm Creation Date = 27-04-2018 Creation Time = 03:20:44 AM Emulation type = default Cachebypass size = Cachebypass-64k Cachebypass Mode = Cachebypass Intelligent Is LD Ready for OS Requests = Yes SCSI NAA Id = 6101b5442bcc70002275538c1c79b826 Unmap Enabled = N/A

  • storcli64 /c0/vall set pdcache=Off/On/Default 配置物理磁盘的cache,Off为关闭,On为开启,Default为默认值,当为Default时,cache取决于物理磁盘的cache,磁盘cache开启,则raid cache是开启的,否则为关闭。SATA磁盘cache默认为开启,SAS磁盘cache默认为关闭状态。

  • storcli64 /c0/vall set wrcache=wt/wb/awb 设置raid卡cache,wt为WriteThrough,wb为WiteBack,awb为AlwaysWriteBack。当cache为WriteBack时,如果raid卡存在电池,则cache为开启状态,如果没有电池则为WriteThrough状态;当cache为AlwaysWriteBack时,raid卡cache为总是开启状态

  • storcli64 /c0/bbu show 查看电容状态

[root@localhost ~]# /opt/MegaRAID/storcli/storcli64 /c0/bbu show CLI Version = 007.1017.0000.0000 May 10, 2019 Operating system = Linux 3.10.0-957.el7.x86_64 Controller = 0 Status = Failure Description = None

Detailed Status :


Ctrl Status Property ErrMsg     ErrCd

0 Failed -       use /cx/cv   255 --------------------------------------

  • storcli64 /c0 flushcache  刷新raid卡、物理磁盘cache

磁盘信息 :
  • storcli64 /c0/e0 show status  获取enclosure下磁盘风扇等设备的状态

  • storcli64 /cx/ex/sx set good/offline/online/missing  设置磁盘的状态

开启掘金成长之旅!这是我参与「掘金日新计划 · 2 月更文挑战」的第 7 天,点击查看活动详情