MP3 Encoder LAME

Friday, September 4, 2009 |







I was planning a trip to Virginia beach on this long weekend. As I am traveling alone (nothing unusual.. am a lonely wanderer), music is best way to keep myself up. I had bunch of music files on my lappy, copied from Abhyant's music collection. Grrrrrr... all of these were in .wav and .aiff format. I was looking for a tool to do the conversion. Lovely tool LAME here to help me.


bbaby@luttappi:~/Songs-Abhyant/CD2$ for i in *.aiff; do j=`echo $i | sed -e 's/\.aiff/.mp3/'`; lame -b 128 -B 256 --vbr-new $i /home/bbaby/ToCD/cd2/$j;done;

I got the files in new folder. Ready to go :)

PostgreSQL Installation

Monday, August 10, 2009 |


I have started using Postgresql database from today. In my limited DB knowledge itself, I was able make out the strength of this open source DB. Unlike MySQL, its tough to get clear cut documentation about Postgres from a single source. I have installed Postgres on my devel box running on Ubuntu 9.04 (64 bit edition) . Here is the logs from my console.

1. Installation:
****************
root@luttappi:~/perl# apt-get install postgresql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libpq5 postgresql-8.3 postgresql-client-8.3 postgresql-client-common postgresql-common
Suggested packages:
oidentd ident-server postgresql-doc-8.3
The following NEW packages will be installed:
libpq5 postgresql postgresql-8.3 postgresql-client-8.3 postgresql-client-common postgresql-common
0 upgraded, 6 newly installed, 0 to remove and 184 not upgraded.
Need to get 5245kB of archives.
After this operation, 21.4MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
<---- snipped ---------->

2. Testing the Installation:
*****************************
root@luttappi:~/perl# su - postgres
postgres@luttappi:~$ psql template1
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

template1=#
template1=# \l
List of databases
Name | Owner | Encoding
-----------+----------+----------
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(3 rows)

template1=# \q
postgres@luttappi:~$

3. New User addition
************************
root@luttappi:~/perl# useradd mayavi
root@luttappi:~/perl# passwd mayavi
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

root@luttappi:~/perl# su - postgres
postgres@luttappi:~$ psql template1
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

template1=# CREATE USER mayavi WITH PASSWORD 'password';
CREATE ROLE

template1=# create database kuttoosan;
CREATE DATABASE

template1=# GRANT ALL PRIVILEGES ON DATABASE kuttoosan to mayavi;
GRANT
template1=#

root@luttappi:~/perl# su - mayavi
mayavi@luttappi:~$ psql -d kuttoosan -U mayavi
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

kuttoosan=>


4. Installing perl db modules:
*********************************
root@luttappi:~# apt-get install libapache2-mod-perl2 apache2 libdbi-perl libdbd-pg-perl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-mpm-worker apache2-utils apache2.2-common libapache2-reload-perl libapr1 libaprutil1 libbsd-resource-perl libdevel-symdump-perl libmysqlclient15off libnet-daemon-perl libplrpc-perl
mysql-common
Suggested packages:
apache2-doc apache2-suexec apache2-suexec-custom dbishell
The following NEW packages will be installed:
apache2 apache2-mpm-worker apache2-utils apache2.2-common libapache2-mod-perl2 libapache2-reload-perl libapr1 libaprutil1 libbsd-resource-perl libdbd-pg-perl libdbi-perl libdevel-symdump-perl
libmysqlclient15off libnet-daemon-perl libplrpc-perl mysql-common
0 upgraded, 16 newly installed, 0 to remove and 184 not upgraded.
Need to get 5719kB of archives.
After this operation, 17.4MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://us.archive.ubuntu.com jaunty-updates/main libapr1 1.2.12-5ubuntu0.1 [114kB]
Get:2 http://us.archive.ubuntu.com jaunty-updates/main mysql-common 5.1.30really5.0.75-0ubuntu10.2 [62.9kB]
Get:3 http://us.archive.ubuntu.com jaunty-updates/main libmysqlclient15off 5.1.30really5.0.75-0ubuntu10.2 [1878kB]
Get:4 http://us.archive.ubuntu.com jaunty-updates/main libaprutil1 1.2.12+dfsg-8ubuntu0.3 [79.1kB]
Get:5 http://us.archive.ubuntu.com jaunty-updates/main apache2-utils 2.2.11-2ubuntu2.2 [151kB]
Get:6 http://us.archive.ubuntu.com jaunty-updates/main apache2.2-common 2.2.11-2ubuntu2.2 [827kB]
Get:7 http://us.archive.ubuntu.com jaunty-updates/main apache2-mpm-worker 2.2.11-2ubuntu2.2 [258kB]
Get:8 http://us.archive.ubuntu.com jaunty-updates/main apache2 2.2.11-2ubuntu2.2 [46.3kB]
Get:9 http://us.archive.ubuntu.com jaunty/main libdevel-symdump-perl 2.08-1 [16.4kB]
Get:10 http://us.archive.ubuntu.com jaunty/main libapache2-mod-perl2 2.0.4-5ubuntu1 [1147kB]
Get:11 http://us.archive.ubuntu.com jaunty/main libapache2-reload-perl 0.10-2 [19.9kB]
Get:12 http://us.archive.ubuntu.com jaunty/main libnet-daemon-perl 0.43-1 [46.9kB]
Get:13 http://us.archive.ubuntu.com jaunty/main libplrpc-perl 0.2020-1 [36.0kB]
Get:14 http://us.archive.ubuntu.com jaunty/main libdbi-perl 1.607-1 [793kB]
Get:15 http://us.archive.ubuntu.com jaunty/universe libdbd-pg-perl 2.11.7-1 [212kB]
Get:16 http://us.archive.ubuntu.com jaunty/main libbsd-resource-perl 1.2901-1 [31.8kB]
Fetched 5719kB in 10s (523kB/s)
Selecting previously deselected package libapr1.
(Reading database ... 103255 files and directories currently installed.)
Unpacking libapr1 (from .../libapr1_1.2.12-5ubuntu0.1_amd64.deb) ...
Selecting previously deselected package mysql-common.
Unpacking mysql-common (from .../mysql-common_5.1.30really5.0.75-0ubuntu10.2_all.deb) ...
Selecting previously deselected package libmysqlclient15off.
Unpacking libmysqlclient15off (from .../libmysqlclient15off_5.1.30really5.0.75-0ubuntu10.2_amd64.deb) ...
Selecting previously deselected package libaprutil1.
Unpacking libaprutil1 (from .../libaprutil1_1.2.12+dfsg-8ubuntu0.3_amd64.deb) ...
Selecting previously deselected package apache2-utils.
Unpacking apache2-utils (from .../apache2-utils_2.2.11-2ubuntu2.2_amd64.deb) ...
Selecting previously deselected package apache2.2-common.
Unpacking apache2.2-common (from .../apache2.2-common_2.2.11-2ubuntu2.2_amd64.deb) ...
Selecting previously deselected package apache2-mpm-worker.
Unpacking apache2-mpm-worker (from .../apache2-mpm-worker_2.2.11-2ubuntu2.2_amd64.deb) ...
Selecting previously deselected package apache2.
Unpacking apache2 (from .../apache2_2.2.11-2ubuntu2.2_all.deb) ...
Selecting previously deselected package libdevel-symdump-perl.
Unpacking libdevel-symdump-perl (from .../libdevel-symdump-perl_2.08-1_all.deb) ...
Selecting previously deselected package libapache2-mod-perl2.
Unpacking libapache2-mod-perl2 (from .../libapache2-mod-perl2_2.0.4-5ubuntu1_amd64.deb) ...
Selecting previously deselected package libapache2-reload-perl.
Unpacking libapache2-reload-perl (from .../libapache2-reload-perl_0.10-2_all.deb) ...
Selecting previously deselected package libnet-daemon-perl.
Unpacking libnet-daemon-perl (from .../libnet-daemon-perl_0.43-1_all.deb) ...
Selecting previously deselected package libplrpc-perl.
Unpacking libplrpc-perl (from .../libplrpc-perl_0.2020-1_all.deb) ...
Selecting previously deselected package libdbi-perl.
Unpacking libdbi-perl (from .../libdbi-perl_1.607-1_amd64.deb) ...
Selecting previously deselected package libdbd-pg-perl.
Unpacking libdbd-pg-perl (from .../libdbd-pg-perl_2.11.7-1_amd64.deb) ...
Selecting previously deselected package libbsd-resource-perl.
Unpacking libbsd-resource-perl (from .../libbsd-resource-perl_1.2901-1_amd64.deb) ...
Processing triggers for man-db ...
Processing triggers for ufw ...
Setting up libapr1 (1.2.12-5ubuntu0.1) ...

