MegaCli和storcli設置熱備盤
查看已創建的VD
MegaCli命令
MegaCli -LDInfo -Lall -aall
執行結果
[root@kylin ~]# MegaCli -LDInfo -Lall -aall
Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name :
RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3
Size : 1.089 TB
Sector Size : 512
Is VD emulated : No
Parity Size : 558.406 GB
State : Optimal
Strip Size : 256 KB
Number Of Drives : 3
Span Depth : 1
Default Cache Policy: WriteBack, ReadAhead, Cached, Write Cache OK if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, Cached, Write Cache OK if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy : Enabled
Encryption Type : None
Bad Blocks Exist: No
Is VD Cached: No
Virtual Drive: 1 (Target Id: 1)
Name :
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
Size : 1.089 TB
Sector Size : 512
Is VD emulated : No
Mirror Data : 1.089 TB
State : Optimal
Strip Size : 256 KB
Number Of Drives per span:2
Span Depth : 2
Default Cache Policy: WriteBack, ReadAhead, Cached, Write Cache OK if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, Cached, Write Cache OK if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy : Enabled
Encryption Type : None
Bad Blocks Exist: No
Is VD Cached: No
Virtual Drive: 2 (Target Id: 2)
Name :
RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3
Size : 1.089 TB
Sector Size : 512
Is VD emulated : No
Parity Size : 558.406 GB
State : Optimal
Strip Size : 256 KB
Number Of Drives : 3
Span Depth : 1
Default Cache Policy: WriteBack, ReadAhead, Cached, Write Cache OK if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, Cached, Write Cache OK if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy : Enabled
Encryption Type : None
Bad Blocks Exist: No
Is VD Cached: No
Exit Code: 0x00
storcli命令
storcli /call /vall show
執行結果
[root@kylin ~]# storcli /call /vall show
Controller = 0
Status = Success
Description = None
Virtual Drives :
==============
--------------------------------------------------------------
DG/VD TYPE State Access Consist Cache Cac sCC Size Name
--------------------------------------------------------------
0/0 RAID5 Optl RW No RAWBC - ON 1.089 TB
2/1 RAID10 Optl RW No RAWBC - ON 1.089 TB
1/2 RAID5 Optl RW No RAWBC - ON 1.089 TB
--------------------------------------------------------------
Cac=CacheCade|Rec=Recovery|OfLn=OffLine|Pdgd=Partially Degraded|dgrd=Degraded
Optl=Optimal|RO=Read Only|RW=Read Write|HD=Hidden|TRANS=TransportReady|B=Blocked|
Consist=ConsistentR=Read Ahead Always|NR=No Read Ahead|WB=WriteBack|
AWB=Always WriteBack|WT=WriteThrough|C=Cached IO|D=Direct IO|sCC=Scheduled
Check Consistency
需要關注的是,storcli命令執行結果裏的DG/VD。
1. DG編號對應的應該是硬RAID創建的先後順序,這是一個關鍵信息,因爲後面設置熱備盤的時候需要用到。
2. VD編號是和硬RAID在操作系統裏對應的盤符的關鍵信息。
MegaCli命令執行結果無法查看到DG,如”Virtual Drive: 2 (Target Id: 2)”中,對應的2爲VD編號。
硬RAID設置熱備盤分爲兩種:
1. 全局熱備。
2. 針對某個VD的熱備。
熱備盤設置命令:
MegaCli -PDHSP {-Set [-Dedicated [-ArrayN|-Array0,1,2...]] [-EnclAffinity] [-nonRevertible]}
|-Rmv -PhysDrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL
全局熱備:GHSP
全局熱備比較簡單,將要設置熱備的磁盤加到對應的adapter就可以,執行如下命令設置:
MegaCli -PDHSP -Set -PhysDrv[14:1] -a0
局部熱備:(Dedicated HSP)
MegaCli -PDHSP -Set -Dedicated -Array2 -PhysDrv[14:1] -a0
局部熱備裏的Array計算比較麻煩,這裏就要用到上面提到的DG,要按DG的排序累加,一直累加到要添加熱備的VD(要添加熱備的VD也要計算)。
1. 默認設Array爲-1。
2. 如果是RAID0,1,5,6,則Array加1。
3. 如果是RAID10,50,則Array加2。
4. 如果是RAID0,1,5,6,則返回Array最後計算的值。
5. 如果是RAID10,50,則返回Array-1,Array。
[root@kylin ~]# ls -al /dev/disk/by-path/
總用量 0
drwxr-xr-x 2 root root 100 4月 20 18:45 .
drwxr-xr-x 5 root root 100 4月 20 18:41 ..
lrwxrwxrwx 1 root root 9 4月 20 18:41 platform-40000000.pcie-controller-pci-0000:11:00.0-scsi-0:2:0:0 -> ../../sdb
lrwxrwxrwx 1 root root 9 4月 20 18:45 platform-40000000.pcie-controller-pci-0000:11:00.0-scsi-0:2:1:0 -> ../../sdc
lrwxrwxrwx 1 root root 9 4月 20 18:41 platform-40000000.pcie-controller-pci-0000:11:00.0-scsi-0:2:2:0 -> ../../sdd
在系統內查找和VD對應的磁盤
[root@kylin ~]# lspci
00:00.0 PCI bridge: Synopsys, Inc. Device abcd (rev 01)
00:01.0 PCI bridge: Synopsys, Inc. Device abcd (rev 02)
00:02.0 PCI bridge: Synopsys, Inc. Device abcd (rev 01)
00:03.0 PCI bridge: Synopsys, Inc. Device abcd (rev 02)
01:00.0 PCI bridge: PLX Technology, Inc. Device 8725 (rev ca)
01:00.1 System peripheral: PLX Technology, Inc. Device 87d0 (rev ca)
01:00.2 System peripheral: PLX Technology, Inc. Device 87d0 (rev ca)
01:00.3 System peripheral: PLX Technology, Inc. Device 87d0 (rev ca)
01:00.4 System peripheral: PLX Technology, Inc. Device 87d0 (rev ca)
02:01.0 PCI bridge: PLX Technology, Inc. Device 8725 (rev ca)
02:02.0 PCI bridge: PLX Technology, Inc. Device 8725 (rev ca)
02:08.0 PCI bridge: PLX Technology, Inc. Device 8725 (rev ca)
02:09.0 PCI bridge: PLX Technology, Inc. Device 8725 (rev ca)
02:0a.0 PCI bridge: PLX Technology, Inc. Device 8725 (rev ca)
02:0b.0 PCI bridge: PLX Technology, Inc. Device 8725 (rev ca)
02:0c.0 PCI bridge: PLX Technology, Inc. Device 8725 (rev ca)
03:00.0 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)
03:00.1 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)
04:00.0 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)
04:00.1 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)
04:00.2 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)
04:00.3 Ethernet controller: Intel Corporation 82580 Gigabit Network Connection (rev 01)
08:00.0 USB controller: Renesas Technology Corp. uPD720201 USB 3.0 Host Controller (rev 03)
09:00.0 SATA controller: Marvell Technology Group Ltd. Device 9215 (rev 11)
0a:00.0 Serial Attached SCSI controller: LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] (rev 03)
0c:00.0 PCI bridge: PLX Technology, Inc. Device 8748 (rev ca)
0d:01.0 PCI bridge: PLX Technology, Inc. Device 8748 (rev ca)
0d:08.0 PCI bridge: PLX Technology, Inc. Device 8748 (rev ca)
0d:09.0 PCI bridge: PLX Technology, Inc. Device 8748 (rev ca)
0d:10.0 PCI bridge: PLX Technology, Inc. Device 8748 (rev ca)
0d:11.0 PCI bridge: PLX Technology, Inc. Device 8748 (rev ca)
11:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)