1. replace dying hdd with spare
  2. detach the dying hdd
  3. cfgadm -c unconfigure c2::dsk/c2t1d0
    cfgadm -c configure c2::dsk/c2t1d

Start the receiver first. This listens on port 9090, has a 1GB buffer,

and uses 128kb chunks (same as zfs):

mbuffer -s 128k -m 1G -I 9090 | zfs receive data/filesystem

Now we send the data, also sending it through mbuffer:

zfs send -i data/[email protected] data/[email protected] | mbuffer -s
128k -m 1G -O

zfs send tank/[email protected] | zfs recv spool/ds01
host1# zfs send -i tank/[email protected] tank/[email protected] | ssh host2 zfs recv newtank/dana

zfs send tank/[email protected] > /bkups/gozer.083006

zfs receive tank/[email protected] < /bkups/gozer.083006

zfs rename tank/gozer tank/gozer.old

zfs rename tank/gozer2 tank/gozer

a swapfile

fallocate -l 24G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
and then in fstab
/swapfile none swap sw 0 0

every minute top

EXECUTE_ON_AVERAGE="1" # if cpu load average for last 60 secs is 
                         # greater or equal to this value, execute script
                         # change it to whatever you want :-)

while true; do
#  if [ $(echo "$(uptime | cut -d " " -f 13 | cut -d "," -f 1) >= $EXECUTE_ON_AVERAGE" | bc) = 1 ]; then
#    /usr/bin/sysdig -G 60 -W 2880 -w /root/dump.scap
if [ $(echo "$(uptime | cut -d " " -f 13 | cut -d "," -f 1) >= $EXECUTE_ON_AVERAGE" | bc) = 1 ]; then
    (/usr/bin/nvidia-smi >> /root/memlog.txt) && (/usr/bin/free -mt >> /root/memlog.txti)
#    killall -9 sysdig
  killall -9 sysdig.sh
#  sleep 60
#  sleep 60
  killall -9 sysdig.sh


