Thursday, June 30, 2011

Mounting FAT or VFAT on Linux

Most Linux Distro should be able to detect and mount any FAT or VFAT very easily.

# mount -t vfat /dev/hda1 /mnt/MS_Windows

Tuesday, June 28, 2011

Accessing ReiserFS from Windows - rfstool

rfstool -  allows you to access ReiserFS partitions from a Windows 95/98/ME/NT/2000/XP system. Starting with version 0.6, it even allows you to access ReiserFS partitions from Linux

* Do note that the  for NT/2000/XP: You need administrative privileges to run this program. Normal users will probably not have the access rights to the raw partition data

* Access is read-only

* Journal data is ignored.

Reading Linux File System ext 2 or ext 3 from Windows


This freeware driver Ext2 Installable File System For Windows to be installed on Windows NT4.0/2000/XP/2003/Vista/2008 will mount ext2 file system as a separate drive letter. However permission may not be well handled due to Windows issue. To handle ext3, do read the FAQ found in the website

Saturday, June 25, 2011

Running multiple commands

1. Executing Commands in Sequence (Independently)
(Put semi-colon between commands)

# ./configure; make; make install
*The subsequent commands will continue to execute independently whether the prior commands fail or not. This will have impact on subsequent commands
2. Executing Commands in Sequence (Interdependent)
(Put && operator in between commands)
# ./configure && make && make install
* The && is a logical operator. In other words, if the prior commands fail, the subsequent commands will fail

3. Executing Commands Either / Or
# ./configure || echo "something not working in configure"
*  If the 1st command fails, execute the 2nd commands

Friday, June 24, 2011

qsub No default queue specified MSG=cannot locate queue

Today I encountered this error qsub: No default queue specified MSG=cannot locate queue
Queue            Memory CPU Time Walltime Node  Run Que Lm  State
---------------- ------ -------- -------- ----  --- --- --  -----
starfruit          --      --       --      --    0   0 --   E R
dque               --      --       --      --    1   1 --   E R
                                               ----- -----
                                                   1     1

This error can be easily rectified. Just look at Testing Torque Server Configuration to trouble-shoot. Likely it is due to the queue not configured properly.

You may want to look at Manual Setup of Initial Server Configuration for setup of Queue. Alternatively, you can also look at Setting up Torque Server on xCAT 2.x (Linux Toolkits)

Wednesday, June 22, 2011

Encountering a Infiniband disconnection to SCSI RDMA Protocol (SRP) target

Today I encounter this strange error. At /var/log/messages "kernel: ib_srp: ASYNC event= 17 on device= mlx4_0".
I'm still not sure of it though

The IB disconnection to SCSI RDMA Protocol (SRP) target was able to be reconnected but since SRP Target driver is designed to work directly on top of OpenFabrics OFED or Infiniband drivers in Linux kernel tree. I guess the fix could be a upgrading and patching of the Kernel or OFED drivers.

Still noting this issue.

Saturday, June 18, 2011

Detaching a process in the foreground from the shell

If you forget to use Screen Session to allow you to terminate your shell session without terminating the job that have been running in the foreground, and it is too late to do a nohup command, you may want to consider these alternatives.

You can use the shell command called disown that detach the process from theshell that started it. Here's how to do it

Step 1:
Use Ctrl + Z to suspend the running program

Step 2:
Type bg to restart it running in the background
# bg

Step 3: Get a list of jobs running in your shell
# jobs

Step 4: Detach it from the shell
# jobs %1
(Remember to put the % before the job number which in this example is 1)

Thursday, June 16, 2011

Install GIT on CentOS 5

Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Every Git clone is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Branching and merging are fast and easy to do.

Step 1: Installing Dependencies required by GIT
# yum -y install zlib-devel openssl-devel perl cpio expat-devel gettext-devel

Step 2: Compile and Installing CURL
What is CURL? curl is a command line tool for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP.

# wget http://curl.haxx.se/download/curl-7.18.2.tar.gz
# tar xzvf curl-7.18.2.tar.gz
# cd curl-7.18.2
# ./configure
# make
# make install


Step 3: ldconfig /usr/local/lib
# vim /etc/ld.so.conf.d/common.conf

/usr/local/lib


