Search This Blog

Friday, December 30, 2011

How effectively use Linux system tools to find out the default Linux kernel I/O scheduler

In many troubleshooting situation we overview and check large numbers of logs generated by one or another application. Kernel is nothing special here. The kernel log files can  usually be found under /var/log/kern.log.

Problem
How to find out and confirm all names of the used io kernel scheduler in the last several reboots.

Solution
$ zcat kern.log.3.gz  | egrep 'io scheduler.*\(default\)' 
Oct  8 22:20:16 udesktop kernel: [    0.888090] io scheduler cfq registered (default)
Oct 10 20:30:33 udesktop kernel: [    0.688367] io scheduler cfq registered (default)
Nov  3 23:31:05 udesktop kernel: [    0.872053] io scheduler cfq registered (default)

$ zcat kern.log.1.gz  | egrep 'io scheduler.*\(default\)' | sed -r 's/ +/ /g' | cut -d' ' -f10 | sort | uniq
cfg

Explanation
We first grep for the names of the configured io scheduler. Next we pars it trought sed to repalce all multi space string with a single space and at the end we cut of the scheduler name.

References
Choosing an I/O Scheduler for Red Hat® Enterprise Linux® 4 and the 2.6 Kernel
http://www.redhat.com/magazine/008jun05/features/schedulers/

How to connect over ssh to a server and automatically provide the user name and password using putty or ssh

With the benefit of easy of use of cloud services we can provision a new cloud base virtual server within a minute. Having the server ready we still have to login there to do our job or tests.

As an example you can take a look at the Cloud Servers from Rackspace [1].

By using the free windows ssh implementation like putty [2] or standard linux openssh ssh client we can easily login over a secure connection into our server by using the SSH protocol.

Problem
When you want to quickly and temporarily provision a cloud server it is time wasting when you have to provide the user name and password each time to login to do the work.
As the cloud server will be used for a limited (short) time we would like to be able to login with one 'click' or one command only.

Solution
The Multi-Tabbed PuTTY tool allow us to use a wrapper around the putty tool and provide an easy to use solution to open a new ssh session on demand without having to wory about he user name or password.

Multi-Tabbed PuTTY
http://www.ttyplus.com/

For the Linux system we can use an simple script using the 'expect' tool to start the ssh client.

SSH - Passing Unix login passwords through shell scripts
http://nixcraft.com/shell-scripting/4489-ssh-passing-unix-login-passwords-through-shell-scripts.html

Security
From the security point of view storing the passwords is always a bad idea. There are always some alternative methods. Some examples listed below:

Password-less logins with OpenSSH
http://www.debian-administration.org/articles/152
http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/

References
[1]
http://www.rackspace.com/cloud/cloud_hosting_products/servers/

[2]
http://www.chiark.greenend.org.uk/~sgtatham/putty/

Thursday, December 29, 2011

How to resize (increase) main NTFS system partition of your Windows base virtual mashine in VMware Workstation


Problem summary
When we create a VM we specify the various hardware component we want to virtualize. One of them is the HDD.  After some time you may find out that the hard drive your VM has is too small.

The VMware Workstation allows you to resize the disk (as long there are not snapshots).

Impact
You can't install any additional software because there is not enough free space.


Problem
Although there are many tools you can use to resize the NTFS file system many of them have some limitation (demo version doesn't write data to the disk) or require a comercial license to bought or can be use on the main partition (diskpart.exe) [2]



Solution
The task can be done with the help of [1]. We don't need license. It can resize the main NTFS partition.

Free EaseUS® Partition Master 9.1 Home Edition 

References
[1]
Free EaseUS® Partition Master 9.1 Home Edition
http://www.partition-tool.com/personal.htm

[2]

How to extend a data volume in Windows Server 2003, in Windows XP, in Windows 2000, and in Windows Server 2008
http://support.microsoft.com/kb/325590