Megacli 定位磁盘

背景: 磁盘 /dev/sdb 重做 raid0,需要先定位 sdb 对应的物理盘,然后使用 raid 工具重做 raid。

环境:环境: ubuntu 16.04,megalic 8.07.14,服务器 raid 卡 “LSI Logic / Symbios Logic MegaRAID SAS-3 3108”

1、查看 raid 卡命令

lspci -knn | grep "RAID bus controller"

2、查看 /dev/sdb 对应的逻辑盘

# ll /dev/disk/by-path/
total 0
drwxr-xr-x 2 root root 620 Apr 16 10:37 ./
drwxr-xr-x 7 root root 140 Nov 10 16:49 ../
lrwxrwxrwx 1 root root   9 Apr  9 11:56 pci-0000:3b:00.0-scsi-0:2:0:0 -> ../../sda
lrwxrwxrwx 1 root root  10 Apr  9 11:56 pci-0000:3b:00.0-scsi-0:2:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root  10 Apr  9 11:56 pci-0000:3b:00.0-scsi-0:2:0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root  10 Apr  9 11:56 pci-0000:3b:00.0-scsi-0:2:0:0-part3 -> ../../sda3
lrwxrwxrwx 1 root root  10 Apr  9 11:56 pci-0000:3b:00.0-scsi-0:2:0:0-part4 -> ../../sda4
lrwxrwxrwx 1 root root   9 Apr 16 10:37 pci-0000:3b:00.0-scsi-0:2:1:0 -> ../../sdb
lrwxrwxrwx 1 root root   9 Apr  9 11:56 pci-0000:3b:00.0-scsi-0:2:10:0 -> ../../sdk

上面 pci-0000:3b:00.0-scsi-0:2:1:0 -> ../../sdb 表示/dev/sdb 对应逻辑盘 1, target id 1, raid 卡 bus id 3b

pci-0000:3b:00.0-scsi-0:2:10:0 -> ../../sdk 表示/dev/sdk 对应逻辑盘 10, target id 10, raid 卡 bus id 3b

3、查看 controller id

# megacli  -AdpGetPciInfo -aall -NoLog
                                     
PCI information for Controller 0
--------------------------------
Bus Number      : 3b
Device Number   : 0
Function Number : 0


Exit Code: 0x00

从上面可知 raid 卡 bus id 为 3b,controller id 为 0

3、使用 megacli 查看逻辑盘对应的物理盘

# megacli -LdPdInfo -aALL
...
Virtual Drive: 1 (Target Id: 1)
Name                :
RAID Level          : Primary-0, Secondary-0, RAID Level Qualifier-0
Size                : 2.182 TB
Sector Size         : 512
Is VD emulated      : Yes
Parity Size         : 0
State               : Optimal
Strip Size          : 64 KB
Number Of Drives    : 1
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, Direct, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current 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
Is VD Cached: No
Number of Spans: 1
Span: 0 - Number of PDs: 1

PD: 0 Information
Enclosure Device ID: 32
Slot Number: 0
Drive's position: DiskGroup: 24, Span: 0, Arm: 0
Enclosure position: 1
Device Id: 0
WWN: 50000399E88BCEEC
Sequence Number: 6
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
PD Type: SAS

Raw Size: 2.182 TB [0x11773c6b0 Sectors]
Non Coerced Size: 2.182 TB [0x11763c6b0 Sectors]
Coerced Size: 2.182 TB [0x117600000 Sectors]
Sector Size:  512
Logical Sector Size:  512
Physical Sector Size:  4096
Firmware state: Online, Spun Up
Device Firmware Level: EF05
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x50000399e88bceee
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: TOSHIBA AL15SEB24EQY    EF0510U0A2AGFQYF        
FDE Capable: Not Capable
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 12.0Gb/s 
Link Speed: 12.0Gb/s 
Media Type: Hard Disk Device
Drive Temperature :25C (77.00 F)
PI Eligibility:  No 
Drive is formatted for PI information:  Yes 
PI: PI with type 2
Port-0 :
Port status: Active
Port's Linkspeed: 12.0Gb/s 
Port-1 :
Port status: Active
Port's Linkspeed: 12.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No
...

从上面可以看到 Target Id: 1的逻辑盘对应的物理盘 Enclosure Device ID: 32 , Slot Number: 0 。

/dev/sdb 逻辑盘1,对应上面 Target Id: 1的逻辑盘。

RAID Level : Primary-0, Secondary-0, RAID Level Qualifier-0从这里,还能得出 /dev/sdb raid 级别为 0。

Primary-0 表示 raid0

Primary-1 表示 raid1

4、删除 /dev/sdb(对应逻辑盘1) raid

megacli -CfgLdDel -L1 -a0

5、/dev/sdb (对应物理盘Enclosure Device ID: 32 , Slot Number: 0)重做 raid0,写策略 WB,读策略 RA

megacli -CfgLdAdd -r0[32:0] WB RA Direct -a0

参考文章:

https://segmentfault.com/a/1190000020855063

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值