Setting up mysql-common (5.1.30really5.0.75-0ubuntu10.2) ...
Setting up libmysqlclient15off (5.1.30really5.0.75-0ubuntu10.2) ...

Setting up libaprutil1 (1.2.12+dfsg-8ubuntu0.3) ...

Setting up apache2-utils (2.2.11-2ubuntu2.2) ...
Setting up apache2.2-common (2.2.11-2ubuntu2.2) ...
Enabling site default.
Enabling module alias.
Enabling module autoindex.
Enabling module dir.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module status.
Enabling module auth_basic.
Enabling module deflate.
Enabling module authz_default.
Enabling module authz_user.
Enabling module authz_groupfile.
Enabling module authn_file.
Enabling module authz_host.

Setting up apache2-mpm-worker (2.2.11-2ubuntu2.2) ...
* Starting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
...done.

Setting up apache2 (2.2.11-2ubuntu2.2) ...
Setting up libdevel-symdump-perl (2.08-1) ...
Setting up libapache2-mod-perl2 (2.0.4-5ubuntu1) ...
Enabling module perl.
Run '/etc/init.d/apache2 restart' to activate new configuration!

Setting up libapache2-reload-perl (0.10-2) ...
Setting up libnet-daemon-perl (0.43-1) ...
Setting up libplrpc-perl (0.2020-1) ...
Setting up libdbi-perl (1.607-1) ...
Setting up libdbd-pg-perl (2.11.7-1) ...
Setting up libbsd-resource-perl (1.2901-1) ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
root@luttappi:~#


5. Web based administration - PhpPgAdmin
***********************************************
root@luttappi:~# apt-get install phppgadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 php5-common php5-pgsql postgresql-doc postgresql-doc-8.3
Suggested packages:
php-pear slony1-bin
The following packages will be REMOVED:
apache2-mpm-worker
The following NEW packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 php5-common php5-pgsql phppgadmin postgresql-doc postgresql-doc-8.3
0 upgraded, 7 newly installed, 1 to remove and 184 not upgraded.
Need to get 6157kB of archives.
After this operation, 24.1MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://us.archive.ubuntu.com jaunty-updates/main apache2-mpm-prefork 2.2.11-2ubuntu2.2 [253kB]
Get:2 http://us.archive.ubuntu.com jaunty-updates/main php5-common 5.2.6.dfsg.1-3ubuntu4.1 [372kB]
Get:3 http://us.archive.ubuntu.com jaunty-updates/main libapache2-mod-php5 5.2.6.dfsg.1-3ubuntu4.1 [2615kB]
Get:4 http://us.archive.ubuntu.com jaunty-updates/main php5-pgsql 5.2.6.dfsg.1-3ubuntu4.1 [57.8kB]
Get:5 http://us.archive.ubuntu.com jaunty/main postgresql-doc-8.3 8.3.7-1 [1963kB]
Get:6 http://us.archive.ubuntu.com jaunty/main postgresql-doc 8.3.7-1 [3408B]
Get:7 http://us.archive.ubuntu.com jaunty/universe phppgadmin 4.2.2-1 [894kB]
Fetched 6157kB in 13s (463kB/s)
dpkg: apache2-mpm-worker: dependency problems, but removing anyway as you request:
apache2 depends on apache2-mpm-worker (>= 2.2.11-2ubuntu2.2) | apache2-mpm-prefork (>= 2.2.11-2ubuntu2.2) | apache2-mpm-event (>= 2.2.11-2ubuntu2.2); however:
Package apache2-mpm-worker is to be removed.
Package apache2-mpm-prefork is not installed.
Package apache2-mpm-event is not installed.
(Reading database ... 104442 files and directories currently installed.)
Removing apache2-mpm-worker ...
* Stopping web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting ...done.
Selecting previously deselected package apache2-mpm-prefork.
(Reading database ... 104434 files and directories currently installed.)
Unpacking apache2-mpm-prefork (from .../apache2-mpm-prefork_2.2.11-2ubuntu2.2_amd64.deb) ...
Selecting previously deselected package php5-common.
Unpacking php5-common (from .../php5-common_5.2.6.dfsg.1-3ubuntu4.1_amd64.deb) ...
Selecting previously deselected package libapache2-mod-php5.
Unpacking libapache2-mod-php5 (from .../libapache2-mod-php5_5.2.6.dfsg.1-3ubuntu4.1_amd64.deb) ...
Selecting previously deselected package php5-pgsql.
Unpacking php5-pgsql (from .../php5-pgsql_5.2.6.dfsg.1-3ubuntu4.1_amd64.deb) ...
Selecting previously deselected package postgresql-doc-8.3.
Unpacking postgresql-doc-8.3 (from .../postgresql-doc-8.3_8.3.7-1_all.deb) ...
Selecting previously deselected package postgresql-doc.
Unpacking postgresql-doc (from .../postgresql-doc_8.3.7-1_all.deb) ...
Selecting previously deselected package phppgadmin.
Unpacking phppgadmin (from .../phppgadmin_4.2.2-1_all.deb) ...
Processing triggers for doc-base ...
Processing 23 changed, 1 added doc-base file(s)...
Registering documents with scrollkeeper...
Setting up apache2-mpm-prefork (2.2.11-2ubuntu2.2) ...
* Starting web server apache2
apache2: Syntax error on line 278 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/conf.d/phppgadmin: No such file or directory
...fail!
invoke-rc.d: initscript apache2, action "start" failed.