for i in cat /proc/vz/veinfo | awk '{print $1}'|egrep -v '^0$'; do echo “Container $i”; vzctl exec $i “grep -i proxmox /etc/motd2 && awk ‘{if (/# rotate log files weekly/) { getline;print $1 };}’ /etc/logrotate.conf | grep weekly && sed ‘/# rotate log files weekly/{n;s/./monthly/}’ /etc/logrotate.conf > /etc/logrotate.tmp && mv -n /etc/logrotate.conf /etc/logrotate.conf.bak && mv -f /etc/logrotate.tmp /etc/logrotate.conf && sed ‘/rotate 4/{s/./rotate 12/}’ /etc/logrotate.conf > /etc/logrotate.tmp && mv -n /etc/logrotate.conf /etc/logrotate.conf.bak && mv -f /etc/logrotate.tmp /etc/logrotate.conf”; done



Three classifier programs are in the Spambayes software: a procmail filter, a POP3 proxy and a plugin for Microsoft Outlook 2000. I cover the procmail filter and the POP3 proxy in this article. A web interface (covered below) and various command-line utilities, test harnesses and so on are also part of Spambayes; see the documentation that comes with the software for full details.

Procmail-Based Setup
If you use a procmail-based e-mail system, this is how the Spambayes procmail system works:

All your existing mail has a new X-Spambayes-Trained header. The software uses this to keep track of which messages it has already learned about.

The software looks at all your incoming mail. Messages it thinks are spam are put in a “spam” mail folder. Everything else is delivered normally.

Every morning, it goes through your mail folders and trains itself on any new messages. It also picks up mail that’s been refiled—something it thought was ham but was actually spam and vice versa. Be sure to keep spam in your spam folder for at least a day or two before deleting it. We suggest keeping a few hundred messages, in case you need to retrain the software.

You’ll need a working crond to set up the daily training job. Optionally, you can have a mailbox of spam and a mailbox of ham to do some initial training.

To set up Spambayes on your procmail system, begin by installing the software. I’ll assume you’ve put it in $HOME/src/spambayes. Then, create a new database:

$HOME/src/spambayes/hammiefilter.py -n
If you exercise the option to train Spambayes on your existing mail, type:

$HOME/src/spambayes/mboxtrain.py \
-d $HOME/.hammiedb -g $HOME/Mail/inbox \
-s $HOME/Mail/spam
You can add additional folder names if you like, using -g for good mail folders and -s for spam folders. Next, you need to add the following two recipes to the top of your .procmailrc file:
| $HOME/src/spambayes/hammiefilter.py

  • ^X-Spambayes-Classification: spam
    The previous recipe is for the Maildir message format. If you need mbox (the default on many systems) or MH, the second recipe should look something like this:
  • ^X-Spambayes-Classification: spam
    If you’re not sure what format you should use, ask your system administrator. If you are the system administrator, check the documentation of your mail program. Most modern mail programs can handle both Maildir and mbox.
    Using crontab -e, add the following cron job to train Spambayes on new or refiled messages every morning at 2:21 AM:

21 2 * $HOME/src/spambayes/mboxtrain.py -d
$HOME/.hammiedb -g $HOME/Mail/inbox
-s $HOME/Mail/spam
You also can add additional folder names here. It’s important to do this if you regularly file mail in different folders; otherwise Spambayes never learns anything about those messages.

Spambayes should now be filtering all your mail and training itself on your mailboxes. But occasionally a message is misfiled. Simply move that message to the correct folder, and Spambayes learns from its mistake the next morning.

Many thanks to Neale Pickett for the information in this section.


$ cat .procmailrc

:0 HB
* Alanine|Cysteine|Glycine|Histidine
* ^From.*[email protected]
        | (formail -r -A"X-Loop: [email protected]" -I"From: [email protected]"; cat help.txt ) | $SENDMAIL -t
        | (formail -r -A"X-Loop: [email protected]" -I"From: [email protected]" -I"To: [email protected]" ; cat help.txt ) | $SENDMAIL -t

$ cat help.txt 

do you need systems help with said meeting/presentation? if so, do let us know what you need..

best regards,
liang zhu

remote access with ssh

teamviewer or ngrok are yet another vulnerability layer and crappy software from fly-by-night developers that run on our computers so lets not use them.

lets stick to openssh-server. a yum or apt-get install away.

from http://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html

assuming our home pc’s public,external, web facing ip address is, we have a user lz on the home pc and a user liangzhu in the bii pc:

on the bii pc, do
ssh -R 9000:localhost:22 [email protected]
then leave it connected and then go home

at home, on your home pc, do
ssh -p 9000 [email protected]

on your bii pc’s /etc/ssh/sshd_conf you might need to add this line

GatewayPorts yes

and do a
service sshd reload
for this to work


apt-get install cpufrequtils preload

in /etc/sysctl.conf

vm.dirty_expire_centisecs = 1000
vm.dirty_writeback_centisecs = 500
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10

in rc.local

By default this script does nothing.

echo noop > /sys/block/$DEVICE/queue/scheduler
echo 2 > /sys/block/sda/queue/rq_affinity
echo 0 > /sys/block/sda/queue/add_random
for each in 0 1; do echo performance > /sys/devices/system/cpu/cpu$each/cpufreq/scaling_governor; done

exit 0



:0 Whc: msgid.lock
| formail -D 8192 msgid.cache

#* ^(To|CC):[email protected]

# copy gmail.
* ? formail -x"From" -x"From:" -x"Sender:" \
    -x"Reply-To:" -x"Return-Path:" -x"To:" \
    | egrep -is -f ~/white.lst
[email protected]

* ? formail -x"From" -x"From:" -x"Sender:" \
    -x"Reply-To:" -x"Return-Path:" -x"To:" \
    | egrep -is -f ~/white.lst

* ? formail -x"From" -x"From:" -x"Sender:" \
    -x"Reply-To:" -x"Return-Path:" -x"To:" \
    | egrep -is -f ~/black.lst

:0c: B
* liangzhu
[email protected]

:0 B
* liangzhu

* ^Subject: Password expiring in

#:0 B
#* Please change your BII password within

#:0 B
#* If you see negative days,please change your password NOW

#* !^From.*bii.a-star.edu.sg
#* ^From.*a-star.edu.sg

# copy gmail.
[email protected]

# Spam tagged mail goes into spam folder
* ^X-Spam-Flag: YES*

# All other mail goes into the main inbox.