查看Linux系统下RAID信息
软件RAID
详细可参见:http://molinux.blog.51cto.com/2536040/516008
查看阵列状态:
[root@test ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] md0 : active raid5 sdd1[2] sdc1[1] sdb1[0] 9783296 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU] unused devices: <none>
通过cat /proc/mdstat信息查看所有运行的RAID阵列的状态,在第一行中首先是MD的设备名md0,active和inactive选项表示阵列是否能读/写,接着是阵列的RAID级别raid5,后面是属于阵列的块设备,方括号[]里的数字表示设备在阵列中的序号,(S)表示其是热备盘,(F)表示这个磁盘是 faulty状态。下一行中首先是阵列的大小,用块数来表示;后面有chunk-size的大小,然后是layout类型,不同RAID级别的 layout类型不同,[3/3] [UUU]表示阵列有3个磁盘并且3个磁盘都是正常运行的,而[2/3]和[_UU] 表示阵列有3个磁盘中2个是正常运行的,下划线对应的那个位置的磁盘是faulty状态的。
查看阵列的详细信息:
[root@test ~]# mdadm --detail /dev/md0
/dev/md0: Version : 0.90 Creation Time : Tue Mar 15 08:17:52 2011 Raid Level : raid5 Array Size : 9783296 (9.33 GiB 10.02 GB) Used Dev Size : 4891648 (4.67 GiB 5.01 GB) Raid Devices : 3 Total Devices : 3 Preferred Minor : 0 Persistence : Superblock is persistent Update Time : Tue Mar 15 08:20:25 2011 State : clean Active Devices : 3 Working Devices : 3 Failed Devices : 0 Spare Devices : 0 Layout : left-symmetric 校验规则 Chunk Size : 64K UUID : e0d929d1:69d7aacd:5ffcdf9b:c1aaf02d Events : 0.2 Number Major Minor RaidDevice State 0 8 17 0 active sync /dev/sdb1 1 8 33 1 active sync /dev/sdc1 2 8 49 2 active sync /dev/sdd1
硬件RAID
没有安装相应的管理工具,只能依靠Linux本身的话一般我知道的是两种方式:
[root@test ~]# dmesg |grep -i raid
dracut: rd_NO_DM: removing DM RAID activation dracut: rd_NO_MD: removing MD RAID activation Adaptec aacraid driver 1.2-0[30300]-ms aacraid 0000:01:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16 aacraid 0000:01:00.0: setting latency timer to 64 IRQ 16/aacraid: IRQF_DISABLED is not guaranteed on shared IRQs scsi0 : aacraid scsi 0:0:0:0: Direct-Access Adaptec RAID10-A V1.0 PQ: 0 ANSI: 2
[root@test ~]# cat /proc/scsi/scsi
Attached devices: Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: Adaptec Model: RAID10-A Rev: V1.0 Type: Direct-Access ANSI SCSI revision: 02 Host: scsi0 Channel: 01 Id: 00 Lun: 00 Vendor: Model: TXB2C10960GG7SLT Rev: ZN1H Type: Direct-Access ANSI SCSI revision: 05 Host: scsi0 Channel: 01 Id: 01 Lun: 00 Vendor: Model: TXB2C10960GG7SLT Rev: ZN1H Type: Direct-Access ANSI SCSI revision: 05 Host: scsi0 Channel: 01 Id: 02 Lun: 00 Vendor: Model: TXB2C10960GG7SLT Rev: ZN1H Type: Direct-Access ANSI SCSI revision: 05 Host: scsi0 Channel: 01 Id: 03 Lun: 00 Vendor: Model: TXB2C10960GG7SLT Rev: ZN1H Type: Direct-Access ANSI SCSI revision: 05
显示的信息差不多,raid的厂商,型号,级别,但无法查看各块硬盘的信息。
另外经过实际测试,Dell的服务器可以通过命令来显示,而HP、IBM等的服务器通过上面的命令是显示不出的。只能够通过装硬件厂商的管理工具来查看。
最佳的办法是通过安装的RAID管理工具来查看,有cmdline,也有图形界面。
确认RAID卡型号
看具体的RAID卡是什么型号的,通过以下命令 查看RAID卡信息:
[root@test ~]$ lspci -v -s $(lspci | grep -i raid |awk '{print $1}')
01:00.0 RAID bus controller: Adaptec AAC-RAID (rev 09) Subsystem: Adaptec 5405G Flags: bus master, fast devsel, latency 0, IRQ 16 Memory at df200000 (64-bit, non-prefetchable) [size=2M] Expansion ROM at df400000 [disabled] [size=512K] Capabilities: <access denied> Kernel driver in use: aacraid Kernel modules: aacraid
从上述返回信息得到RAID卡型号:Subsystem: Adaptec 5405G
下载和安装存储管理软件
根据该型号,去Adaptec的官网http://download.adaptec.com找到该型号对应的存储管理软件:
Title: Adaptec Storage Manager v7.31.18856 for 64-bit Linux Name: asm_linux_x64_v7_31_18856.tgz
下载并安装该软件:
[root@test ~]# wget http://download.adaptec.com/raid/storage_manager/asm_linux_x64_v7_31_18856.tgz [root@test ~]# tar zxvf asm_linux_x64_v7_31_18856.tgz [root@test ~]# cd manager [root@test manager]# rpm -Uvf StorMan-7.31.x86_64.rpm
查看硬件RAID信息
Adaptec公司的硬件卡就可以通过下面的命令进行查看:
[root@test StorMan]# /usr/StorMan/arcconf getconfig 1
Controllers found: 1 ---------------------------------------------------------------------- Controller information ---------------------------------------------------------------------- Controller Status : Optimal Channel description : SAS/SATA Controller Model : Adaptec 5405Z Controller Serial Number : 0B461184016 Physical Slot : 16 Temperature : 53 C/ 127 F (Normal) Installed memory : 512 MB Copyback : Disabled Background consistency check : Disabled Automatic Failover : Enabled Global task priority : High Performance Mode : Default/Dynamic Stayawake period : Disabled Spinup limit internal drives : 0 Spinup limit external drives : 0 Defunct disk drive count : 0 Logical devices/Failed/Degraded : 1/0/0 SSDs assigned to MaxCache pool : 0 Maximum SSDs allowed in MaxCache pool : 8 MaxCache Read Cache Pool Size : 0.000 GB MaxCache flush and fetch rate : 0 MaxCache Read, Write Balance Factor : 3,1 NCQ status : Enabled Statistics data collection mode : Enabled -------------------------------------------------------- Controller Version Information -------------------------------------------------------- BIOS : 5.2-0 (18950) Firmware : 5.2-0 (18950) Driver : 1.2-0 (30300) Boot Flash : 5.2-0 (18950) -------------------------------------------------------- Controller ZMM Information -------------------------------------------------------- Status : ZMM Optimal ---------------------------------------------------------------------- Logical device information ---------------------------------------------------------------------- Logical device number 0 Logical device name : RAID0-A RAID level : 0 Status of logical device : Optimal Size : 1830902 MB Stripe-unit size : 256 KB Read-cache mode : Enabled MaxCache preferred read cache setting : Enabled MaxCache read cache setting : Disabled Write-cache mode : Enabled (write-back) Write-cache setting : Enabled (write-back) when protected by battery/ZMM Partitioned : Yes Protected by Hot-Spare : No Bootable : Yes Failed stripes : No Power settings : Disabled -------------------------------------------------------- Logical device segment information -------------------------------------------------------- Segment 0 : Present (Controller:1,Connector:0,Device:0) 1000474A Segment 1 : Present (Controller:1,Connector:0,Device:1) 10004B09 ---------------------------------------------------------------------- Physical Device information ---------------------------------------------------------------------- Device #0 Device is a Hard drive State : Online Supported : Yes Transfer Speed : SATA 3.0 Gb/s Reported Channel,Device(T:L) : 0,0(0:0) Reported Location : Connector 0, Device 0 Vendor : Model : SDLFOCAR-960G-1H Firmware : ZZ2CRC92 Serial number : 1000474A Size : 915715 MB Write Cache : Enabled (write-back) FRU : None S.M.A.R.T. : No S.M.A.R.T. warnings : 0 Power State : Full rpm Supported Power States : Full rpm,Powered off SSD : Yes MaxCache Capable : No MaxCache Assigned : No NCQ status : Enabled Device #1 Device is a Hard drive State : Online Supported : Yes Transfer Speed : SATA 3.0 Gb/s Reported Channel,Device(T:L) : 0,1(1:0) Reported Location : Connector 0, Device 1 Vendor : Model : SDLFOCAR-960G-1H Firmware : ZZ2CRC92 Serial number : 10004B09 Size : 915715 MB Write Cache : Enabled (write-back) FRU : None S.M.A.R.T. : No S.M.A.R.T. warnings : 0 Power State : Full rpm Supported Power States : Full rpm,Powered off SSD : Yes MaxCache Capable : No MaxCache Assigned : No NCQ status : Enabled Command completed successfully.
如果是LSI的,安装MegaCli工具包即可, 这个我记得在LSI的网站上有。
[root@test ~]# /usr/dpt/raidutil -L all
可以看到非常详细的信息。
SoftLayer的服务器也提供相关控制卡的管理工具下载:
http://downloads.service.softlayer.com/adaptectools/linux/
http://downloads.service.softlayer.com/lsitools/
务必根据控制卡的版本下载正确的安装包。