Setting up php5-common (5.2.6.dfsg.1-3ubuntu4.1) ...
Setting up libapache2-mod-php5 (5.2.6.dfsg.1-3ubuntu4.1) ...

Creating config file /etc/php5/apache2/php.ini with new version
Your apache2 configuration is broken, so we're not restarting it for you.

Setting up php5-pgsql (5.2.6.dfsg.1-3ubuntu4.1) ...

Setting up postgresql-doc-8.3 (8.3.7-1) ...

Setting up postgresql-doc (8.3.7-1) ...
Setting up phppgadmin (4.2.2-1) ...
* Reloading web server config apache2
root@luttappi:~#

6. PhpPgAdmin configuration file:
**************************************

root@luttappi:/usr/share/phppgadmin/conf# pwd
/usr/share/phppgadmin/conf
root@luttappi:/usr/share/phppgadmin/conf# ls -l config.inc.php
lrwxrwxrwx 1 root root 30 2009-08-10 13:24 config.inc.php -> /etc/phppgadmin/config.inc.php
root@luttappi:/usr/share/phppgadmin/conf#

7. Access:
************
http://localhost/phppgadmin

Menu Based - Time changing Script

Tuesday, July 7, 2009 |

I was working with few testers who need to change the system time occasionally on a linux box. Most of the time, they had problem while issuing the date command. Below one is a menu based shell script to update time on a linux box (xen guest in this case)

#!/bin/bash

Author : basil@
Purpose : Menu based date/time change of Linux boxes with ntpdate
Date : 04-20-2009

# Below kernel parameter is to allow xen guest take independent decision about its clock.

echo 1 > /proc/sys/xen/independent_wallclock

while :
do
clear
echo "-------------------------------------"
echo " Main Menu "
echo "-------------------------------------"
echo "[1] Show Todays date/time"
echo "[2] Change System time"
echo "[3] Show calendar"
echo "[4] Change System time to Current time"
echo "[5] Exit/Stop"
echo "======================="
echo -n "Enter your menu choice [1-5]: "
read yourch

case $yourch in
1) echo "Today is `date` , press Enter/Return key. . ." ; read ;;
2) echo "Enter new date and time [Format: MMDDHHMMYYYY]: ";read newtime ; date $newtime;echo "Today is `date`, , press Enter/Return key. . ." ; read ;;
3) /usr/bin/cal; echo "Press a key. . ." ; read ;;
4) echo "Updating to Current time..."; `/usr/sbin/ntpdate -s clock.redhat.com`;echo "Today is `date`, , press Enter/Return key. . ." ; read ;;
5) exit 0 ;;
*) echo "Opps!!! Please select choice 1,2,3 or 4";
echo "Press Enter/Return key. . ." ; read ;;

esac
done

Time Sync issues - VMware Guest Hosts

Monday, July 6, 2009 |




I was damn tired of time sync issues related to guest hosts running on top of VMware ESX 3.5 host. Even though I have installed ntp client on all the servers, but still the guest OS's are running out of Sync.





NTP Recommendations

Note: In all cases use NTP instead of VMware Tools periodic time synchronization. Also, you may need to open the firewall (UPD 123) to allow NTP traffic.
The following is a sample /etc/ntp.conf :
tinker panic 0
restrict 127.0.0.1
restrict default kod nomodify notrap
server 0.vmware.pool.ntp.org
server 1.vmware.pool.ntp.org
server 2.vmware.pool.ntp.org
driftfile /var/lib/ntp/drift
The following is a sample /etc/ntp/step-tickers :
0.vmware.pool.ntp.org
1.vmware.pool.ntp.org
The configuration directive tinker panic 0 instructs NTP not to give up if it sees a large jump in time. This is important for coping with large time drifts and also resuming virtual machines from their suspended state.
Note: The directive tinker panic 0 must be at the top of the ntp.conf file.
It is also important not to use the local clock as a time source, often referred to as the Undisciplined Local Clock. NTP has a tendency to fall back to this in preference to the remote servers when there is a large amount of time drift.
An example of such a configuration is:
server 127.127.1.0
fudge 127.127.1.0 stratum 10
Comment out both lines.
After making changes to NTP configuration, the NTP daemon must be restarted. Refer to your operating system vendor’s documentation.

VMware Tools time synchronization configuration

When using NTP in the guest, disable VMware Tools periodic time synchronization.
To disable VMware Tools periodic time sync you use one of the following options:
  1. Set tools.syncTime = "0" in the configuration file (.vmx file) of the virtual machine.

    OR

  2. Deselect Time synchronization between the virtual machine and the host operating system in the VMware Tools toolbox GUI of the guest operating system.

    OR

  3. Run the vmware-guestd --cmd "vmx.set_option synctime 1 0" command in the guest operating system.
These options do not disable one-time synchronizations done by VMware Tools for events such as tools startup, taking a snapshot, resuming from a snapshot, resuming from suspend, or VMotion. These events synchronize time in the guest operating system with time in the host operating system, so it is important to make sure that the host operating system's time is correct.
To do this for VMware ACE, VMware Fusion, VMware GSX Server, VMware Player, VMware Server, and VMware Workstation run time synchronization software such as NTP or w32time in the host. For VMware ESX run NTP in the service console. For VMware ESXi, run NTP in the VMkernel.

Virtual Hardware clock configuration

When configuring the Linux guest operating system, if you are given a choice between keeping the “hardware” clock (that is, the virtual CMOS time of day clock) in UTC or local time, choose UTC. This avoids any confusion when your local time changes between standard and daylight saving time (in England, "summer time").


64bit Kernels

Linux Flavor
Version
Kernel Parameters
Notes
RHEL

RHEL 5.3 notsc divider=10
RHEL 5.2
notsc divider=10
RHEL 5.1 with RHSA-2007:0993-13
notsc divider=10
RHEL 5.1 without RHSA-2007:0993-13
notsc


32bit Kernels

Linux Flavor Version Kernel Parameters Notes
RHEL



RHEL 5.3 divider=10 clocksource=acpi_pm

RHEL 5.2 divider=10 clocksource=acpi_pm

RHEL 5.1 divider=10 clocksource=acpi_pm

RHEL 5.0 clocksource=acpi_pm

Editing Kernel Configuration

Kernel command line parameters are specified in the /etc/lilo.conf or /boot/grub/grub.conf file, depending on your choice of boot loader.

For LILO, put the kernel command line parameters at the end of the "append" line. For example, if the append line looks like:

append="resume=/dev/hda6 splash=silent"

and you want to add "clock=pmtmr divider=10" the updated text is:

