原因:

有些情况下服务器系统不是自己装的,raid也不是自己配置的,或者当你接收一个岗位,远程登录系统后可能就不知道系统是否有做raid,raid级别?因此在这里博主总结一下Linux下查看软、硬raid信息的方法,分享一下。


软件raid:(只能通过Linux系统本身来查看)

1)查看阵列状态:

cat /proc/mdstat

[root@test ~]# cat /proc/mdstat

 

1
2
3
4
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状态的。

2)查看阵列的详细信息:

 

1
[root@test ~]# mdadm --detail /dev/md0

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/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

引用自:http://ultrasql.blog.51cto.com/9591438/1627755

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

如果服务器没有做软raid话,将没有raid信息:

cat /proc/mdstat 

Personalities : 

unused devices: <none>

Linux阵列 RAID详解可参考博客:

http://molinux.blog.51cto.com/2536040/516008(软raid制作并不复杂,这里略过制作过程)


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

硬件raid:

下面两种方式显示的信息差不多,raid的厂商,型号,级别,但无法查看各块硬盘的信息。

另外经过实际测试,Dell的服务器可以通过命令来显示,而HP、IBM等的服务器通过上面的命令是显示不出的。只能够通过装硬件厂商的管理工具来查看。

最佳的办法是通过已安装的raid厂商的管理工具来查看,有cmdline,也有图形界面。如Adaptec公司的硬件卡就可以通过下面的命令进行查看:

# /usr/dpt/raidutil -L all可以看到非常详细的信息。


言归正传,继续。。。

1)dmesg |grep -i raid

megaraid_sas 0000:03:00.0: PCI INT A -> GSI 42 (level, low) -> IRQ 42

megaraid_sas 0000:03:00.0: setting latency timer to 64

megaraid_sas 0000:03:00.0: irq 109 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 110 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 111 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 112 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 113 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 114 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 115 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 116 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 117 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 118 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 119 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 120 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 121 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 122 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 123 for MSI/MSI-X

megaraid_sas 0000:03:00.0: irq 124 for MSI/MSI-X

megaraid_sas 0000:03:00.0: [scsi6]: FW supports<16> MSIX vector,Online CPUs: <24>,Current MSIX <16>

megaraid_sas 0000:03:00.0: Firmware supports 64 VD 256 PD

megaraid_sas 0000:03:00.0: Driver supports 256 VD  256 PD

megaraid_sas 0000:03:00.0: Controller type: MR,Memory size is: 1024MB

scsi6 : LSI SAS based MegaRAID driver

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


2)cat /proc/scsi/scsi

Attached devices:

Host: scsi4 Channel: 00 Id: 00 Lun: 00

  Vendor: PLDS     Model: DVD+-RW DS-8ABSH Rev: LD51

  Type:   CD-ROM                           ANSI  SCSI revision: 05

Host: scsi6 Channel: 02 Id: 00 Lun: 00

  Vendor: DELL     Model: PERC H710P       Rev: 3.13

  Type:   Direct-Access                    ANSI  SCSI revision: 05

Host: scsi6 Channel: 02 Id: 01 Lun: 00

  Vendor: DELL     Model: PERC H710P       Rev: 3.13

  Type:   Direct-Access  

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


df -TH

Filesystem     Type   Size  Used Avail Use% Mounted on

/dev/sda3      ext4   557G  3.6G  525G   1% /

tmpfs          tmpfs   34G     0   34G   0% /dev/shm

/dev/sda1      ext4   500M   32M  442M   7% /boot

/dev/sdb1      ext4   1.8T   24G  1.7T   2% /usr/local


fdisk -l


Disk /dev/sda: 599.6 GB, 599550590976 bytes

255 heads, 63 sectors/track, 72891 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0006d30c


   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          64      512000   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              64        4144    32768000   82  Linux swap / Solaris

/dev/sda3            4144       72892   552217600   83  Linux


Disk /dev/sdb: 1798.7 GB, 1798651772928 bytes

255 heads, 63 sectors/track, 218673 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00088b5e


   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1      218674  1756494848   83  Linux


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

注意:可以通过fdisk -l和df -TH查看你个人磁盘信息,结合上面命令确定raid信息,这里给大家可以猜猜我给服务器做的raid几,还能看到什么raid信息?