Seeing what is being written or read in real time in Linux

Have you ever wondered which processes/tasks write or read to disk in Linux?  Maybe a real time log?

It’s quite simple to enable that feature with the following command:

echo 1 >/proc/sys/vm/block_dump

The output of the command goes to /var/log/messages or /var/log/kernel.log . It depends on the distribution you are using and how your log manager is configured.

Nov  9 21:21:01 hellboy kernel: [140072.428410] bash(31632): READ block 14156776 on md126p4 (8 sectors)
Nov  9 21:21:01 hellboy kernel: [140072.443138] bash(31632): READ block 14156816 on md126p4 (8 sectors)
Nov  9 21:21:57 hellboy kernel: [140127.746763] gnome-shell(5073): WRITE block 120375776 on md126p4 (8 sectors)
Nov  9 21:21:57 hellboy kernel: [140127.765385] gnome-shell(5073): dirtied inode 3627285 (?) on md126p4
Nov  9 21:22:00 hellboy kernel: [140130.602614] nvidia-settings(31743): dirtied inode 689070 (exe) on proc

The output shows the timestamp, the process name, the operation being done (read/write/dirty inode), block or inode number and the device.

Just to take note, a dirty inode is an inode that has had new data written into it but it has not been flushed to disk.

 

Dropping Linux Memory Cache

A Linux server of my own executes from time to time an rsync script, which one it finishes up doing its magic, leaves behind a lot of stuff cached in memory.

In order to “make available” the memory again to other applications, I recommend reading the following as seen on linux-mm.org

Kernels 2.6.16 and newer provide a mechanism to have the kernel drop the page cache and/or inode and dentry caches on command, which can help free up a lot of memory. Now you can throw away that script that allocated a ton of memory just to get rid of the cache…

 To use /proc/sys/vm/drop_caches, just echo a number to it.

 To free pagecache:

# echo 1 > /proc/sys/vm/drop_caches

To free directory entries and inodes:

# echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches

This is a non-destructive operation and will only free things that are completely unused. Dirty objects will continue to be in use until written out to disk and are not freeable. If you run “sync” first to flush them out to disk, these drop operations will tend to free more memory.

 

Purging WINS cache on Windows

On cmd execute:

nbtstat -R

parted: the resulting partition is not properly aligned for best performance

Rather than explaining the problem the title says, I’ll point you to the link you must read to understand/fix it:

http://blog.aloisiojr.com/?p=28

net-news/liferea-1.8.3 has improved its startup speed

For everybody out there complaining about liferea’s decreased performance in the 1.8.x releases, upstream has released 1.8.3 which uses sqlite 3 WAL journaling.

This basically improves the overall liferea’s performance, so if you are hating 1.8.x, please try the latest 1.8.3

Install Telnet Client on Windows 7 and above by using a command line

Quick ‘n dirty, from the cmd “console”

pkgmgr /iu:"TelnetClient"

Enterprise Manager 10.2.0.5 is not able to connect to the database instance

This error may have a variety of causes, and this is how I fixed it:

1. Dropped old Database Console

$ emca -deconfig dbcontrol db

2. Recreated Database Console

$ emca -config dbcontrol db

In the above step, the operation log ended up with:

SEVERE: Error starting Database Control
CONFIG: Stack Trace:
oracle.sysman.emcp.exception.EMConfigException: Error starting Database Control
at oracle.sysman.emcp.EMDBPostConfig.performConfiguration(EMDBPostConfig.java:649)
at oracle.sysman.emcp.EMDBPostConfig.invoke(EMDBPostConfig.java:227)
at oracle.sysman.emcp.EMDBPostConfig.invoke(EMDBPostConfig.java:196)
at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:184)
at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:494)
at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1161)
at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:478)
at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:426)

After having repeated steps 1 and 2 a couple of times, checked environment variables were correctly set and checked users SYS, DBSNMP and SYSMAN were not locked, I started looking for this issue in oracle forums and I found the following:

https://forums.oracle.com/forums/thread.jspa?threadID=2173463

The root certificate used to secure communications via the Secure Socket Layer (SSL) protocol expires on 31-Dec-2010 00:00:00O , so If you try to configure Database Console after that date the certificate will cause errors.

Luckyly, Oracle released patch 8350262 which solves this issue.

3. So the obviously following step is to apply patch 8350262 which doesn’t need to put the database offline. Just check the provided README.txt from the patch zip file and you’ll be safe.

4. Repeat steps 1 and 2 again, and your OEM will be up this time :)

Quick perl script to test smtp auth

#!perl

use warnings;
use strict;

use Net::SMTP;

my $smtpserver = 'xxx.yyy.zzz.www';
my $smtpuser   = 'foo@bar.com';
my $fromemail  = 'bleh@bar.com';

my $smtp = Net::SMTP->new($smtpserver, Timeout => 10, Debug => 1);
die "Could not connect to server!\n" unless $smtp;

  $smtp->auth ( 'user', 'secret' ) or die "Could not authenticate $!";
  $smtp->mail($smtpuser);
  $smtp->to('somebody@bar.com');
  $smtp->data();
  $smtp->datasend("To: somebody\@bar.com\n");
  $smtp->datasend("From: $fromemail\n");
  $smtp->datasend("\n");
  $smtp->datasend("Body message\n");
  $smtp->dataend();
  $smtp->quit;

 

Installing recovery console on a Service Pack >=2 Windows based computer

If you try to install the Recovery console into a Windows 2003 Server SP2 computer (or any windows service-packed computer) from the installation media, you may receive the  error:

“Setup cannot continue because the version of Windows on your computer is newer than the version on the CD.”

This happens because windows expects a Windows xxx SPyyy CD. If you don’t have a CD suitable for the service pack currently installed, follow this link.

If when running  FolderPath:\i386\winnt32.exe /cmdcons you receive the message “No valid system partitions were found” follow this other link as well.

As a plus, if you need the Recovery console commands syntax,  go here.

Unmounting stale NFS mount points in Linux

Sometimes, a stale NFS mount point can be a real PITA, specially if you can’t mount the share somewhere else.

The following command line have helped me a lot lately:

umount -f -l /path/to/nfs/share

The first parameter forces umount, the second makes a “lazy umount”, detaching the filesystem and cleaning up all references.

Easy isn’t it?

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.