Table of Contents

3ware / LSI RAID controllers

LSI Megaraid controllers

Linux section (old)

Debian

apt repository: http://jonas.genannt.name/

CLI

Scripts

Auto remove b0rken drive from RAID

#!/bin/bash

TW_CLI=/usr/sbin/tw_cli
DATE_CMD=/bin/date
WEEK=$($DATE_CMD +%V | sed s/^0//)
let "DRIVE=($WEEK%2)+18"
CONTROLLER="/c0"
SHOW_RAID_STATUS="$TW_CLI $CONTROLLER show"
RAID_CHECK_CMD="$TW_CLI /c0 show allunitstatus"
REMOVE_DRIVE="$TW_CLI $CONTROLLER/p$DRIVE remove quiet"

$SHOW_RAID_STATUS

if $RAID_CHECK_CMD | grep -q 'Not Optimal Units = [^0]'; then
	echo "RAID status is not optimal. Aborting."; echo
	exit 1
fi

echo "You are about to remove VPort p$DRIVE. This will degrade RAID status!"
read -p "Are you sure? (yes/no)"
if [ "$REPLY" == "yes" ]; then
	$REMOVE_DRIVE
fi