태그 보관물: megacli

MegaRAID CLI Tool simple usage

megacli를 사용해 보았다.

설치는 간단하다.

avago homepage에서 8-07-14_MegaCLI.zip download받는다.

# unzip 8-07-14_MegaCLI.zip

# cd Linux

# yum localinstall MegaCli-8.07.14-1.noarch.rpm

no architecture 이기 때문에 rhel 에는 아무데나 깔아도 되는것같다.

사용법은 동일하게 avago homepage에서 검색하면 나오는데

embedded_mr_sw_ug.pdf

라는게 있다. 여기에 MegaCli64의 사용법과 MSM(MegaRAID Storage Manager)의 사용법도 같이 있다.

4MegaCLI Command Tool 에서 보면 각종 설정과 display command들이 있는데 오늘 내가 해볼것은 현재 설정을 보는것과 event log를 보는것… 그리고 raid rebuild 상황을 보는것 정도를 해볼것이다.

시작하기전에 편의를 위해 사전설정을 몇개 해두자.

# vim /etc/bashrc

alias MegaCli64=”/opt/MegaRAID/MegaCli/MegaCli64″

alias megacli=”/opt/MegaRAID/MegaCli/MegaCli64″

요렇게 두줄을 추가해놨다.

# . /etc/bashrc alias import 해주자.

일단 현재 설정을 보면…

# megacli -adpallinfo -a0

### command를 잠시 보면 adaptor all info adaptor 0 이라는 뜻이다. 처음에는 command option이 좀 특이해서 어려웠는데 좀 보다보니까 괜찮더라. -a-aall | -aN | -a0,1,2 이렇게도 들어갈 수 있다. ###

commandoption대소문자 구분을 하지 않는다.

결과를 좀 보면…

Adapter #0

==============================================================================

Versions

================

Product Name : PERC H700 Integrated

Serial No : 22I01AE

FW Package Build: 12.10.2-0004

Mfg. Data

================

Mfg. Date : 02/21/12

Rework Date : 02/21/12

Revision No : A06

Battery FRU : N/A

Image Versions in Flash:

================

BIOS Version : 3.18.00_4.09.05.00_0x0416A000

FW Version : 2.100.03-1405

raid controller h/w 의 거의 모든 정보를 볼 수있다.

# megacli -adpautorbld -dsply -a0

Adapter 0: AutoRebuild is Enabled.

Exit Code: 0x00

### adaptor auto rebuild enable 되어 있는지 확인 할 수 있다. 현재는 enable되어 있는상태이다. ###

# megacli –AdpGetProp RebuildRate | BgiRate | CCRate | CoercionMode

-aN|-a0,1,2|-aALL

### 각각 rebuildrate, bgirate, ccrate, corecionmode 를 볼 수있다. 뭔진 모르겠지만 일단 나온다. ###

# megacli adpgettime -aall

Adapter 0:

Date: 11/21/2016

Time: 11:04:39

Exit Code: 0x00

### 이렇게 date를 확인 할 수도 있다. adaptor마다 timer가 따로 있나보다. ###

# megaraid –AdpBootDrive {-Set –LDID} | -Get -aN|-a0,1,2|-aAL

### 이건 bootable logical drive를 지정하는거다. reboot 하면 지정된 logical drive로 부팅이 될것이다. ###

# megaraid –AdpBIOS -Enbl|-Dsbl|-Dsply| SOE | BE -aN|-a0,1,2|-aALL

### bios option을 볼 수 있는데… enable 또는 disable할 수 있다. 이는 bios에서 disk의 상태를 보여 줄지를 지정한다. 내껀 disable로 되어 있더라. SOEstop on error인데 bios 설정 문제로 멈추면 stop하겠다는 뜻이다. BEbypasses bios인데 위에꺼의 반대임. ###

# megacli –AdpEventLog –GetEventlogInfo |{–GetEvents | GetSinceShutdown|

GetSinceReboot | IncludeDeleted | {GetLatest <number>} –f <filename>}

|Clear -aN|-a0,1,2|-aALL

### 이것은 eventlog를 볼 수 있는데 여러가지 옵션들이 있다. 이중에 -getevents를 이용해서 eventlog를 볼 수 있다. ###

# megacli -cfgdsply -aall

==============================================================================

Adapter: 0

Product Name: PERC H700 Integrated

Memory: 512MB

BBU: Present

Serial No: 22I01AE

==============================================================================

Number of DISK GROUPS: 1

DISK GROUP: 0

Number of Spans: 1

SPAN: 0

Span Reference: 0x00

Number of PDs: 1

Number of VDs: 1

Number of dedicated Hotspares: 0

Virtual Drive Information:

Virtual Drive: 0 (Target Id: 0)

Name :

RAID Level : Primary-0, Secondary-0, RAID Level Qualifier-0

Size : 278.875 GB

Sector Size : 512

Parity Size : 0

State : Optimal

Strip Size : 64 KB

Number Of Drives : 1

Span Depth : 1

Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBU

Current Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBU

### 현재 adaptor의 설정을 볼 수 있다. virtual drive 정보와 physical drive정보를 한꺼번에 볼 수 있다. 위에 Cache Policy 가 보이는데, writeback으로 되어 있어야 속도가 빠르고 제기능을 하고 있다는 뜻이다. writethrough로 되어 있으면 느리다. bettery에 문제가 생기면 이 writeback cachewritethrough로 바뀔 수 있다. ###

# megacli -cfgfreespaceinfo -aall

Number of DISK GROUPS: 1

DISK GROUP: 0 Number of Spans: 1

SPAN: 0 Number of Free Space Slots: 0

Exit Code: 0x00

### free space를 보여준다. 현재는 놀고있는 disk가 없는 상태이다. ###

# megacli -ldinfo -lall -aall

Adapter 0 — Virtual Drive Information:

Virtual Drive: 0 (Target Id: 0)

Name :

RAID Level : Primary-0, Secondary-0, RAID Level Qualifier-0

Size : 278.875 GB

Sector Size : 512

Parity Size : 0

State : Optimal

Strip Size : 64 KB

Number Of Drives : 1

Span Depth : 1

Default Cache Policy: WriteBack, ReadAdaptive, Direct, No Write Cache if Bad BBU

### 위에서 나온 모든정보중에 logical drive(virtual drive)의 정보만 추려서 보여준다. ###

# megacli ldpdinfo -aall |grep -i ‘enclosur\|slot’

Enclosure Device ID: 32

Slot Number: 0

# megacli -pdrbld -showprog -physdrv [32:0] -aall

Device(Encl-32 Slot-0) is not in rebuild process

Exit Code: 0x00

### 이게 오늘 posting 목적의 raid controllerrebuild 진행상황을 볼 수 있는 command이다. 위에 enclosureslot number를 알아낸 뒤 그 physical drive에 대한 raid rebuilding 상황을 볼 수 가 있다. 현재는 rebuild process가 없다는 뜻이다. 있다면 percentage로 얼만큼 진행되었는지 얼마나 시간이 남았는지를 나타내 준다. ###

# megacli -pdrbld -progdsply -physdrv [32:0] -aall

Device(Encl-32 Slot-0) is not in rebuild process

### 위와 동일한데 계속해서 progress를 보여준다. 유용함. ###

위의 manual 에는 raid를 구성한다든가 하는 여러가지 configration option들도 있다. MSM(Megaraid Storage Manager)라고 하는 GUI Toolmanual도 함께 있다. MSM을 사용해서 하면 더 편하겠지만 오늘은 일단 CLI Tool만 알아본다.