append="resume=/dev/hda6 splash=silent clock=pmtmr divider=10"

Remember to run /sbin/lilo after editing lilo.conf , so that your edits take effect.

For GRUB, put the kernel command line parameters at the end of the "kernel" line. For example if the kernel line looks like:

kernel /vmlinuz-2.6.18 ro root=/dev/hda2

and you want to add "clock=pmtmr divider=10" the updated text is:

kernel /vmlinuz-2.6.18 ro root=/dev/hda2 clock=pmtmr divider=10


Below given is the best practice, for time related issues on VMware guests.

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006427

TCP - CONNECTION

Wednesday, June 17, 2009 |

Connection State Definition:
----------------------------------

ESTABLISHED – both hosts are connected
CLOSING – the remote host is closing the connection
LISTENING – the host is listening for incoming connections
SYN_RCVD – a remote host has asked to start a connection
SYN_SENT – the host is starting a new connection
LAST_ACK – the host must send a report before closing the connection
TIMED_WAIT, CLOSE_WAIT – a remote host is terminating the connection
FIN_WAIT 1 – the client is terminating the connection
FIN_WAIT 2 – both hosts are closing the connection

TCP cutter : http://www.cyberciti.biz/tips/cutting-the-tcpip-network-connection-with-cutter.html
TCPKILL : http://www.cyberciti.biz/howto/question/linux/kill-tcp-connection-using-linux-netstat.php

Parameters which can be configured on Kernel:
-----------------------------------------------------------

From the link :http://www.cs.uwaterloo.ca/~brecht/servers/ip-sysctl.txt

