全部博文(107)
分类: 服务器与存储
2012-05-03 14:12:58
检查一台服务器是否有配置RAID。先dmesg看有没有RAID卡:
# dmesg|grep -i raid
ahci 0000:00:1f.2: AHCI 0001.0100 32 slots 4 ports 3 Gbps 0xf impl RAID mode
device-mapper: dm-raid45: initialized v0.2594l
md: Autodetecting RAID arrays.
看来是有的,只是看不出来是哪种RAID卡(0000:00:1f.2?)。接着fdisk,发现有两块硬盘/dev/sda,/dev/sdb:
# fdisk -l
Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1318 10482412+ 83 Linux
/dev/sda3 1319 4189 23061307+ 5 Extended
/dev/sda4 4190 30400 210539857+ 83 Linux
/dev/sda5 1319 2623 10482381 83 Linux
/dev/sda6 2624 3928 10482381 83 Linux
/dev/sda7 3929 4189 2096451 82 Linux swap / Solaris
Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 13 104391 83 Linux
/dev/sdb2 14 1318 10482412+ 83 Linux
/dev/sdb3 1319 4189 23061307+ 5 Extended
/dev/sdb4 4190 30400 210539857+ 83 Linux
/dev/sdb5 1319 2623 10482381 83 Linux
/dev/sdb6 2624 3928 10482381 83 Linux
/dev/sdb7 3929 4189 2096451 82 Linux swap / Solaris
而且这两块硬盘都是物理硬盘:
# hdparm -i /dev/sda
/dev/sda:
Model=ST3250310AS , FwRev=3.AAB , SerialNo= 6RY8ZABB
Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
BuffType=unknown, BuffSize=8192kB, MaxMultSect=16, MultSect=?16?
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=268435455
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2
AdvancedPM=no WriteCache=enabled
Drive conforms to: Unspecified: ATA/ATAPI-3 ATA/ATAPI-4 ATA/ATAPI-5 ATA/ATAPI-6 ATA/ATAPI-7
* signifies the current active mode
# hdparm -i /dev/sdb
/dev/sdb:
Model=ST3250310AS , FwRev=3.AAB , SerialNo= 6RY6QYSJ
Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
BuffType=unknown, BuffSize=8192kB, MaxMultSect=16, MultSect=?16?
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=268435455
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2
AdvancedPM=no WriteCache=enabled
Drive conforms to: Unspecified: ATA/ATAPI-1 ATA/ATAPI-2 ATA/ATAPI-3 ATA/ATAPI-4 ATA/ATAPI-5 ATA/ATAPI-6 ATA/ATAPI-7
* signifies the current active mode
看来没有配RAID。于是df,结果发现只列出了一块硬盘,而且这块硬盘既不是/dev/sda也不是/dev/sdb,而是/dev/mapper/isw_ddjafhgbch_Volume0:
[root@localhost device-mapper-1.02.39]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/isw_ddjafhgbch_Volume0p6
9.7G 6.2G 3.0G 68% /
/dev/mapper/isw_ddjafhgbch_Volume0p2
195G 115G 71G 62% /home
/dev/mapper/isw_ddjafhgbch_Volume0p5
9.7G 664M 8.6G 8% /var
/dev/mapper/isw_ddjafhgbch_Volume0p3
9.7G 152M 9.1G 2% /tmp
/dev/mapper/isw_ddjafhgbch_Volume0p1
99M 12M 83M 13% /boot
tmpfs 2.0G 0 2.0G 0% /dev/shm
这就奇怪了:如果服务器有配RAID,那么fdisk应该只能列出一块硬盘;如果服务器没有配RAID,那么fdisk的结果应该与df的结果一致。
难道这是传说中的软RAID?
于是拿之前的RAID卡信息去搜索...后来找到了lvm,而且服务器也有安装lvm2:
# rpm -qa|grep lvm
lvm2-2.02.56-8.el5
system-config-lvm-1.1.5-4.el5
尝试执行lvm的相关指令(pvs\vgs\lvs),但这些命令没有任何输出:
# pvs
# lvs
# vgs
#
后来发现,如果服务器有配置lvm,那么fdisk出来的分区类型应该是8e。而此服务器的分区类型是83:
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 13 104391 83 Linux
看来服务器并不是通过lvm配置的RAID。
继续搜索...后来找到了Device Mapper及其对应的管理工具dmsetup。于是尝试使用dmsetup的相关指令,发现竟然有反应:
[root@localhost device-mapper-1.02.39]# dmsetup table
isw_ddjafhgbch_Volume0p7: 0 4192902 linear 253:0 63103383
isw_ddjafhgbch_Volume0p6: 0 20964762 linear 253:0 42138558
isw_ddjafhgbch_Volume0p5: 0 20964762 linear 253:0 21173733
isw_ddjafhgbch_Volume0: 0 488390392 mirror core 3 131072 nosync block_on_error 2 8:0 0 8:16 0
isw_ddjafhgbch_Volume0p3: 0 20964825 linear 253:0 208845
isw_ddjafhgbch_Volume0p2: 0 421079715 linear 253:0 67296285
isw_ddjafhgbch_Volume0p1: 0 208782 linear 253:0 63
看来服务器就是是通过Device Mapper配置的软RAID(mirror,相当于RAID 1)。
后来进一步了解,Device mapper 是 Linux 2.6 内核中提供的一种从逻辑设备到物理设备的映射框架机制,在该机制下,可以实现软RAID。之前找到的lvm也是基与此机制而扩展出来的应用...
另外,除了通过dmsetup table查看RAID类型外,还可以通过dmsetup info查看RAID状态:
[root@localhost device-mapper-1.02.39]# dmsetup info
Name: isw_ddjafhgbch_Volume0p7
State: ACTIVE
Read Ahead: 256
Tables present: LIVE
Open count: 1
Event number: 0
Major, minor: 253, 6
Number of targets: 1
UUID: part7-DMRAID-isw_ddjafhgbch_Volume0
Name: isw_ddjafhgbch_Volume0p6
State: ACTIVE
Read Ahead: 256
Tables present: LIVE
Open count: 1
Event number: 0
Major, minor: 253, 5
Number of targets: 1
UUID: part6-DMRAID-isw_ddjafhgbch_Volume0
...