Replace a failed disk on a 3ware RAID

I had an old Debian GNU/Linux system with a 3ware RAID controller. Having to figure out how to properly replace the failed disk was a pain. You can manipulate the RAID array, without rebooting to the controller bios, with the 3waretwi_cli command line tool.

For this example, we will assume that port6 on the first controller has failed. Tell the controller to remove the disk, then physically remove the disk:
# ./tw_cli /c0/p6 remove

Now physically insert your replacement disk and scan for it:
# ./tw_cli /c0 show
# ./tw_cli /c0 rescan

Issue the command to start rebuilding the array onto the new disk in port6:
# ./tw_cli /c0/u0 start rebuild disk=p6 ignoreECC

If you need to, pause and resume the rebuild:
# ./tw_cli /c0/u0 pause rebuild
# ./tw_cli /c0/u0 resume rebuild

Check the rebuild progress and RAID health:
# ./tw_cli /c0 show

##### FOR WINDOWS #####

./tw_cli maint rebuild c1 u0 p2

Mailq Check

<pre class=”brush:shell”>#!/bin/sh

fila_post=`postqueue -p |grep -e “^[A-Z,0-9]” | grep -v “Mail” |wc -l`

if [ $fila_post -gt $warn ]; then
if [ $fila_post -le $crit ]; then
echo “WARNING: postqueue -p -> $fila_post”
exit 1
if [ $fila_post -gt $crit ]; then
echo “CRITICAL: postqueue -p > $fila_post”
exit 2
if [ $fila_post -le $warn ]; then

echo “OK: postqueue -p -> $fila_post”
exit 0
<div style=”clear: both;”></div>

<div class=”pages_navigation”>


Tips and Tricks from Pesho

mount -t msdosfs -o large,-M=755 /dev/da0s1 temp/
tr -d \r < dosfile > newfile ===premahva bad charovete ot dos file
tr -d ‘”‘ <filename >newfilename — premahva ”
while IFS= read -r file; do rm — “$file”; done < filelist
sed ‘/define hostgroup/{N;N;N;d;}’ $i>$ && mv $ $i — namira i iztriva 3 reda sled tova 🙂
root@Microknoppix:~# ssh pstankov@hosting dd if=/dev/sdb2 |dd of=/dev/sda2
mailq |grep -i 0-|cut -f 1 -d “*”|postsuper -d –
dns hitrini za load balance
check and repair all tables
mysqlcheck –all-databases -u root -p
mdconfig -a -t vnode -f /usr/space/work/proxmox-ve_1.9-6542-7.iso -u 1
[root@darksun ~]# mount -t cd9660 /dev/md1 /mnt/temp/
import -window root screenshot1.png – printscreena
find . -name ‘spam-*’ | xargs rm

pw lock vivek
pw unlock vivek
karmic ubuntu


ipfw + fail2ban – FreeBSD

Fail2ban + ipfw = Джилязо

Вери много важно – f2b на freebsd има бъг с името на затворите, ако има “-” в името примерно ssh-ipfw, не работи :), затова sshipfw, да ти е мирна главицата!

Install fail2ban on freebsd

cd /usr/ports/security/py-fail2ban
make install clean
echo ‘fail2ban_enable=”YES”‘ >> /etc/rc.conf

Create table in ipfw for F2B

ipfw table 10 add
ipfw add 1 deny ip from table(10) to me

Must create action for ipfw in f2b action.d/ipfw.con to know how to deal with the spammers

actionban = ipfw table 10 add
actionunban = ipfw table 10 delete

jail.conf setting

ignoreip =
bantime = 35600

enabled = true
filter = ipfw-ssh
action = ipfw-ssh[localhost=]
logpath = /var/log/auth.log
maxretry = 3

enabled = true
filter = postfix
action = mail[localhost=]
sendmail-whois[name=”Postfix jail”,]
logpath = /var/log/maillog
maxretry = 4

enabled = true
filter = dovecot
action = mail[localhost=]
sendmail-whois[name=”Dovecot mail jail”,]
logpath = /var/log/maillog
maxretry = 4