Manage Adaptec SAS RAID arrays using arcconf utility.

0

One day I got for misc setup server with some SAS controller. In dmesg command output I got following:

scsi 6:3:0:0: Enclosure LSILOGIC SASX36 A.1 7017 PQ: 0 ANSI: 3

Hmm, it looks like some LSI controller. But in dmesg also presents:

Adaptec aacraid driver 1.1-5[2461]-ms
aacraid 0000:03:00.0: PCI INT A -> GSI 26 (level, low) -> IRQ 26
aacraid 0000:03:00.0: setting latency timer to 64
IRQ 26/aacraid: IRQF_DISABLED is not guaranteed on shared IRQs
scsi6 : aacraid

So, this is adaptec.com arcconf utility. For Centos 6.2 x64 I used asm_linux_x64_v7_30_18837.tgz from adaptec.com.
This isn’t one step operation because we need to install compat-libstdc++-33 RPM package for utility.

After all installed (arcconf and compatability libs) I have ability to manage raid.
Follow some typically tasks.

1. Getting controller status. And logical drives information. Digit one in command line is a controller number.

[root@srv ~]# arcconf GETCONFIG 1
Controllers found: 1
----------------------------------------------------------------------
Controller information
----------------------------------------------------------------------
Controller Status : Optimal
Channel description : SAS/SATA
Controller Model : Adaptec 5445
Controller Serial Number : 1D04118EBB6
Physical Slot : 2
Temperature : 84 C/ 183 F (Normal)
Installed memory : 512 MB
Copyback : Disabled
Background consistency check : Disabled
Automatic Failover : Enabled
Global task priority : High
Performance Mode : Default/Dynamic
Stayawake period : Disabled
Spinup limit internal drives : 0
Spinup limit external drives : 0
Defunct disk drive count : 0
Logical devices/Failed/Degraded : 4/0/0
SSDs assigned to MaxCache pool : 0
Maximum SSDs allowed in MaxCache pool : 8
MaxCache Read Cache Pool Size : 0.000 GB
MaxCache flush and fetch rate : 0
MaxCache Read, Write Balance Factor : 3,1
NCQ status : Enabled
Statistics data collection mode : Enabled
--------------------------------------------------------
Controller Version Information
--------------------------------------------------------
BIOS : 5.2-0 (17899)
Firmware : 5.2-0 (17899)
Driver : 1.1-5 (2461)
Boot Flash : 5.2-0 (17899)
--------------------------------------------------------
Controller Battery Information
--------------------------------------------------------
Status : Not Installed
----------------------------------------------------------------------
Logical device information
----------------------------------------------------------------------
Logical device number 0
Logical device name : r6-1
RAID level : 6 Reed-Solomon
Status of logical device : Optimal
Size : 7618550 MB
Stripe-unit size : 256 KB
Read-cache mode : Enabled
MaxCache preferred read cache setting : Enabled
MaxCache read cache setting : Disabled
Write-cache mode : Enabled (write-back)
Write-cache setting : Enabled (write-back)
Partitioned : No
Protected by Hot-Spare : No
Bootable : Yes
Failed stripes : No
Power settings : Disabled
--------------------------------------------------------
Logical device segment information
--------------------------------------------------------
Segment 0 : Present (Controller:1,Enclosure:0,Slot:0) JK1101B9J6EBKR
Segment 1 : Present (Controller:1,Enclosure:0,Slot:1) JK1101B9J3AHRF
Segment 2 : Present (Controller:1,Enclosure:0,Slot:2) JK11A4B8J2JP1W
Segment 3 : Present (Controller:1,Enclosure:0,Slot:3) JK11A4B8J22TBW
Segment 4 : Present (Controller:1,Enclosure:0,Slot:4) JK11A4B8HY1T0W
Segment 5 : Present (Controller:1,Enclosure:0,Slot:5) JK11A4B8HUEM3W

2. Getting specific logical drive information (controller 1 and logical drive 1 )

