Monday, September 28, 2009

Thursday, September 24, 2009

Process affinity

Here is how to bind a program to a CPU (process affinity):

Bind processes to a CPU core

An example would be:

taskset -pc 0,1,2 20509

to set processid #20509 to have affinity (bind) on Cpu0, Cpu1, and Cpu2. To bind it to a single core, use the command:

taskset -pc 0 20509

to bind it to Cpu0.

Clone a virtual domU with virt-clone

Here is a simple way to clone a virtual image created with KVM, Xen, QEMU or others.

#virt-clone -o oldDomU -n newDomU -f /var/lib/xen/images/newDomU.img

You can them use xm list to see the new virtual machine:

#xm list

Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 1985 8 r----- 10566.8
oldDomU 1 999 1 -b---- 191.0
newDomU 2 999 1 -b---- 138.7

Wednesday, September 23, 2009

Manual zone transfers with dig

Transferring zones with named (bind) can be done manually with this command:

dig <master_dns_server> <zone> axfr

Example:

dig 10.1.1.6 example.com axfr

If this is run on a slave named server, /var/named/db.example.com will be updated as well if zone transfers are enabled on both servers.

Thursday, September 10, 2009

Find and replace within vi

Yes, vi is cryptic. But this command is useful for performing find and replace functions within the vi editor. First, hit ESC (escape), and the colon key (:) to get to the ex shell. Then enter:

%s/searchString/replaceString/g

An example will be:

:%s/WindowsNT/RedHatLinux/g