Sunday, October 17, 2010

New Blog

This blog is moved to my new website
http://neependra.net/

Wednesday, September 24, 2008

Jiffy, Jiffies & HZ

Jiffies : The jiffies variable holds the number of times the system timer popped since the system booted.

HZ: The number of timer ticks per second, is contained in the kernel variable HZ.
The kernel increments jiffies, HZ times every second

Jiffy:
On a kernel with a HZ value of 100, a “jiffy” is a 10-millisecond duration, while on a kernel with HZ set to 1000, a jiffy is only 1-millisecond.

For more info
http://www.linux-mag.com/id/2272 (The Passage of Time)

Wednesday, September 17, 2008

How do log every thing printed on the terminal

Sometimes we just keep working on a terminal and get lost what all we did.
Isn't it good if we can get some kind of logs which can give us all steps we followed.

First thing which comes in mind is the "history" command, but that will not give the standard outputs which we got after running the commands.

So, here is the solution.Use a command called "script".

e.g.

$ script standard_out.txt
Script started, file is standard_out.txt
$ date
Mon Sep 8 07:57:20 IST 2008
$ asdf
bash: asdf: command not found
$ exit
Script done, file is standard_out.txt

To exit you need to press "ctrl+D".

Now lets check the content of "standard_out.txt" file.

$ cat standard_out.txt
Script started on Mon 08 Sep 2008 07:57:10 AM IST
$ date
Mon Sep 8 07:57:20 IST 2008
$ asdf
bash: asdf: command not found
$ exit
Script done on Mon 08 Sep 2008 07:57:38 AM IST

For more information look at the man page of ''script"'.

Labels:

Wednesday, September 3, 2008

Deleting a speical character file

Sometimes we need to delete a special character file, which we can not delete with normal rm command.So here is the solution...delete it with the help inode number.

$find . -inum __inode number from ls -i of the file __ -exec rm {} \;

Labels:

Monday, August 11, 2008

Highlighting the searched keyword with 'grep'.

Add following lines in the ".bashrc" file, which is in your home directory.

alias grep="grep --color"

export GREP_COLOR="1;32"

You can run either run following command to take this change in-effect

$ source ~/.bashrc

OR

Logout and then login.

Labels:

Friday, July 11, 2008

Global File System(GFS) -- Part1

File system is a method for storing and organizing computer files and the data they contain to make it easy to find and access them.
There are different types of file system available
* Disk file systems (EXT2, EXT3,XFS,FAT,NTFS,GFS,OCFS)
* Flash file systems
* Network file systems(NFS)
* Special purpose file systems(proc file system)

Each file system has it own structure.So when different file systems are mounted on the same system, how the user has uniform view.
For example mount different file systems under "/mnt" and then run "ls -lR /mnt".What happens?

We get the listing of the files, irrespective of the the file-systems.

VFS
(Virtual File System) acts as a bridge between the applications and
the real file systems.VFS describes the system's files in terms of superblocks and inodes in much the same way as the EXT2 file system uses superblocks and inodes.

When each file system is initialized, it registers itself with the VFS.When user /application wants to access any file, it request the VFS and then VFS
calls the file system specific functions/routines to access the requested file.

GFS
file system is required when more than one system needs simultaneous access to the shared storage.With files system like EXT3 you can not do this.
Try following:-
- Get the shared storage (From SAN/ iSCSI) and assign is multiple systems
- From one system create EXT3 file system on it.
- Mount the storage to all the system.
- Try to create files on that mount point from one system.

Are the newly created are visible from other system ?
We need to remount the storage on other systems to get a consistent view.


With GFS, clients modify the shared data by accessing it atomically.Before accesing the data client acquires the lock for it,modifies the data and then releases the lock.Clients access storage devices like processors of a shared memory multiprocessor computer (SMP) access memory.Each of the GFS client thinks that it has the full access to the storage and they are unaware of each other.

DLM (Distributed Lock Manager), GULM(Grand Unified Locking Manager), and Nolock are locking protocols which GFS uses.
With RHEL3/4, you can use both DLM/GULM. With RHEL5 you can only use DLM.

Nolock is used when you want to use GFS on a stand alone system.Now why would someone like to do that? GFS allocated inodes dynamically. Each file takes one inode, so if someone has to create too many small files he/she can use GFS. In some file systems inode number are limited.

The network storage pool (NSP) provides each machine with a unified storage address space. A device driver layered on top of SCSI and Fibre Channel drivers implements the NSP. The NSP driver translates from the logical address space of the file system to the address space of each device.Subpools divide NSPs into groups of similar device types. These subpools inherit characteristics from underlying devices and network connections.

GFS organizes file systems into several resource groups (RG). Resource groups distribute file system resources across the entire NSP; multiple resource groups can exist per device. Resource groups are essentially mini-file systems. Each group possesses an information block, data bitmaps, dinodes,and data blocks. Resource group blocks contain information similar to traditional superblocks. In normal operation, resource groups are transparent to users.

References:
http://www.diku.dk/undervisning/2003e/314/papers/soltis97global.pdf
http://en.wikipedia.org/wiki/Global_File_System
http://www.science.unitn.it/~fiorella/guidelinux/tlk/node102.html#SECTION001120000000000000000

Monday, June 23, 2008

Jabalpur LUG event, 17th June'08

With the help of jbp-lug members I have organized a LUG event at Takshila Engineering college, Jabalpur.
http://tech.groups.yahoo.com/group/jbp-lug/

Meeting Minutes:
http://tech.groups.yahoo.com/group/jbp-lug/message/393
Pics:
http://tech.ph.groups.yahoo.com/group/jbp-lug/photos/browse/d30d

Around 20 students from different engineering colleges attended the event. 80% students of city like Jabalpur lack the practical understanding of the subjects; they just somehow read them to pass the exams. As per my understanding lack of resources, awareness and mentors is the root cause of this.Groups like LUGs can be very useful here.