参考:http://blog.sina.com.cn/s/blog_57c70e190101ebl9.html
查看磁盘使用情况
[root@ ~]# MegaCli -PDList -Aall
Enclosure Device ID: 32
Slot Number: 0
Enclosure position: 0
Device Id: 0
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 931.512 GB [0x74706db0 Sectors]
Non Coerced Size: 931.012 GB [0x74606db0 Sectors]
Coerced Size: 931.0 GB [0x74600000 Sectors]
Firmware state: Online, Spun Up 在线
Enclosure Device ID: 32
Slot Number: 1
Enclosure position: 0
Device Id: 1
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 931.512 GB [0x74706db0 Sectors]
Non Coerced Size: 931.012 GB [0x74606db0 Sectors]
Coerced Size: 931.0 GB [0x74600000 Sectors]
Firmware state: Online, Spun Up
SAS Address(0): 0x5000c500586e6559
Enclosure Device ID: 32
Slot Number: 2
Enclosure position: 0
Device Id: 2
Sequence Number: 3
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 1.819 TB [0xe8e088b0 Sectors]
Non Coerced Size: 1.818 TB [0xe8d088b0 Sectors]
Coerced Size: 1.818 TB [0xe8d00000 Sectors]
Firmware state: Unconfigured(good), Spun Up 安装了磁盘,但是没有使用
Enclosure Device ID: 32
Slot Number: 3
Enclosure position: 0
Device Id: 3
Sequence Number: 3
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 1.819 TB [0xe8e088b0 Sectors]
Non Coerced Size: 1.818 TB [0xe8d088b0 Sectors]
Coerced Size: 1.818 TB [0xe8d00000 Sectors]
Firmware state: Unconfigured(good), Spun Up 安装了磁盘,但是没有使用
2块2T磁盘使用MegaCli做raid0
[root@ZAMPDMP-08 ~]# MegaCli -CfgLdAdd -r0 [32:2,32:3] WB Direct -a0
Adapter 0: Created VD 1
Adapter 0: Configured the Adapter!!
Exit Code: 0x00
单块4T磁盘做raid0
对7号槽的单块4T硬盘做raid0
MegaCli -CfgLdAdd -r0 [32:6] WB Direct -a0
单块盘要么调整raid 为jbod模式
要么就做成raid0 才能作为单块盘使用
无实际意义
只是raid卡的限制
查看raid
[root@ZAMPDMP-08 ~]# MegaCli -LdPdInfo -aALL Adapter #0
Number of Virtual Disks: 2
Virtual Drive: 0 (Target Id: 0) 第一个raid,包括slot 0,1,对应插槽0和1,级别raid0
Name :
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
Size : 931.0 GB
State : Optimal
Strip Size : 64 KB
Number Of Drives : 2
Span Depth : 1
Default Cache Policy: WriteThrough, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAheadNone, Direct, No Write Cache if Bad BBU
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
Number of Spans: 1
Span: 0 - Number of PDs: 2
PD: 0 Information
Enclosure Device ID: 32
Slot Number: 0
Enclosure position: 0
Device Id: 0
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 931.512 GB [0x74706db0 Sectors]
Non Coerced Size: 931.012 GB [0x74606db0 Sectors]
Coerced Size: 931.0 GB [0x74600000 Sectors]
Firmware state: Online, Spun Up
SAS Address(0): 0x5000c500586e2169
SAS Address(1): 0x0
Connected Port Number: 0(path0)
Inquiry Data: SEAGATE ST1000NM0023 GS0DZ1W1SRX0
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: 6.0Gb/s
Link Speed: 6.0Gb/s
Media Type: Hard Disk Device
Drive Temperature :37C (98.60 F)
PD: 1 Information
Enclosure Device ID: 32
Slot Number: 1
Enclosure position: 0
Device Id: 1
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 931.512 GB [0x74706db0 Sectors]
Non Coerced Size: 931.012 GB [0x74606db0 Sectors]
Coerced Size: 931.0 GB [0x74600000 Sectors]
Firmware state: Online, Spun Up
SAS Address(0): 0x5000c500586e6559
SAS Address(1): 0x0
Connected Port Number: 1(path0)
Inquiry Data: SEAGATE ST1000NM0023 GS0DZ1W1SQS1
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: 6.0Gb/s
Link Speed: 6.0Gb/s
Media Type: Hard Disk Device
Drive Temperature :38C (100.40 F)
Virtual Drive: 1 (Target Id: 1) 第二个raid,包括slot 2,3,对应插槽2和4、3,级别raid0
Name :
RAID Level : Primary-0, Secondary-0, RAID Level Qualifier-0
Size : 3.637 TB
State : Optimal
Strip Size : 64 KB
Number Of Drives : 2
Span Depth : 1
Default Cache Policy: WriteThrough, ReadAheadNone, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteThrough, ReadAheadNone, Direct, No Write Cache if Bad BBU
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: No
LD's IO profile supports MAX power savings with cached writes: No
Bad Blocks Exist: No
Number of Spans: 1
Span: 0 - Number of PDs: 2
PD: 0 Information
Enclosure Device ID: 32
Slot Number: 2
Enclosure position: 0
Device Id: 2
Sequence Number: 4
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 1.819 TB [0xe8e088b0 Sectors]
Non Coerced Size: 1.818 TB [0xe8d088b0 Sectors]
Coerced Size: 1.818 TB [0xe8d00000 Sectors]
Firmware state: Online, Spun Up
SAS Address(0): 0x5000c50055f63469
SAS Address(1): 0x0
Connected Port Number: 2(path0)
Inquiry Data: SEAGATE ST32000645SS RS12Z1K0ESPZ
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: 6.0Gb/s
Link Speed: 6.0Gb/s
Media Type: Hard Disk Device
Drive Temperature :42C (107.60 F)
PD: 1 Information
Enclosure Device ID: 32
Slot Number: 3
Enclosure position: 0
Device Id: 3
Sequence Number: 4
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 1.819 TB [0xe8e088b0 Sectors]
Non Coerced Size: 1.818 TB [0xe8d088b0 Sectors]
Coerced Size: 1.818 TB [0xe8d00000 Sectors]
Firmware state: Online, Spun Up
SAS Address(0): 0x5000c50055f60145
SAS Address(1): 0x0
Connected Port Number: 3(path0)
Inquiry Data: SEAGATE ST32000645SS RS12Z1K0ETDN
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None
Device Speed: 6.0Gb/s
Link Speed: 6.0Gb/s
Media Type: Hard Disk Device
Drive Temperature :44C (111.20 F)
Exit Code: 0x00
删除raid0
[root@ZAMPDMP-08 ~]# MegaCli -cfglddel -L1 -a0
Adapter 0: Deleted Virtual Drive-1(target id-1)
Exit Code: 0x00
L指的是删除vm组1 也就是第二个raid,a0是控制卡,如果是L0,则对应第一个raid。
[root@ZAMPDMP-11 data1]# dmidecode -t 1
# dmidecode 2.12
SMBIOS 2.7 present.
Handle 0x0100, DMI type 1, 27 bytes
System Information
Manufacturer: Dell Inc.
Product Name: PowerEdge R420
Version: Not Specified
Serial Number: 429PKY1 #机器序列号
UUID: 4C4C4544-0032-3910-8050-B4C04F4B5931
Wake-up Type: Power Switch
SKU Number: SKU=NotProvided;ModelName=PowerEdge R420
Family: Not Specified
清楚外键
否则不能单块磁盘做raid0
root@deptest29:/home/chinadep# megacli -cfgforeign scan -a0
There are 1 foreign configuration(s) on controller 0.
Exit Code: 0x00
root@deptest29:/home/chinadep# megacli -cfgforeign clear -a0
Foreign configuration 0 is cleared on controller 0.
Exit Code: 0x00
root@deptest29:/home/chinadep# megacli -cfgforeign -scan -a0
There is no foreign configuration on controller 0.
Exit Code: 0x00
新添加的大于等于2T的磁盘,需要使用parted去分区,fdisk分区4T盘,最多使用2T
这里测试使用parted 格式化10块4T盘,测试结果ok
[root@ZAMPDMP-08 ~]# vim parted.sh
#!/bin/bash
#Used to fomat 10 disks /dev/sdb /dev/sdc ....../dev/sdk 10
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH
i=1
while [ $i -lt 11 ]
do
j=`echo $i|awk '{printf "%c",97+$i}'`
parted /dev/sd$j <<ESXU
mklabel gpt
mkpart primary 0 -1
ignore
quit
ESXU
echo "/n/n******/dev/sd${j} __was Fdisked! Waiting For 10 Second*****/n/n"
sleep 1s
mkfs.ext4 /dev/sd${j}1
if [ "$?" = "0" ];then
echo "/n/n*****sd${j}1 _________________was Formated, Waiting For 5 Second****/n/n"
fi
let i+=1
sleep 1s
done