If you have a situation where your ext2 or ext3 filesystem's primary superblock is corrupted, you need to pass one of the backup superblocks to fsck program. In this case you can find the backup superblocks by using mkfs program. All you have to do is, run mkfs with "-n" option, where mkfs is run in dry mode. It will not destroy your filesystem, it only prints out what it will do on real mkfs procedure.By the way, you have to add the parameters if you have used when your filesystem originally created to get correct values.
eg. mke2fs -n /dev/sda1
and now you can pass your backup superblock number to fsck (fsck.ext2,fsck.ext3) with "-b" parameter.
Thursday, November 6, 2008
freeing cache on linux with drop_caches
Linux kernel 2.6.16 and later has a option which let's you free inode/dentry and pagecache caches on your system. The file is located on /proc filesystem.
It has 3 options. For example:
# echo 1 > /proc/sys/vm/drop_caches
frees pagecache on your system.
# echo 2 > /proc/sys/vm/drop_caches
frees inodes and dentry caches
# echo 3 > /proc/sys/vm/drop_caches
frees pagecache and inode/dentry caches.
tip: some dirty caches are not freeable so it's better to use "sync" command before using drop_caches for freeing much more memory on your linux system.
It has 3 options. For example:
# echo 1 > /proc/sys/vm/drop_caches
frees pagecache on your system.
# echo 2 > /proc/sys/vm/drop_caches
frees inodes and dentry caches
# echo 3 > /proc/sys/vm/drop_caches
frees pagecache and inode/dentry caches.
tip: some dirty caches are not freeable so it's better to use "sync" command before using drop_caches for freeing much more memory on your linux system.
Wednesday, October 29, 2008
disabling bell beep sound on linux console
Sometimes its annoying to hear a beep sound everytime you hit on tab button for completion on linux console. Here is the quickway how to disable that beep sound.
All you have to do is add the following line in /etc/inputrc file or uncomment it if it presents.
set bell-style none
the following image is the default inputrc file on centos system. You can uncomment the line which says "set bell-style none" for disabling tab completion beep sound.
All you have to do is add the following line in /etc/inputrc file or uncomment it if it presents.
set bell-style none
the following image is the default inputrc file on centos system. You can uncomment the line which says "set bell-style none" for disabling tab completion beep sound.
Monday, October 27, 2008
resolving latency problems on linux with latencytop utility
Finding out what is causing unresponsive behaviour, audio delays or stalls on your linux machines can be a hard task.
Latencytop utility gives information where latency is occured to diagnose problem.
Here is an example how to use latencytop on fedora core 9 distribution.
yum install latencytop
By default kernel does not enable latency statistics reporting.You have to enable it by hand.
echo 1 > /proc/sys/kernel/latencytop
this command enables it. disabling it is easy by echo 0 > /proc/sys/kernel/latencytop
latencytop uses the statistics from proc file system. statistics is in /proc/latency_stats file.
here is a screenshot where it shows latency caused disk io on ext3 filesystem and with which pid caused it.

note: if your linux system does not have /proc/latency_stats file. it's either is disabled when kernel is compiled or your kernel does not have latency stats support. In that case you have to patch your kernel an recompile it.
for patch see http://www.latencytop.org/download.php
Latencytop utility gives information where latency is occured to diagnose problem.
Here is an example how to use latencytop on fedora core 9 distribution.
yum install latencytop
By default kernel does not enable latency statistics reporting.You have to enable it by hand.
echo 1 > /proc/sys/kernel/latencytop
this command enables it. disabling it is easy by echo 0 > /proc/sys/kernel/latencytop
latencytop uses the statistics from proc file system. statistics is in /proc/latency_stats file.
here is a screenshot where it shows latency caused disk io on ext3 filesystem and with which pid caused it.

note: if your linux system does not have /proc/latency_stats file. it's either is disabled when kernel is compiled or your kernel does not have latency stats support. In that case you have to patch your kernel an recompile it.
for patch see http://www.latencytop.org/download.php
Monday, October 20, 2008
extending laptop battery lifetime with Intel's Powertop utility
Powertop is designed to pinpoint resources (device drivers, software,etc..) that wakes up idle cpu and lets you extend battery life time by fixing or stopping the application. It's useful for laptop users and also for datacenters who wants to save power consumption.
Here is a sample output disk I/O which showing by powetop:
Here is a sample output disk I/O which showing by powetop:
Saturday, October 18, 2008
display system statistics with systat on bsd systems
systat utility displays system statistics on bsd systems (freebsd, dragonfly, etc.).
system statistics includes swap, network interface, disk I/O , virtual memory (vmstat), network utilitzation (mbuf), TCP/IP statistics, network connections (netstat), icmp.
here is some systat options:
pigs,icmp,ip,tcp,ifstat,iostat,swap,mbufs,vmstat,netstat.
following is sample output for "systat -iostat" command:
system statistics includes swap, network interface, disk I/O , virtual memory (vmstat), network utilitzation (mbuf), TCP/IP statistics, network connections (netstat), icmp.
here is some systat options:
pigs,icmp,ip,tcp,ifstat,iostat,swap,mbufs,vmstat,netstat.
following is sample output for "systat -iostat" command:
Friday, August 29, 2008
editing text files with more
You can edit documents when using more. if you press "v" , your default editor will be started on current line. After saving and exiting your editor, you can continue using more.
Default editor is chosen by VISUAL and EDITOR variables. VISUAL environment overrides EDITOR variable.
Default editor is chosen by VISUAL and EDITOR variables. VISUAL environment overrides EDITOR variable.
Subscribe to:
Posts (Atom)