Total Pageviews

Thursday 17 July 2014

Linux Problem and Solution

Not Ablr to Do WInscp in /home folder.

Cannot create remote file '/home/DBD-Oracle-1.58.tar.gz.filepart'. 
Error message from server: 
Failure Request code: 3 
Abort Retry Skip Skip all Help


Here,  Inode table was full due to maximum number of file creation/rename/modification ( in terms of date, time) inside folder /home/MSDP_B25/csms/queue ( this folder which creating file)  after that /home does not have permission to go beyond  4122212 no of file.

Hence we have recreated /home file system and increased Inode tables from 4122212 to 30000820.

Now will not face any kind of problem which you were facing earlier.

Old Inode Table value for HOME partitions was.
[root@MSDP81 spool]# df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/mapper/VolGroup-lv_root
                     3276800  329997 2946803   11% /
tmpfs                 490370       3  490367    1% /dev/shm
/dev/vda1             128016      39  127977    1% /boot
/dev/mapper/VolGroup-lv_home
                     4177920 4177920       0  100% /home

New Inode Table value for HOME partitions

[root@MSDP81 ~]# df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/mapper/VolGroup-lv_root
                     3276800  330373 2946427   11% /
tmpfs                 490370       3  490367    1% /dev/shm
/dev/vda1             128016      39  127977    1% /boot
/dev/mapper/VolGroup-lv_home
                     30000832      12 30000820    1% /home
You have new mail in /var/spool/mail/root

Command to increase inodes.

mkfs -t ext4 -N <Number of INodes value which you want to increase> /dev/mapper/VolGroup-lv_home

Exmp:

1.  1.      First umount /home partition from file system.


2.    2.     mkfs -t ext4 -N 30000820 /dev/mapper/VolGroup-lv_home



Tuesday 1 July 2014

Zombie Processes? Orphan process?

What are the Zombie Processes?


Note : Here number of Zombie Process is Zero.

On Unix and Linux systems, the zombie (or defunct) processes are dead processes that still apear in the process table, usually because of bugs and coding errors. A zombie process remains in the operating system and does nothing until the parent process determines that the exit status is no longer needed.
When does a process turn into a zombie?
Normally, when a process finishes execution, it reports the execution status to its parent process. Until the parent process decides that the child processes exit status is not needed anymore, the child process turns into a defunct or zombie process. It does not use resources and it cannot be schuduled for execution. Sometimes the parent process keeps the child in the zombie stateto ensure that the future children processes will not receive the same PID.
How to find and kill a zombie process:
You can find the zombie processes with ps aux | grep Z. The processes with Z in the STATE field are zombie processes:
$ ps aux | grep Z
How to kill a zombie process:
To kill a zombie process, find the zombie’s parent PID (PPID) and send him the SIGCHLD (17) signal: kill -17 ppid
I use this command to find a PPID: ps -p PID -o ppid
$  ps -p 20736 -o ppid

PPID

20735

$ kill -17 20735
Note: If you kill the parent of a zombie proceess, also the zombie process dies.

What are the Orphan Processes?

An Orphan Process is a process whose parent is dead (terminated). A process with dead parents is adopted by the init process.
When does a process become an orphan process?
Sometimes, when a process crashes, it leaves the children processes alive, transforming them into orphan processes. A user can also create a orphan process, by detaching it from the terminal.
How to find orphaned processes:
This command will not display only the orphaned processes, but all the processes having the PPID 1 (having the init process as it’s parent).
$ ps -elf | awk '{if ($5 == 1){print $4" "$5" "$15}}'

298 1 upstart-udev-bridge

302 1 udevd

438 1 /usr/sbin/sshd

[...]
Orphan processes use a lot of resources, so they can be easily found with top or htop. To kill an orphaned process, use kill -9 PID.


What are PID and PPID? / Child and Parent Process

What are PID and PPID?
If you have ever opened System Monitor or top you no doubt noticed a column named ID or PID containing a list of numbers. You might even see a value called PPID. What do these numbers mean?
Here is a short explanation of these Linux terms.
In Linux, an executable stored on disk is called a program, and a program loaded into memory and running is called a process. When a process is started, it is given a unique number called process ID (PID) that identifies that process to the system. If you ever need to kill a process, for example, you can refer to it by its PID. Since each PID is unique, there is no ambiguity or risk of accidentally killing the wrong process (unless you enter the wrong PID).
If you open top (in a terminal, type top and press enter), the PID column lists the process IDs of all processes currently loaded into memory regardless of state (sleeping, zombie, etc.). Both daemons (system processes) and user processes (processes you started either automatically or manually) have their own process IDs. The PIDs are not always assigned in numerical order, so it’s normal to see what appears to be a random selection of numbers.

init
One very important process is called init. init is the grandfather of all processes on the system because all other processes run under it. Every process can be traced back to init, and it always has a PID of 1. The kernel itself has a PID of 0.
What is the PPID?
In addition to a unique process ID, each process is assigned a parent process ID (PPID) that tells which process started it. The PPID is the PID of the process’s parent.
For example, if process1 with a PID of 101 starts a process named process2, then process2 will be given a unique PID, such as 3240, but it will be given the PPID of 101. It’s a parent-child relationship. A single parent process may spawn several child processes, each with a unique PID but all sharing the same PPID.

Why is the PPID Important?
Occasionally, processes go bad. You might try to quit a program only to find that it has other intentions. The process might continue to run or use up resources even though its interface closed. Sometimes, this leads to what is called a zombie process, a process that is still running, but dead.
One effective way to kill a zombie process is to kill its parent process. This involves using the ps command to discover the PPID of the zombie process and then sending a kill signal to the parent. Of course, any other children of the parent process will be killed as well.
pstree
pstree is a useful program that shows the relationship of all processes in a tree-like structure.

Give it a try to see how processes are arranged on your system. Processes do not float by themselves somewhere in memory. Each one has a reason for its existence, and a tree view helps show how it relates to others.
pstree supports options to adjust the output, so check man pstree for more details. Entering the following command lists the PID with each process and organizes processes by their ancestors (numerically) to show their relationship with each other.
pstree -pn

htop
For simpler process management and a better way to see how processes are organized, have a look at the program htop, which displays PID, optional PPID, process tree view, and much more information in glorious color!

Htop showing processes arranged in tree view along with PID and PPID.