/proc/sys/net/ipv4/* Variables:

ip_forward - BOOLEAN
0 - disabled (default)
not 0 - enabled

Forward Packets between interfaces.

This variable is special, its change resets all configuration
parameters to their default state (RFC1122 for hosts, RFC1812
for routers)

ip_default_ttl - INTEGER
default 64

ip_no_pmtu_disc - BOOLEAN
Disable Path MTU Discovery.
default FALSE

IP Fragmentation:

ipfrag_high_thresh - INTEGER
Maximum memory used to reassemble IP fragments. When
ipfrag_high_thresh bytes of memory is allocated for this purpose,
the fragment handler will toss packets until ipfrag_low_thresh
is reached.

ipfrag_low_thresh - INTEGER
See ipfrag_high_thresh

ipfrag_time - INTEGER
Time in seconds to keep an IP fragment in memory.

INET peer storage:

inet_peer_threshold - INTEGER
The approximate size of the storage. Starting from this threshold
entries will be thrown aggressively. This threshold also determines
entries' time-to-live and time intervals between garbage collection
passes. More entries, less time-to-live, less GC interval.

inet_peer_minttl - INTEGER
Minimum time-to-live of entries. Should be enough to cover fragment
time-to-live on the reassembling side. This minimum time-to-live is
guaranteed if the pool size is less than inet_peer_threshold.
Measured in jiffies.

inet_peer_maxttl - INTEGER
Maximum time-to-live of entries. Unused entries will expire after
this period of time if there is no memory pressure on the pool (i.e.
when the number of entries in the pool is very small).
Measured in jiffies.

inet_peer_gc_mintime - INTEGER
Minimum interval between garbage collection passes. This interval is
in effect under high memory pressure on the pool.
Measured in jiffies.

inet_peer_gc_maxtime - INTEGER
Minimum interval between garbage collection passes. This interval is
in effect under low (or absent) memory pressure on the pool.
Measured in jiffies.

TCP variables:

tcp_syn_retries - INTEGER
Number of times initial SYNs for an active TCP connection attempt
will be retransmitted. Should not be higher than 255. Default value
is 5, which corresponds to ~180seconds.

tcp_synack_retries - INTEGER
Number of times SYNACKs for a passive TCP connection attempt will
be retransmitted. Should not be higher than 255. Default value
is 5, which corresponds to ~180seconds.

tcp_keepalive_time - INTEGER
How often TCP sends out keepalive messages when keepalive is enabled.
Default: 2hours.

tcp_keepalive_probes - INTEGER
How many keepalive probes TCP sends out, until it decides that the
connection is broken. Default value: 9.

tcp_keepalive_interval - INTEGER
How frequently the probes are send out. Multiplied by
tcp_keepalive_probes it is time to kill not responding connection,
after probes started. Default value: 75sec i.e. connection
will be aborted after ~11 minutes of retries.

tcp_retries1 - INTEGER
How many times to retry before deciding that something is wrong
and it is necessary to report this suspection to network layer.
Minimal RFC value is 3, it is default, which corresponds
to ~3sec-8min depending on RTO.

tcp_retries2 - INTEGER
How may times to retry before killing alive TCP connection.
RFC1122 says that the limit should be longer than 100 sec.
It is too small number. Default value 15 corresponds to ~13-30min
depending on RTO.

tcp_orphan_retries - INTEGER
How may times to retry before killing TCP connection, closed
by our side. Default value 7 corresponds to ~50sec-16min
depending on RTO. If you machine is loaded WEB server,
you should think about lowering this value, such sockets
may consume significant resources. Cf. tcp_max_orphans.

tcp_fin_timeout - INTEGER
Time to hold socket in state FIN-WAIT-2, if it was closed
by our side. Peer can be broken and never close its side,
or even died unexpectedly. Default value is 60sec.
Usual value used in 2.2 was 180 seconds, you may restore
it, but remember that if your machine is even underloaded WEB server,
you risk to overflow memory with kilotons of dead sockets,
FIN-WAIT-2 sockets are less dangerous than FIN-WAIT-1,
because they eat maximum 1.5K of memory, but they tend
to live longer. Cf. tcp_max_orphans.

tcp_max_tw_buckets - INTEGER
Maximal number of timewait sockets held by system simultaneously.
If this number is exceeded time-wait socket is immediately destroyed
and warning is printed. This limit exists only to prevent
simple DoS attacks, you _must_ not lower the limit artificially,
but rather increase it (probably, after increasing installed memory),
if network conditions require more than default value.

tcp_tw_recycle - BOOLEAN
Enable fast recycling TIME-WAIT sockets. Default value is 1.
It should not be changed without advice/request of technical
experts.

tcp_max_orphans - INTEGER
Maximal number of TCP sockets not attached to any user file handle,
held by system. If this number is exceeded orphaned connections are
reset immediately and warning is printed. This limit exists
only to prevent simple DoS attacks, you _must_ not rely on this
or lower the limit artificially, but rather increase it
(probably, after increasing installed memory),
if network conditions require more than default value,
and tune network services to linger and kill such states
more aggressively. Let me to remind again: each orphan eats
up to ~64K of unswappable memory.

tcp_abort_on_overflow - BOOLEAN
If listening service is too slow to accept new connections,
reset them. Default state is FALSE. It means that if overflow
occurred due to a burst, connection will recover. Enable this
option _only_ if you are really sure that listening daemon
cannot be tuned to accept connections faster. Enabling this
option can harm clients of your server.

tcp_syncookies - BOOLEAN
Only valid when the kernel was compiled with CONFIG_SYNCOOKIES
Send out syncookies when the syn backlog queue of a socket
overflows. This is to prevent against the common 'syn flood attack'
Default: FALSE

Note, that syncookies is fallback facility.
It MUST NOT be used to help highly loaded servers to stand
against legal connection rate. If you see synflood warnings
in your logs, but investigation shows that they occur
because of overload with legal connections, you should tune
another parameters until this warning disappear.
See: tcp_max_syn_backlog, tcp_synack_retries, tcp_abort_on_overflow.

syncookies seriously violate TCP protocol, do not allow
to use TCP extensions, can result in serious degradation
of some services (f.e. SMTP relaying), visible not by you,
but your clients and relays, contacting you. While you see
synflood warnings in logs not being really flooded, your server
is seriously misconfigured.

tcp_stdurg - BOOLEAN
Use the Host requirements interpretation of the TCP urg pointer field.
Most hosts use the older BSD interpretation, so if you turn this on
Linux might not communicate correctly with them.
Default: FALSE

tcp_max_syn_backlog - INTEGER
Maximal number of remembered connection requests, which are
still did not receive an acknowledgement from connecting client.
Default value is 1024 for systems with more than 128Mb of memory,
and 128 for low memory machines. If server suffers of overload,
try to increase this number. Warning! If you make it greater
than 1024, it would be better to change TCP_SYNQ_HSIZE in
include/net/tcp.h to keep TCP_SYNQ_HSIZE*16<=tcp_max_syn_backlog
and to recompile kernel.

tcp_window_scaling - BOOLEAN
Enable window scaling as defined in RFC1323.

tcp_timestamps - BOOLEAN
Enable timestamps as defined in RFC1323.

tcp_sack - BOOLEAN
Enable select acknowledgments (SACKS).

tcp_fack - BOOLEAN
Enable FACK congestion avoidance and fast restransmission.
The value is not used, if tcp_sack is not enabled.

tcp_dsack - BOOLEAN
Allows TCP to send "duplicate" SACKs.

tcp_ecn - BOOLEAN
Enable Explicit Congestion Notification in TCP.

tcp_reordering - INTEGER
Maximal reordering of packets in a TCP stream.
Default: 3

tcp_retrans_collapse - BOOLEAN
Bug-to-bug compatibility with some broken printers.
On retransmit try to send bigger packets to work around bugs in
certain TCP stacks.

tcp_wmem - vector of 3 INTEGERs: min, default, max
min: Amount of memory reserved for send buffers for TCP socket.
Each TCP socket has rights to use it due to fact of its birth.
Default: 4K

default: Amount of memory allowed for send buffers for TCP socket
by default. This value overrides net.core.wmem_default used
by other protocols, it is usually lower than net.core.wmem_default.
Default: 16K

max: Maximal amount of memory allowed for automatically selected
send buffers for TCP socket. This value does not override
net.core.wmem_max, "static" selection via SO_SNDBUF does not use this.
Default: 128K

tcp_rmem - vector of 3 INTEGERs: min, default, max
min: Minimal size of receive buffer used by TCP sockets.
It is guaranteed to each TCP socket, even under moderate memory
pressure.
Default: 8K

default: default size of receive buffer used by TCP sockets.
This value overrides net.core.rmem_default used by other protocols.
Default: 87380 bytes. This value results in window of 65535 with
default setting of tcp_adv_win_scale and tcp_app_win:0 and a bit
less for default tcp_app_win. See below about these variables.

max: maximal size of receive buffer allowed for automatically
selected receiver buffers for TCP socket. This value does not override
net.core.rmem_max, "static" selection via SO_RCVBUF does not use this.
Default: 87380*2 bytes.

tcp_mem - vector of 3 INTEGERs: min, pressure, max
low: below this number of pages TCP is not bothered about its
memory appetite.

pressure: when amount of memory allocated by TCP exceeds this number
of pages, TCP moderates its memory consumption and enters memory
pressure mode, which is exited when memory consumtion falls
under "low".

high: number of pages allowed for queueing by all TCP sockets.

Defaults are calculated at boot time from amount of available
memory.

tcp_app_win - INTEGER
Reserve max(window/2^tcp_app_win, mss) of window for application
buffer. Value 0 is special, it means that nothing is reserved.
Default: 31

tcp_adv_win_scale - INTEGER
Count buffering overhead as bytes/2^tcp_adv_win_scale
(if tcp_adv_win_scale > 0) or bytes-bytes/2^(-tcp_adv_win_scale),
if it is <= 0.
Default: 2

ip_local_port_range - 2 INTEGERS
Defines the local port range that is used by TCP and UDP to
choose the local port. The first number is the first, the
second the last local port number. Default value depends on
amount of memory available on the system:
> 128Mb 32768-61000
< 128Mb 1024-4999 or even less.
This number defines number of active connections, which this
system can issue simultaneously to systems not supporting
TCP extensions (timestamps). With tcp_tw_recycle enabled
(i.e. by default) range 1024-4999 is enough to issue up to
2000 connections per second to systems supporting timestamps.

icmp_echo_ignore_all - BOOLEAN
icmp_echo_ignore_broadcasts - BOOLEAN
If either is set to true, then the kernel will ignore either all
ICMP ECHO requests sent to it or just those to broadcast/multicast
addresses, respectively.

icmp_destunreach_rate - INTEGER
icmp_paramprob_rate - INTEGER
icmp_timeexceed_rate - INTEGER
icmp_echoreply_rate - INTEGER (not enabled per default)
Limit the maximal rates for sending ICMP packets to specific targets.
0 to disable any limiting, otherwise the maximal rate in jiffies(1)
See the source for more information.

icmp_ignore_bogus_error_responses - BOOLEAN
Some routers violate RFC 1122 by sending bogus responses to broadcast
frames. Such violations are normally logged via a kernel warning.
If this is set to TRUE, the kernel will not give such warnings, which
will avoid log file clutter.
Default: FALSE

(1) Jiffie: internal timeunit for the kernel. On the i386 1/100s, on the
Alpha 1/1024s. See the HZ define in /usr/include/asm/param.h for the exact
value on your system.

conf/interface/*:
conf/all/* is special and changes the settings for all interfaces.
Change special settings per interface.

log_martians - BOOLEAN
Log packets with impossible addresses to kernel log.

accept_redirects - BOOLEAN
Accept ICMP redirect messages.
default TRUE (host)
FALSE (router)

forwarding - BOOLEAN
Enable IP forwarding on this interface.

mc_forwarding - BOOLEAN
Do multicast routing. The kernel needs to be compiled with CONFIG_MROUTE
and a multicast routing daemon is required.

proxy_arp - BOOLEAN
Do proxy arp.

shared_media - BOOLEAN
Send(router) or accept(host) RFC1620 shared media redirects.
Overrides ip_secure_redirects.
default TRUE

secure_redirects - BOOLEAN
Accept ICMP redirect messages only for gateways,
listed in default gateway list.
default TRUE

send_redirects - BOOLEAN
Send redirects, if router. Default: TRUE

bootp_relay - BOOLEAN
Accept packets with source address 0.b.c.d destined
not to this host as local ones. It is supposed, that
BOOTP relay daemon will catch and forward such packets.

default FALSE
Not Implemented Yet.

accept_source_route - BOOLEAN
Accept packets with SRR option.
default TRUE (router)
FALSE (host)

rp_filter - BOOLEAN
1 - do source validation by reversed path, as specified in RFC1812
Recommended option for single homed hosts and stub network
routers. Could cause troubles for complicated (not loop free)
networks running a slow unreliable protocol (sort of RIP),
or using static routes.

0 - No source validation.

Default value is 0. Note that some distributions enable it
in startip scripts.



VMware: vmware-vdiskmanager utility

Wednesday, April 15, 2009 |

vmware-vdiskmanager utility usages:
***********************************

vmware-vdiskmanager -r source.vmdk -t 0 dest.vmdk

-k for shrinking

Use the vmware-vdiskmanager -x command to set the correct size of the volume you want.

Usage: vmware-vdiskmanager OPTIONS diskName | drive-letter:

Offline disk manipulation utility
Options:
-c : create disk; need to specify other create options
-d : defragment the specified virtual disk
-k : shrink the specified virtual disk
-n : rename the specified virtual disk; need to
specify destination disk-name
-p : prepare the mounted virtual disk specified by
the drive-letter for shrinking
-q : do not log messages
-r : convert the specified disk; need to specify
destination disk-type
-x : expand the disk to the specified capacity

Additional options for create and convert:
-a : (for use with -c only) adapter type(ide, buslogic or lsilogic)
-s : capacity of the virtual disk
-t : disk type id

Disk types:
0 : single growable virtual disk
1 : growable virtual disk split in 2Gb files
2 : preallocated virtual disk
3 : preallocated virtual disk split in 2Gb files

The capacity can be specified in sectors, Kb, Mb or Gb.
The acceptable ranges:
ide adapter : [100.0Mb, 128.0Gb]
scsi adapter: [100.0Mb, 256.0Gb]
ex 1: vmware-vdiskmanager.exe -c -s 850Mb -a ide -t 0 myIdeDisk.vmdk
ex 2: vmware-vdiskmanager.exe -d myDisk.vmdk
ex 3: vmware-vdiskmanager.exe -r sourceDisk.vmdk -t 0 destinationDisk.vmdk
ex 4: vmware-vdiskmanager.exe -x 36Gb myDisk.vmdk
ex 5: vmware-vdiskmanager.exe -n sourceName.vmdk destinationName.vmdk
ex 6: vmware-vdiskmanager.exe -k myDisk.vmdk
ex 7: vmware-vdiskmanager.exe -p m:
(A virtual disk first needs to be mounted at m:
using the VMware Diskmount Utility.)

Mitel 3300 ICP and Polycom IP7000

Thursday, April 9, 2009 |





It was a tough day for a me to plug IP 7000 on Mitel 3300 ICP. Even though mitel support the SIP protocols, it was not just a plug and play game.

Steps are pretty simple

1. Go to ' Licensing and Option Selection' of controller - Make sure that you have enough SIP licenses on Mitel ICP
2. Multiline IP set configuration - Add a new device as 'Generic SIP' - Include a security pin number and intended Phone number
3. Next one is a tedious task - Create a "Class of Service Assignment" - Need to spend some time on this to enable the features needed for your phone. Few docs are available on Mitel site for this.
4. Then do some adjustments in "Sip Device Capability assignment" - There is a catch here! If you are not using the latest ICP version (Above 9.0), you will not be seeing all the SIP features avaiable on IP 7000. I had tough time while configuring IP 7000 for multi line conferencing capability because of the unavailable options on the older version.
Disable Reliable Provisional Responses (Yes)

Force sending SDP in initial Invite message (Yes)
Suppress Use of SDP Inactive Media Streams (No)
Renegotiate SDP To Enforce Symmetric Codec (No)
Allow Device To Use Multiple Active M-Lines (Yes) --> This option need to be enabled (which is available on 9.0 UR1 version)

5. "Multi Line Set Key Assignment" - To configure multiple lines on the phone - a straight forward process.
6. "Station Service Assignment" - Assign the configured "Sip Capabilities" to the newly configured device
7. Boot up IP7000
Go to the Status and TCP Parameters and find the IP of the device.
Access the Device using http://x.x.x.x and follow the simple configuration available on Polycom Site
8. Change the dial plan if necessary to match your ICP settings

www.polycom.com/global/documents/support/setup_maintenance/products/voice/soundstation_ip_7000_qsg_english_rev_b.pdf

It is bit more tougher than these simple steps...;) ..
Enjooy.

Yum update Problems

Monday, March 9, 2009 |




Yum was throwing errors saying inaccessible repo. I tried recreating the repository using 'createrepo'. But it didn't help.

[root@myhost repodata]# yum update
Loading "rhnplugin" plugin
Loading "installonlyn" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Update Process
Setting up repositories
file://var/ftp/pub/rhel5/i386_32/Server/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: '/ftp/pub/rhel5/i386_32/Server/repodata/repomd.xml'
Trying other mirror.
Error: Cannot open/read repomd.xml file for repository: Server
[root@myhost repodata]#

The fix was simple. Done a
"yum clean all"

Everything started working..hurray..!!

DB2 9.1 installation on RHEL 5.1 or CentOS 5.1

Wednesday, February 25, 2009 |

Just thought of adding a post since DB2 popbuilder don't have a clear cut installation steps for DB2 installation for Linux hosts. I am trying this on a RHEL 5.1 machine. I am just starting on DB2 stuff so you can expect more on DB2 in future posts. Everything is self explanatory as I am just copy pasting the logs console logs from bash.

Don't get confused.. my installation directory is /home/db2.

1. Downloaded the package DB2_ESE_V913_LNXX86.tar from IBM Site. I have downloaded this one since I am running a 32bit RHEL 5.1 on top of VMware ESX.

2. Dependency : libstdc++.so.5

3. Used the whatprovides switch to find the appropriate package from my local yum repository

[root@basil-db1]# yum whatprovides libstdc++.so.5
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up repositories
ClusterStorage 100% |=========================| 1.1 kB 00:00
VT 100% |=========================| 1.1 kB 00:00
Server 100% |=========================| 1.1 kB 00:00
Cluster 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files

compat-libstdc++-33.i386 3.2.3-61 Server
Matched from:
libstdc++.so.5
Importing additional filelist information
Exiting on user cancel
[root@basil-db1 db2install]

4. [root@basil-db1]# yum install compat-libstdc++*
-- snipped--
Running Transaction
Installing: compat-libstdc++-296 ######################### [1/2]
Installing: compat-libstdc++-33 ######################### [2/2]

Installed: compat-libstdc++-296.i386 0:2.96-138 compat-libstdc++-33.i386 0:3.2.3-61
Complete!
[root@basil-db1]#


5. Unzipped package folder looks like this.

[root@basil-db1 db2install]# ls
db2 DB2_ESE_V913_LNXX86.tar db2_install db2prereqcheck db2setup doc installFixPack
[root@basil-db1 db2install]#

6. I choose to install db2 on /home/db2 since I dont have enough space on the default location /opt/ibm/db2/V9.1


[root@basil-db1 db2install]# mkdir /home/db2
[root@basil-db1 db2install]# ./db2_install

Default directory for installation of products - /opt/ibm/db2/V9.1

***********************************************************
Do you want to choose a different directory to install [yes/no] ?
yes
Enter full path name for the install directory -

------------------------------------------------
/home/db2


Specify one or more of the following keywords,
separated by spaces, to install DB2 products.

CLIENT
RTCL
ESE

Enter "help" to redisplay product names.

Enter "quit" to exit.

***********************************************************
ESE
DB2 installation is being initialized.

Total number of tasks to be performed: 46
Total estimated time for all tasks to be performed: 808

..... snipped ....

Task #46 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #46 end

The execution completed successfully.

For more information see the DB2 installation log at
"/tmp/db2_install.log.5657".
[root@basil-db1 db2install]#

7. Verify /tmp/db2_install.log.5657 to check for errors

8. Next is creation of groups and users.

[root@basil-db1 db2install]# groupadd -g 999 db2iadm1
[root@basil-db1 db2install]# groupadd -g 998 db2fadm1
[root@basil-db1 db2install]# groupadd -g 997 db2asgr

[root@basil-db1 db2install]# useradd -g db2iadm1 -m db2inst1 -p password
[root@basil-db1 db2install]# useradd -g db2fadm1 -m db2fenc1 -p password
[root@basil-db1 db2install]# useradd -g db2fadm1 -m db2fenc1 -p password

Can use a good password than my conventional cheeky 'password' ;)

9. Create DB2 administration server (DAS)

[root@basil-db1 instance]# pwd
/home/db2/instance
[root@basil-db1 instance]#
[root@basil-db1 instance]# ./dascrt -u db2as
SQL4409W The DB2 Administration Server is already active.
DBI1070I Program dascrt completed successfully.
[root@basil-db1 instance]#

10. Create DB2 instances for the added users

[root@basil-db1 instance]# ./db2icrt -u db2fenc1 db2inst1
DBI1070I Program db2icrt completed successfully.

[root@basil-db1 instance]#

11. Applying license


[root@basil-db1 license]# /home/db2/adm/db2licm -a /home/db2install/db2/license/db2ese.lic

LIC1402I License added successfully.

LIC1426I This product is now licensed for use as specified in the License Agreement and License Information documents pertaining to the licensed copy of this product. USE OF THE PRODUCT CONSTITUTES ACCEPTANCE OF THE TERMS OF THE IBM LICENSE AGREEMENT AND LICENSE INFORMATION DOCUMENTS, LOCATED IN THE FOLLOWING DIRECTORY: "/home/db2/license/en_US.iso88591"
[root@basil-db1 license]#

12. Creating sample Database

[root@basil-db1 adm]# su - db2inst1
[db2inst1@basil-db1 ~]$
[db2inst1@basil-db1 ~]$ cd /home/db2/adm/
[db2inst1@basil-db1 adm]$
[db2inst1@basil-db1 adm]$ db2sampl

Creating database "SAMPLE"...
Connecting to database "SAMPLE"...
Creating tables and data in schema "DB2INST1"...

'db2sampl' processing complete.

[db2inst1@basil-db1 adm]$ db2 list database directory

System Database Directory

Number of entries in the directory = 1

Database 1 entry:

Database alias = SAMPLE
Database name = SAMPLE
Local database directory = /home/db2inst1
Database release level = b.00
Comment = A sample database
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =

[db2inst1@basil-db1 adm]$

13. Connecting to DB2 sample Database:

[db2inst1@basil-db1 adm]$ db2 connect to sample

Database Connection Information

Database server = DB2/LINUX 9.1.3
SQL authorization ID = DB2INST1
Local database alias = SAMPLE

[db2inst1@basil-db1 adm]$

14. Set the profile in the /etc/profile to get proper path to binaries.
Add the below line to /etc/profiles

. /home/db2inst1/sqllib/db2profile

15. You are done with DB2 setup. Make sure that your firewall is not blocking DB2 ports in the host level.


[root@basil-db1 adm]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@basil-db1 adm]#

VMware Guest OS Problem - Ubuntu 8.10

Thursday, February 19, 2009 |

Today my guest OSs started showing some weired problems after the upgrade of ubuntu from 8.04 to 8.10. The delete, arrow, home, end, insert stopped working. But the guest os were just fine.

If you are using latest VM player do the following step to fix. Make sure to reload the VM guest after the change.

vi /etc/vmware/config
xkeymap.nokeycodeMap = true

Some Excellent SED usages

Monday, February 16, 2009 |


Some Excellent SED usages
**************************
SED - Stream Editor. See some good usages of SED.

http://www.megalinux.net/archives/643.html
http://sed.sourceforge.net/local/docs/emulating_unix.txt
http://sed.sourceforge.net/local/docs/An_introduction_to_sed.html

Monitoring

|


Monitoring
***********

http://www.ubuntugeek.com/bandwidth-monitoring-tools-for-ubuntu-users.html
http://www.slac.stanford.edu/xorg/nmtf/nmtf-tools.html
http://www.debianhelp.co.uk/tools.htm

Logical Volume Manager (lvm)

|


Quick LVM setup on a Debian/Ubunutu box
****************************************

puttalu:~# apt-get install lvm2 dmsetup

puttalu:~# fdisk -l


Disk /dev/sda: 80.0 GB, 80032038912 bytes

255 heads, 63 sectors/track, 9730 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes


Device Boot Start End Blocks Id System

/dev/sda1 1 12 96358+ 83 Linux

/dev/sda2 13 498 3903795 82 Linux swap / Solaris

/dev/sda3 499 1471 7815622+ 83 Linux

/dev/sda4 1472 9730 66340417+ 5 Extended

/dev/sda5 1472 9730 66340386 8e Linux LVM

puttalu:~#


puttalu:~# pvcreate /dev/sda5

Physical volume "/dev/sda5" successfully created

puttalu:~#


puttalu:~# vgcreate vg0 /dev/sda5

Volume group "vg0" successfully created

puttalu:~# pvdisplay /dev/sda5

--- Physical volume ---

PV Name /dev/sda5

VG Name vg0

PV Size 63.27 GB / not usable 0

Allocatable yes

PE Size (KByte) 4096

Total PE 16196

Free PE 16196

Allocated PE 0

PV UUID xwuXvV-1DYA-SuhM-87c9-QRju-PuRa-tlPf30


puttalu:~#

puttalu:~# lvcreate -L20G -nusrlv vg0

Logical volume "usrlv" created

puttalu:~#

puttalu:~# lvdisplay

--- Logical volume ---

LV Name /dev/vg0/usrlv

VG Name vg0

LV UUID FJu6pi-qOzW-1Pwf-Fz6u-PtUb-FWb4-w23LM7

LV Write Access read/write

LV Status available

# open 0

LV Size 20.00 GB

Current LE 5120

Segments 1

Allocation inherit

Read ahead sectors 0

Block device 254:0


puttalu:~# mkdir /usr/back

puttalu:~# mount -t ext3 /dev/vg0/usrlv /usr/back

puttalu:~#

puttalu:~# lvcreate -L40G -nvarlv vg0

Logical volume "varlv" created

puttalu:~#

puttalu:~# mkfs.ext3 /dev/vg0/varlv

mke2fs 1.40-WIP (14-Nov-2006)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

5242880 inodes, 10485760 blocks

524288 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=0

320 block groups

32768 blocks per group, 32768 fragments per group

16384 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

4096000, 7962624


Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.

puttalu:~# mkdir /var/image

puttalu:~# mount -t ext3 /dev/vg0/varlv /var/image

puttalu:~#

puttalu:~# lvdisplay

--- Logical volume ---

LV Name /dev/vg0/usrlv

VG Name vg0

LV UUID FJu6pi-qOzW-1Pwf-Fz6u-PtUb-FWb4-w23LM7

LV Write Access read/write

LV Status available

# open 1

LV Size 20.00 GB

Current LE 5120

Segments 1

Allocation inherit

Read ahead sectors 0

Block device 254:0


--- Logical volume ---

LV Name /dev/vg0/varlv

VG Name vg0

LV UUID 0V2BDl-Sra5-GFgI-6zGN-Uy7u-pzAs-7ZDfVC

LV Write Access read/write

LV Status available

# open 1

LV Size 40.00 GB

Current LE 10240

Segments 1

Allocation inherit

Read ahead sectors 0

Block device 254:1


puttalu:~# df -h /var/image

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/vg0-varlv

40G 177M 38G 1% /var/image

/dev/mapper/vg0-usrlv

20G 173M 19G 1% /usr/back

puttalu:~#

Network Clonning

|




Tired of bulk deployment of desktops and servers(hybrid network of both windows and linux)??. Couple of good Sysadmin packages to make your life easy.

http://unattended.sourceforge.net/

http://clonezilla.sourceforge.net/

Curl Tricks

|

Curl Tricks

Noticed some good curl usages...Worth copying to one more page on internet.

Original Article : http://www.linux.com/articles/57715


One of cURL's most useful features is a kind of URL "glob" support, which lets you specify a pattern as part of the URL to match multiple URLs. You can give a character range in brackets, such as [A-Z] or [0-9], and you can also give a list of alternatives in braces, such as {about,blog,news}. The only trick is that if you're saving to files with the -O option, you have to give that option as many times as files you match. For example, suppose you want to grab all three versions of a manual. You'd need a command like:

$ curl -O -O -O http://example.com/docs/manual.{html,pdf,tar.gz}

For HTTP requests, you can specify HTTP 1.1 byte ranges instead of entire files -- if the server has byte ranges enabled, this option returns only the specified bytes instead of the whole file. 0 represents the beginning of the file. For example, to grab the first 100 bytes:

$ curl -r 0-99 http://example.com/

Ranges don't have to begin with zero. To get bytes 100 through 200:

$ curl -r 100-200 http://example.com/

Negative values alone work from the end of the document. To grab the last eight bytes:

$ curl -r -8 http://example.com/

The -i option precedes a given URL by the server headers. Alternately, -I outputs only the headers, which is useful for seeing the OS and Web server software that a specified site is running. It also shows the date and time of the request, content length, and type of the given URL. When the -I option is used on a FILE or FTP URL, you'll get the file size and modification time.

You can upload files by specifying them as arguments to the -T option. It supports the same kind of globbing as the URL argument:

$ curl -T index-{01-99}.html ftp://ftp.example.com/pub/incoming/

By default, file uploads are given the same name as the source files, but you can specify a new name by including it in the target URL:

$ curl -T index-mine.html ftp://ftp.example.com/pub/incoming/index-yours.html

If you need to specify a username and password, give them as arguments to the -u option, separated by a colon. To upload standard input, use the hyphen as an argument:

$ some-long-pipeline | curl -u bob:secret -T - ftp://ftp.example.com/pub/bob/results.txt

Get server metrics

cURL supports built-in runtime variables that you can use to perform ad hoc diagnostics and benchmarking, or to gather statistics about the accessibility of a given URL, site, or server (all times are given in seconds, and all sizes are in bytes):

* content_type: the Content-Type value of the file
* http_code: HTTP(S) code in the page
* http_connect: HTTP code in the proxy response
* num_connects: number of new connections made in the transfer
* num_redirects: number of redirection operations that were made
* size_download: total size of downloaded data
* size_header: total size of the headers
* size_request: total size of the request
* size_upload: total size of uploaded data
* speed_download: average download speed
* speed_upload: average upload speed
* time_connect: time from the start until the remote host connection was made
* time_namelookup: time from the start of the command until name resolution was finished
* time_pretransfer: time from the start until the file transfer was about to begin
* time_redirect: time for all redirection operations
* time_starttransfer: all pretransfer time plus the time needed to calculate the result
* time_total: time for the complete operation (to the millisecond)
* url_effective: the last URL fetched

Output any of these variables with the -w option ("write-out"), giving the variables in the format %{name} as part of a quoted string. You can include any other text as part of that string, and do simple formatting by using \n for a newline or \t for a tab. For example:
$ curl -w '\nLookup time:\t%{time_namelookup}\nConnect time:\t%{time_connect}\nPreXfer time:\t%{time_pretransfer}\nStartXfer time:\t%{time_starttransfer}\n\nTotal time:\t%{time_total}\n' -o /dev/null -s http://linux.com/

Lookup time: 0.038
Connect time: 0.038
PreXfer time: 0.039
StartXfer time: 0.039

Total time: 0.039
$

To get the amount of time between when a connection is established and when the data actually begins to be transferred, subtract the value of time_pretransfer from time_starttransfer. You can automate this by sending the output to bc with echo:

$ echo "`curl -s -o /dev/null -w '%{time_starttransfer}-%{time_pretransfer}' http://linux.com/`"|bc

cURL offers other important options you'll want to use to check for timeouts or to control the transfer speed -- it has more than 100 options in total. By specifying huge URL ranges or calling curl from a loop, you can use the commands to do simple server load testing, or check for various failures by reading the variable output -- and since curl handles forms, you can even use it to test Web application speed.