[root@srv ~]# arcconf GETCONFIG 1 LD 1
Controllers found: 1
----------------------------------------------------------------------
Logical device information
----------------------------------------------------------------------
Logical device number 1
Logical device name : r6-2
RAID level : 6 Reed-Solomon
Status of logical device : Optimal
Size : 7618550 MB
Stripe-unit size : 256 KB
Read-cache mode : Enabled
MaxCache preferred read cache setting : Enabled
MaxCache read cache setting : Disabled
Write-cache mode : Enabled (write-back)
Write-cache setting : Enabled (write-back)
Partitioned : No
Protected by Hot-Spare : No
Bootable : No
Failed stripes : No
Power settings : Disabled
--------------------------------------------------------
Logical device segment information
--------------------------------------------------------
Segment 0 : Present (Controller:1,Enclosure:0,Slot:6) JK11A4B8HRTVSW
Segment 1 : Present (Controller:1,Enclosure:0,Slot:7) JK11A4B8J22RVW
Segment 2 : Present (Controller:1,Enclosure:0,Slot:8) JK11A4B8J22S9W
Segment 3 : Present (Controller:1,Enclosure:0,Slot:9) JK11A4B8J22WDW
Segment 4 : Present (Controller:1,Enclosure:0,Slot:10) JK11A4B8J22X7W
Segment 5 : Present (Controller:1,Enclosure:0,Slot:11) JK11A4B8J22S0W

Command completed successfully.

3. Creating RAID6 Logical drive
[root@srv ~]# arcconf create 1 logicaldrive name r6-1 max 6 0 8 0 9 0 10 0 11 0 12 0 13 noprompt

Where 1 – controller number, name – raid name (like john raid 1), max – is capacity, 6 – raid type number (RAID0-RAID10), 0 8 (to 0 13) means
that I use controller line 0 and drive in port 8.

4. Deleting logical drive (RAID drive)

[root@srv ~]# arcconf delete 1 logicaldrive 1

Delete logical drive 1.

NOTE: After creation RAID, we got “Status of logical device” as Impact. This mean that controller works on rebuilding drive procedure. So nothing for panic.

Ivan Shebanov.

Wow! iMessage for Mac OS X ! Great

0

Hi.
Today I found beta version on Apple new messenger, which supports iMessage for Mac OS X.
Also it supports me.com, Jabber and AIM.
Here is link: http://www.apple.com/macosx/mountain-lion/messages-beta/ .

Ivan.

3ware RAID and DEVICE-ERROR

0

Sometimes when using 3ware SATA RAID controller we mat get strange error like following:


# tw_cli
//server> info c0

Unit UnitType Status %RCmpl %V/I/M Stripe Size(GB) Cache AVrfy
------------------------------------------------------------------------------
u0 RAID-1 OK - - - 465.651 OFF ON

Port Status Unit Size Blocks Serial
---------------------------------------------------------------
p0 OK u0 465.76 GB 976773168 9QMB90EE
p1 DEVICE-ERROR u0 465.76 GB 976773168 9QMBCEJG

//server>

Looking strange, because Raid unit (u0) is OK, but disk in port 1 (p1) has device ERROR status.
This situation is not critical. DEVICE-ERROR status means that controller getting big ammount of error from disk, but this errors still not a critical. For example: hard drive hardware found many bad sectors, but automatic reallocation works file, or we have buggy SATA cable, or SATA connector is buggy. So I recommend following strategy:
1. Using tw_cli or 3dmd – remove disk from array

//server> /c0/p1 /remove

2. Try to remove hard and insert it again, if it possible try to change SATA cable
3. After step 2 is finished, rescan controller

//server> /c0 /rescan

4. When controller finished, please ensure, that disk found using /c0 show all command in tw_cli
5. Then start rebuild of raid (if auto rebuild it didn’t start autorebuild) with following command /c0/u0 start rebuild disk=1
6. After rebuild complete, we need to monitor controller status. If this error occurs again we need to repeat steps from 1 to 5, but instead reinsertion of disk, we need put new hard drive.

Ivan

Centos 6 and AR8131 – Atheros Ethernet adapter

0

One time I need to install Centos 6 on Asus P5G41T-M motherboard.
I found one big trouble, Centos 6, won’t to see on board ethernet controller.
After some time of googling I found solution. Drivers that’s already present in kernel, works non correctly with all revisions of chipset, so I found ready to rpm there:
http://elrepo.org/linux/elrepo/el6/x86_64/RPMS/kmod-atl1e-1.0.1.14-1.el6.elrepo.x86_64.rpm.
After downloading and install, all works fine.

LSI MegaRaid – MegaCli Linux Commands

2

Hi, periodically I need to manage servers with LSI MegaRAID controller. So I downloaded cli utility from LSI Web site, unpacked it, and install.
So, follow some tips how to manage MegaRAID Using Cli.

1. Get adapter status:
MegaCli -AdpAllInfo -aAll
Got simething like :

