Enable jail quota using ZFS on FreeBSD
ZFS is best described here http://en.wikipedia.org/wiki/ZFS 1) Create the pool 1mkdir -p /raw/tank && dd if=/dev/null of=/raw/tank/disk0 bs=1m seek=30720 && zpool create tank /raw/tank/disk0 2) Mount the pool 1zfs create -omountpoint=/jails tank/jails 3) Create jail in tank/jails 12zfs create tank/jails/jailname zfs create -oquota=1G tank/jails/jailname 4) Migrate Jails 123rsync <switches> /usr/jails/jail01/ /tank/jails/jail01/ example: rsync -azqrv /usr/jails/vivek/ [...]
Delete partition table using `dd`
The hard disk can be devided in more logical disks called partitions or slices under *BSD. The division of these partitions is found on the first sector of the disk (sector 0). In case you want to make your disk partition unusable, you could use dd. dd is well described on *nix systems and can [...]
HE ipv6 tunnel configuration FreeBSD
This howto explains how to configure IPv6 tunnel provided by Hurricane Electric on a FreeBSD system. Configure the HE side 1) Create an account using this link http://tunnelbroker.net/ 2) After creating the account select the “IPv6 Tunnel” tab and provide the necessary details. See the example below 3) Click on the “Example Configuration” tab. Choose [...]
backup retention script
Backups are important. Not keeping all backups is equallity important. Especially when you are taking backups of big databases, and you don’t have enough space to keep 500TB of data backups. Therefore I wrote a script that deletes old backups. I wanted to keep at least one back up / quarter for serveral years (untill [...]
Glance
Glance is one of the three main cloud solutions of OpenStack Installing glance On an Ubuntu system you could run: Once installed you can run glance as follow: After starting Glance service, virtual disks can be added to it’s database. The command ‘glance index’ shows all availiable images It tells you no images are found. [...]
BASH one liners
Find files within a specific directory 1files=(); while IFS= read -rd ” f; do files+=("$f"); done < <(find /var/lib/libvirt -name ‘ubuntu-*’ -print0) Find a certain pattern within files. E.g we’ll search for the pattern ‘hostname’ within /etc directory 1find /etc/ -type f -print0 | xargs -0 grep "hostname" –color=AUTO Change certain pattern in bunch of [...]
How to run your scripts more than once per minute?
For a client I needed to run a specific script every 10seconds. 24/24 and 7/7. A task I would normally perform with crons. But sadly enough, a cron can only be started once per minute. So I wrote a ‘runner’ script. A script that starts the other script
DB2 Database backup
123456789101112131415161718#!/bin/bash –login #diagnostic start date "+START dwhdev – TTS: %Y-%m-%d% %H:%M:%S" >> /tempspace/backup/backup.log #remove previous backup source /db2home/db2db011/sqllib/db2profile rm /tempspace/backup/db2db011/dwhdev/DWHDEV* -f /db2home/db2db011/sqllib/bin/db2 CONNECT TO dwhdev /db2home/db2db011/sqllib/bin/db2 QUIESCE DATABASE IMMEDIATE FORCE CONNECTIONS /db2home/db2db011/sqllib/bin/db2 UNQUIESCE DATABASE /db2home/db2db011/sqllib/bin/db2 TERMINATE /db2home/db2db011/sqllib/bin/db2 DEACTIVATE DATABASE dwhdev /db2home/db2db011/sqllib/bin/db2 BACKUP DATABASE dwhdev TO /tempspace/backup/db2db011/dwhdev COMPRESS /db2home/db2db011/sqllib/bin/db2 ACTIVATE DATABASE dwhdev # copy contents of [...]
Monitoring file / db2 / partition size
Sometimes your monitoring tools tell you something is wrong. But of course you need / want some extra tools when going on investigation. A first point should be the logs. But there is more you can do. If your monitoring tells you that the size of your database, or partition, or something else is jumping [...]
Create Virtual Machine using virt-install
Many people sometimes can’t recall the command line parameters of virt-install to create virtual machines under KVM. This bash script will help you create a virtual machine without having to remember any parameter. Of course you can modify the script to suit your needs. Just copy and paste this script into a file on your [...]