Step 4: Install GIT
# wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz
# tar xzvf git-latest.tar.gz
# cd git
# autoconf
#./configure –with-curl=/usr/local
# make
# make install

Horray it is done.

Credits: Much of the credit of the materials must go to http://turbolinux.org/tag/centos-git/

Wednesday, June 15, 2011

Shutting down sFTP on CentOS

To disable sFTP, you have to disable under OpenSSH Subsystem option since sFTP protocol is NOT called directly but via OpenSSH

Step 1: Proceed to sshd_config file
# vim /etc/ssh/sshd_config

Step2: Comment out the line with a # inside /etc/ssh/sshd_config
# Subsystem sftp /usr/lib/openssh/sftp-server


Step 3: Restart OpenSSH service
# service sshd restart

Tuesday, June 14, 2011

Keeping OpenSSH from disconnecting

Sometimes whille connecting to another remote server via, there is this unplesant disconnection. How do we deal with it. You have to look at OpenSSH configuration


# /etc/ssh/sshd_config

ClientAliveInterval 15
ClientAliveCountMax 3

From the man page from ClientAliveInterval
Sets a timeout interval in seconds after which if no data has been    received from the client, sshd will send a message through the encrypted channel to request a response from the client.  The default
is 0, indicating that these messages will not be sent to the client.  This option applies to protocol version 2 only.


ClientAliveCountMax
Sets the number of client alive messages (see above) which may be sent without sshd receiving any messages back from the client. If this threshold is reached while client alive messages are being
sent, sshd will disconnect the client, terminating the session.


If ClientAliveInterval (above) is set to 15, and ClientAliveCountMax is left 3, unresponsive ssh clients will be disconnected after approximately 45 seconds.

Do note that the ClientAlive messages are sent through the encrypted channel. On the other hand, The TCPKeepAlive Messages is not sent through encrypted Channel and thus spoofable.

Monday, June 13, 2011

Understanding how a linux command work internally

You can use strace command to understanding how a linux command work internally. For example, to check on the date command

# strace -c /bin/date

strace is a system call monitor command and provides information about system calls made by an application, including the call arguments and return value.

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
   nan    0.000000           0         5           read
   nan    0.000000           0         1           write
   nan    0.000000           0        36        30 open
   nan    0.000000           0         7           close
   nan    0.000000           0        14         9 stat
   nan    0.000000           0         8           fstat
   nan    0.000000           0         1           lseek
   nan    0.000000           0        16           mmap
   nan    0.000000           0         7           mprotect
   nan    0.000000           0         3           munmap
   nan    0.000000           0         3           brk
   nan    0.000000           0         2           rt_sigaction
   nan    0.000000           0         1           rt_sigprocmask
   nan    0.000000           0         1         1 access
   nan    0.000000           0         1           execve
   nan    0.000000           0         1           uname
   nan    0.000000           0         1           getrlimit
   nan    0.000000           0         1           arch_prctl
   nan    0.000000           0         1           futex
   nan    0.000000           0         1           set_tid_address
   nan    0.000000           0         1           clock_gettime
   nan    0.000000           0         1           set_robust_list
------ ----------- ----------- --------- --------- ----------------
100.00    0.000000                   113        40 total

Sunday, June 12, 2011

Setting up 2 different IP Addresses on a single Network Card (NIC) on CentOS

Setting of the first IP Addresses
# vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NETMASK=192.168.1.0
GATEWAY=192.168.1.1

Setup the 2nd IP addresses

# vim /etc/sysconfig/network-scripts/ifcfg-eth0:1

DEVICE=eth0:1
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.3
NETMASK=255.255.255.0
NETMASK=192.168.1.0
GATEWAY=192.168.1.1

# service network restart

Ping the 2 IP Addresses, you should be able to both

Saturday, June 11, 2011

Disabling USB port on CentOS 5

To disable USB port on the machine, you can edit the grub.conf
# vim /boot/grub/grub.conf

Add the kernel parameter
kernel /vlinuz ..... rhgb quiet nousb

Reboot your system and you will notice all your usb ports disabled

Tuesday, June 7, 2011

Singapore university and IBM cooperate on cloud

Interesting Article on a Singapore University and IBM collaboration on Cloud.
HPC Cloud to be exact

See Singapore university and IBM cooperate on cloud (Future Gov Asia Pacific)