Adapter #0

==============================================================================
Versions
================
Product Name : ServeRAID M5015 SAS/SATA Controller
Serial No : SV13408075
FW Package Build: 12.12.0-0056

Mfg. Data
================
Mfg. Date : 08/16/11
Rework Date : 00/00/00
Revision No : 79A
Battery FRU : N/A

Image Versions in Flash:
================
FW Version : 2.120.113-1307
BIOS Version : 3.22.00_4.11.05.00_0x0501A000
Preboot CLI Version: 04.04-017:#%00008
WebBIOS Version : 6.0-40-e_35-Rel
NVDATA Version : 2.09.03-0015
Boot Block Version : 2.02.00.00-0000
BOOT Version : 09.250.01.219

Pending Images in Flash
================
None

PCI Info
================
Vendor Id : 1000
Device Id : 0079
SubVendorId : 1014
SubDeviceId : 03b2

Host Interface : PCIE
....

2. How to get disks information.
MegaCli -LDInfo -L0 -a0
Got simething like :
Adapter 0 — Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name :
RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0
Size : 278.464 GB
Mirror Data : 278.464 GB
State : Optimal
Strip Size : 128 KB
Number Of Drives : 2
Span Depth : 1
Default Cache Policy: WriteBack, ReadAhead, Cached, No Write Cache if Bad BBU
Current Cache Policy: WriteBack, ReadAhead, Cached, No Write Cache if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy : Enabled
Encryption Type : None
Is VD Cached: Yes
Cache Cade Type : Read Only

Exit Code: 0×00

3. How to get battery information:
MegaCli -AdpBbuCmd -GetBbuStatus -a0
Got something like :
BBU status for Adapter: 0

BatteryType: iBBU
Voltage: 4064 mV
Current: 0 mA
Temperature: 37 C

Battery State : Operational

BBU Firmware Status:

Charging Status : None
Voltage : OK
Temperature : OK
Learn Cycle Requested : No
Learn Cycle Active : No
Learn Cycle Status : OK
Learn Cycle Timeout : No
I2c Errors Detected : No
Battery Pack Missing : No
Battery Replacement required : Yes
Remaining Capacity Low : No
Periodic Learn Required : No
Transparent Learn : No
No space to cache offload : No
Pack is about to fail & should be replaced : No
Cache Offload premium feature required : No
Module microcode update required : No

....

