Monday, 10 March 2014

Swap space calculation | Unix / Linux:

In general,

* 2GB swap space for 4GB of RAM or less.
* 4GB swap space for 4-16GB of RAM
* 8GB swap space for 16-64GB of RAM
* 16GB swap space for 64-256GB of RAM
* 32GB swap space for 256-512GB of RAM

But, Here is some-more detailed information about calculating swap space,

Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.

So, if:

M = Amount of RAM in GB, and S = Amount of swap in GB, then





Using this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time.

For systems with really large amounts of RAM (more than 32 GB) you can likely get away with a smaller swap partition (around 1x, or less, of physical RAM).

check: http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s1-swap-what-is.html

Sunday, 9 March 2014

LINUX - Detailed history of the commands:

Through 'history' command, We can see what are all the commands used before,

Normal 'history' command output:

#  history
    1  ls
    2  cd /
    3  cd
    4  cd /var/log/
    5  cd ..
    6  cd /
    7  cd
    8  history
Can we get more / exact details about when the commands were performed ?

Yes, we can get more information by usgin " export HISTTIMEFORMAT='%F %T ' "

After performing " export HISTTIMEFORMAT='%F %T ' ", the output goes like,

# export HISTTIMEFORMAT='%F %T '
# history
    1  2014-03-07 07:11:57 ls
    2  2014-03-07 07:12:00 cd /
    3  2014-03-07 07:12:01 cd
    4  2014-03-07 07:12:18 cd /var/log/
    5  2014-03-07 07:12:21 cd ..
    6  2014-03-07 07:12:24 cd /
    7  2014-03-07 07:12:25 cd
    8  2014-03-07 07:12:28 history
    9  2014-03-07 07:13:31 export HISTTIMEFORMAT='%F %T'
   10  2014-03-07 07:13:3 4history


Cheers !!!

Thursday, 6 March 2014

measuring exact IO wait:LINUX

iostat - Report Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions.

We can get detailed report from iostat with N for LABEL.

# iostat -xN 1

Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.00     4.00   51.00    2.00 11640.00    48.00   220.53     0.08    1.49   1.42   7.50
zz_root     0.00     0.00    2.00    6.00    48.00    48.00    12.00     0.00    0.00   0.00   0.00
yyy_swap     0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
xxxxx_home     0.00     0.00   49.00    0.00 11592.00     0.00   236.57     0.08    1.61   1.53   7.50

fuser: command lists the process numbers of local processes that use the local or remote files specified by the File parameter.

-v        verbose output
-m        show all processes using the named filesystems

# fuser -vm xxxxx_home