4. How to enable or disable Write Cache (Attn: If you haven't battery on your controller, or bad battery write cache is HIGHLY RISK to your RAID consistency):
4.1. Force turn off BBU check:
MegaCli -LDSetProp CachedBadBBU -LALL -aALL
4.2. Turn on Write Back cache:
MegaCli -LDSetProp WB -LALL -aALL

5. If you haven't a battery and want rollback to safe method using of raid you may activate BBU checks:
MegaCli -LDSetProp NoCachedBadBBU -LALL -aALL

Ivan.

How to convert string in console to lower case

0

Today I need to work with text file which contains domains list. I just remember one method to convert (normalize) string in console. This is perfect GNU utility tr. For example:

[root@head conf]# echo “UnixPearls.COM” | tr ‘[:upper:]‘ ‘[:lower:]‘
unixpearls.com
[root@head conf]#

P.S. This is just for notes.
P.P.S. This method works on Mac OS also.

Ivan

[SOLVED] – Range header DoS vulnerability Apache HTTPD 1.3/2.x (Partial content, Range bug)

0

Due internet community report we have big hole in all apache versions, report date from 25-aug-2011 ( CVE-2011-3192 ).
Most detail you may read there: mail-archives.apache.org. Really bad news, that all systems with apache 1.3.x and apache 2.0.x, apache 2.2.x (include apache 2.2.19 )has this hole, and this really works.
Good news for me, that usually I using nginx like front-end proxy, but few projects haven’t nginx because has specific apache modules. So after testing I decide to use following solution:
1. got module from this URL http://people.apache.org/~dirkx/mod_rangecnt.c
2. compile it: /usr/local/apache/bin/apxs -i -c -n mod_rangecnt.so mod_rangecdnt.c
3. editing my httpd.conf and put string: LoadModule rangecnt_module modules/mod_rangecnt.so
4. restart apache, and all works, when trying to attack I got following in my error_log, instead denial of service
:
[Thu Aug 25 16:04:32 2011] [warn] [client 8x.xxx.xxx.xx] Rejected on a Range: header with more than 5 ranges (has 1300)
[Thu Aug 25 16:04:32 2011] [warn] [client 8x.xxx.xxx.xx] Rejected on a Range: header with more than 5 ranges (has 1300)
[Thu Aug 25 16:04:32 2011] [warn] [client 8x.xxx.xxx.xx] Rejected on a Range: header with more than 5 ranges (has 1300)
[Thu Aug 25 16:04:32 2011] [warn] [client 8x.xxx.xxx.xx] Rejected on a Range: header with more than 5 ranges (has 1300)
[Thu Aug 25 16:04:32 2011] [warn] [client 8x.xxx.xxx.xx] Rejected on a Range: header with more than 5 ranges (has 1300)

So, waiting for fix from Apache team.
Ivan

[SOLVED] Slow query execution after mysql upgrade from mysql-5.0.x to mysql-5.5.x

0

After moving one project to new server with most powerful hardware configuration and most fresh software we have a trouble with some types of queries. For example:

SELECT *,
IF((u.user_blockdate < NOW() AND u.user_unblockdate > NOW()), ’1′, ’0′) AS user_isblocked,
(
SELECT l.loan_status
FROM loans AS l
WHERE l.loan_user_id = u.user_id
ORDER BY l.loan_id DESC LIMIT 1 ) AS loan_status
FROM users AS u
WHERE LOWER(u.user_lastname) = ‘smith’ AND u.user_id <> ’54672′
ORDER BY u.user_m1, u.user_city, u.user_address

On mysql 5.0.x execution of this query take 140ms, and with most fast server with <a href=”http://www.mysql.com/why-mysql/white-papers/mysql-wp-whatsnew-mysql-55.php”>mysql 5.5.x</a> this query execution time near 4600ms and this was horrible, because we have most powerfull server. So, after googling programmer found solution:

SELECT *,
IF((u.user_blockdate < NOW() AND u.user_unblockdate > NOW()), ’1′, ’0′) AS user_isblocked,
(
SELECT l.loan_status
FROM loans AS l
FORCE INDEX (user_id)
WHERE l.loan_user_id = u.user_id
ORDER BY l.loan_id DESC LIMIT 1 ) AS loan_status
FROM users AS u
WHERE LOWER(u.user_lastname) = ‘smith’ AND u.user_id <> ’54672′
ORDER BY u.user_m1, u.user_city, u.user_address

And as result we have 120ms query execution time.

 

Ivan.

 

 

How to set custom picture on folder in Mac OS X Lion.

0

By the way one of my hobbies is a digital photography. I have Nikon D90, with couple lenses. So as result I have many images that I don’t want to import to iPhoto, but I just need to store it on external Hard Drive. In general simple way to organize images is hierarchy structure of folders, but to fast find this usually not enough. So I found additional method, I setting custom picture, one image from album to folder icon.

How folder looks in finder

Best way to do this I found in internet. This is small application from omz:software which names Telling folders.

Telling Folders Application window

This program works very simple in two steps:

Step 1: You just drug your image to Telling folders window
Step 2: After you need to drug folder to Telling folders window

So as result we have nice folder look, that this make simple navigation between folders with photos.

 

Ivan

 

Mac OS X and ImageMagick

0

For home photo archive I use gallery2 on my linux home server. I use GalleryRemote Applet for resizing and uploading photos to server. Java virtual machine is preinstalled in Mac OS X, but we haven’t Image Magick which GalleryRemote Applet use for image resizing.

So i going to ImageMagick.org, and downloading from here ImageMagick-x86_64-apple-darwin10.7.0.tar.gz to my Downloads folder.

Next step, I open terminal (Applications / System utilities / Terminal ), and unpacking package archive:

Unpacking ImageMagick

So I have ImageMagick binaries, and I need to be a root (system administrator account, to install it)

So i type in Terminal following:
sudo -s

And enter your actually Mac OS X user’s password.

Next step I need to install ImageMagick to system. I plan to put it /usr/local tree for third party software. I did following commands:

mkdir -p /usr/local/bin

mkdir -p /usr/local/lib

mkdir -p /usr/local/share

Attn: You may give error messages for example such directory already exists, this mean that you already have this directory on disk, so you need to ignore this errors.

Next, I copy ImageMagick files to /usr/local/ tree:

Copying imagemagick to /usr/local
And finish step (maybe very barbarian) make symlink to ImageMagic utilities:

Symlinking

So, now we can restart browser, and try to use GalleryRemote Applet.

Have fun.