tag:blogger.com,1999:blog-84988672710872234942024-03-13T16:15:13.759+05:30System/Network Administrator's Blog for LinuxThis blog can be helpful who are interested in Linux,having basic knowledge of Linux Operating System & want to follow different Linux Based Services
It contains direct justified hand's on exercise without making more concentration on Theory.
Suggestions are welcomed.Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.comBlogger30125tag:blogger.com,1999:blog-8498867271087223494.post-45717766963255094042013-07-30T15:46:00.001+05:302013-07-30T15:52:51.793+05:30Linux Swap Space & Swappiness<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"><b>What is a SWAP Space?</b></span><br />
<div style="font-size: 12px; line-height: 18px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: normal;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the pre-configured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory and the swap space is the amount of virtual memory available.</span></div>
<div style="font-size: 12px; line-height: 18px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: normal;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Swapping is necessary for two important reasons. First, when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately. Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache.</span></div>
<div style="font-size: 12px; line-height: 18px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: normal;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">However, swapping does have a downside. Compared to memory, disks are very slow. Memory speeds can be measured in nanoseconds, while disks are measured in milliseconds, so accessing the disk can be tens of thousands times slower than accessing physical memory. The more swapping that occurs, the slower your system will be. Sometimes excessive swapping or thrashing occurs where a page is swapped out and then very soon swapped in and then swapped out again and so on. In such situations the system is struggling to find free memory and keep applications running at the same time. In this case only adding more RAM will help.</span></div>
<div style="font-size: 12px; line-height: 18px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: normal;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Linux has two forms of swap space: the swap partition and the swap file. The swap partition is an independent section of the hard disk used solely for swapping; no other files can reside there. The swap file is a special file in the filesystem that resides amongst your system and data files.</span></div>
<div style="margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
</div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>How big should my swap space be?</b></span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;"><br /></span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Many people follow an old rule of thumb that your swap partition should be twice the size of your main system RAM. This rule is nonsense. On a modern system, that's a LOT of swap, most people prefer that their systems never swap. You don't want your system to ever run out of RAM+swap, but you usually would rather have enough RAM in the system so it doesn't need to swap.</span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Red hat recommends setting as follows for RHEL 5</b>:</span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;"><br /></span></span></div>
<div style="text-align: left;">
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The reality is the amount of swap space a system needs is not really a function of the amount of RAM it has but rather the memory workload that is running on that system. A Red Hat Enterprise Linux 5 system will run just fine with no swap space at all as long as the sum of anonymous memory and system V shared memory is less than about 3/4 the amount of RAM. In this case the system will simply lock the anonymous and system V shared memory into RAM and use the remaining RAM for caching file system data so when memory is exhausted the kernel only reclaims pagecache memory.</span></span></div>
</div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;"><br /></span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Considering that</b>: </span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">1) At installation time when configuring the swap space there is no easy way to predetermine the memory a workload will require</span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">2) The more RAM a system has the less swap space it typically needs, a better swap space</span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;"><br /></span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Systems with 4GB of ram or less require a minimum of 2GB of swap space</span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Systems with 4GB to 16GB of ram require a minimum of 4GB of swap space</span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Systems with 16GB to 64GB of ram require a minimum of 8GB of swap space</span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Systems with 64GB to 256GB of ram require a minimum of 16GB of swap space</span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Note: Swap space will just keep operation running for a while on heavy duty servers by swapping process.It is possible to run a Linux system without a swap space, and the system will run well if you have a large amount of memory -- but if you run out of physical memory then the system will crash, as it has nothing else it can do, so it is advisable to have a swap space, especially since disk space is relatively cheap.</span></span></div>
<div style="font-size: 12px; line-height: 18px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: normal;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The key question is how much? Older versions of Unix-type operating systems (<u>such as Sun OS and Ultrix</u>) demanded a swap space of two to three times that of physical memory. Modern implementations (such as Linux) don't require that much, but they can use it if you configure it. A rule of thumb is as follows: 1) for a desktop system, use a swap space of double system memory, as it will allow you to run a large number of applications (many of which may will be idle and easily swapped), making more RAM available for the active applications; 2) for a server, have a smaller amount of swap available (say half of physical memory) so that you have some flexibility for swapping when needed, but monitor the amount of swap space used and upgrade your RAM if necessary; 3) for older desktop machines (with say only 128MB), use as much swap space as you can spare, even up to 1GB.</span></div>
<div style="font-size: 12px; line-height: 18px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: normal;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The Linux 2.6 kernel added a new kernel parameter called <b>swappiness</b> to let administrators tweak the way Linux swaps. It is a number from 0 to 100. In essence, higher values lead to more pages being swapped, and lower values lead to more applications being kept in memory, even if they are idle.</span></div>
<br />
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="background-color: orange;">My RHEL6 OS is showing below swappiness values.<br /><br />cat /proc/sys/vm/swappiness<br />60</span></span></span><br />
<div>
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span>
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">"<b>Swappiness</b>" is a property <span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;">for the Linux kernel that changes the balance between swapping out runtime memory, as opposed to dropping pages from the system page cache. Swappiness can be set to values between 0 and 100 inclusive. A low value means the kernel will try to avoid swapping as much as possible where a higher value instead will make the kernel aggressively try to use swap space. The default value is <code style="background-color: #f9f9f9; font-family: monospace, Courier;">60</code>, and for most desktop systems, setting it to 100 may affect the overall performance, whereas setting it lower (even 0) may improve interactivity.</span></span></span></div>
<div>
<div style="margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.4em;">
<span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>In short</b>:<br /><br />vm.swappiness = <span class="Apple-style-span" style="color: red;">0</span> - it will swap only to avoid an out of memory condition<br />vm.swappiness = <span class="Apple-style-span" style="color: red;">60</span> - default value<br />vm.swappiness = <span class="Apple-style-span" style="color: red;">100</span> - it will swap aggressively<br />###################################################################</span></span><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;">To temporarily set the swappiness in Linux, write the desired value (e.g. 10) to <span class="Apple-style-span" style="color: red;">/proc/sys/vm/swappiness</span> using the following command, running as root user:</span></span></div>
<div style="margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.4em;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: red;">echo 10 > /proc/sys/vm/swappiness</span></span></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;">###################################################################</span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;">Permanent changes are made in <span class="Apple-style-span" style="color: blue;">/etc/sysctl.conf</span> via the following configuration line</span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><span class="Apple-style-span" style="color: blue;">vm.swappiness = 10</span></span></div>
</div>
<div>
<span class="Apple-style-span" style="font-family: sans-serif; font-size: small;"><span class="Apple-style-span" style="font-size: 13px; line-height: 19px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: x-small; line-height: normal;">###################################################################</span></span></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;">Thanks,</span></span><br />
<b style="font-family: Arial, Helvetica, sans-serif; font-size: small;">Nishith N.Vyas</b></div>
</div>
Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-57695537352409454102013-06-11T13:56:00.003+05:302013-06-11T13:59:38.078+05:30Squid Access Log Customization (Date & Time Stamp)<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Subject: Adding date & time in squid access log file</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">By default, squid don't allow you to view "date & time stamp" of currently accessed websites & google searches. But, you may edit "/etc/squid/squid.conf" file to allow the same by modifying below lines.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">I. Open your <span class="skimwords-unlinked">squid.conf</span> and search for the line that starts with access_log or cache_access_log and looks like:</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<pre class="bbcodeblock" dir="ltr" style="border: 1px inset; height: 34px; margin-right: -99999px; margin: 0px; overflow: auto; padding: 3px; text-align: left; width: 98%;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="color: red;">access_log /var/log/squid/<span class="skimwords-unlinked">access.log</span> <b>squid</b></span></span></pre>
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">II. Note the last keyword (in this case <span class="Apple-style-span" style="color: red;"><b>squid</b></span>, but it could be common, combined, squidmime)</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">III. Then look for the line that starts with logformat. In my case, it has shown below.</span><br />
<br />
<pre class="bbcodeblock" dir="ltr" style="border: 1px inset; height: 34px; margin-right: -99999px; margin: 0px; overflow: auto; padding: 3px; text-align: left; width: 98%;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="color: red;">logformat squid %ts.%03tu %6tr %>a %Ss/%03Hs %<st font="" h="" mt="" rm="" ru="" un=""></st></span></span></pre>
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">By default, it is commented. Just need to replace above shown line with below.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">logformat squid %tl %6tr %>a %Ss/%03Hs %<st font="" h="" mt="" rm="" ru="" un=""></st></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Note</b>: You can take a look at <span class="skimwords-unlinked">squid.conf.default</span> that comes with squid and it's well documented to see other available options for customizing your logs.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Finally, <u><span class="Apple-style-span" style="color: blue;">restart/reload squid service</span></u> & execute below command to verify the configuration of "Date & Time" stamp. Sample example is as given below.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">tail -f /var/log/squid/access.log</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;"><b><span class="Apple-style-span" style="color: #38761d;">11/Jun/2013:13:53:47 +0530 </span></b><span class="Apple-style-span" style="color: #38761d;"> </span> 22 10.101.19.147 TCP_MEM_HIT/200 2677 GET http://i8.dainikbhaskar.com/thumbnail/69x60/web2images/www.divyabhaskar.co.in/2013/06/10/5548_joke-7.jpg - NONE/- image/jpeg</span></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;"><br /></span></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;"><b><span class="Apple-style-span" style="color: #38761d;">11/Jun/2013:13:53:49 +0530</span></b> 569 10.101.19.147 TCP_MISS/200 4881 GET http://i8.dainikbhaskar.com/thumbnail/120x104/web2images/www.divyabhaskar.co.in/2013/06/10/4459_yadav8.jpg - DIRECT/80.150.193.186 image/jpeg</span></span><br />
<div style="font-family: Arial, Helvetica, sans-serif;">
<span class="Apple-style-span" style="font-size: x-small;"><br /></span></div>
<div style="font-family: Arial, Helvetica, sans-serif;">
<span class="Apple-style-span" style="font-size: x-small;"><br /></span></div>
<div style="font-family: Arial, Helvetica, sans-serif;">
<span class="Apple-style-span" style="font-size: x-small;"><br /></span></div>
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Regards,</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Nishith N.Vyas</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
</div>
Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com2tag:blogger.com,1999:blog-8498867271087223494.post-36212865242128307792013-05-31T16:14:00.001+05:302013-05-31T16:14:57.278+05:30Run VLC Player as "root" user in Fedora/RHEL/CentOS<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><b><span class="Apple-style-span" style="color: blue;">Subject</span></b>: Run "VLC Player" as a "root" user in Fedora/RHEL/CentOS 5x/6x</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">This hand's on assumes that you have installed VLC media player on your respective Linux platform & having "rpmforge & rpmfusion" repository in <b>"/etc/yum.repos.d/"</b> directory.</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Perform below hand's now.</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">1) Install "hexedit" utility in linux using yum. The command is,</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">yum install hexedit</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">2) After successful installation, open "/usr/bin/vlc" using hexeditor as given below.</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">hexedit /usr/bin/vlc</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">3) Now, Press <b>"TAB"</b> key</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">4) Now, Press <b>"Ctrl + S"</b> key to search ASCII string.</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">5) In the given search box, type <b>"geteuid"</b> & replace it with <b>"getppid"</b></span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">6) Now, Press <b>"Ctrl + X"</b> to save the file.</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Finally, your VLC player is ready to run as "root" user. Verify it & comments are always welcomed,if this post is useful to you.</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">This hand's on has been tested on <b><span class="Apple-style-span" style="color: red;">"CentOS & RHEL 6.0" </span></b>& will work with Fedora editions too.</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><b><span class="Apple-style-span" style="color: blue;">Nishith N.Vyas</span></b></span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
</div>
Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com3tag:blogger.com,1999:blog-8498867271087223494.post-29084935542532608372013-03-15T15:03:00.000+05:302013-03-15T15:09:08.669+05:30Block Ultrasurf in RedHat Linux Squid<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Subject:</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="color: purple;"><b>Block "<u>Ultrasurf</u>" in RedHat Linux Squid. Successfully tested on "2.6.STABLE6-4.el5" version.</b></span></span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Hello All,</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Prior to do anything in squid configuration, it is necessary to understand about "what ultrasurf is" & why it is popular.!!!!</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="line-height: 20px;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Ultrasurf is a product of <u>Ultrareach Internet Corporation</u>. Originally created to help internet users in <span class="Apple-style-span" style="color: red;">China</span> find security and freedom online, Ultrasurf has now become one of the world's most popular anti-censorship, pro-privacy software, with millions of people using it to bypass internet censorship and protect their online privacy.</span></span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Visit <a href="https://ultrasurf.us/">https://ultrasurf.us/</a> for more information.</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Coming directly onto "practical", kindly add below lines in "/etc/squid/squid.conf" file.</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">#####Create New ACL#####</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">acl UltraSurf port 9666</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">acl ipacl url_regex http://[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">acl numeric_IPs url_regex ^[0-9]+.[0-9]+.[0-9]+.[0-9]+</span><br />
<div style="font-family: Verdana, sans-serif;">
<br /></div>
<div style="font-family: Verdana, sans-serif;">
#####Deny all ACL#####</div>
<div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">http_access deny UltraSurf</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">http_access deny ipacl</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">http_access deny numeric_IPs</span></div>
<div style="font-family: Verdana, sans-serif;">
<span class="Apple-style-span" style="color: red;">http_access deny all --- This is the default line.This is for your reference only to add all lines before this only.</span></div>
</div>
<div style="font-family: Verdana, sans-serif;">
<br /></div>
<div style="font-family: Verdana, sans-serif;">
<b>Note</b>: Above configuration is useful if "ultrasurf" is installed in LAN Computers. But, still anyone can download "ultrasurf" from internet. So, it is better to block the "<u>ultrasurf name & domain</u>" using below ACL</div>
<div style="font-family: Verdana, sans-serif;">
<br /></div>
<div style="font-family: Verdana, sans-serif;">
##################################</div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">acl blockregexurl url_regex -i ultrasurf</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">acl block-site dstdomain .ultrasurf.us</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">http_access deny blockregexurl</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">http_access deny block-site</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">##################################</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><b>Note</b>: Now, Squid will block all Internet requests, having "<u>ip address</u>" in URL. So, you need to add another ACL to allow certain IP Addresses, In use in your LAN segment for "<u>Hosting or R&D purpose</u>", if any.</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-family: 'Times New Roman';"></span></span><br />
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-family: 'Times New Roman';"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;">##################################</span></span></span></div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-family: 'Times New Roman';">
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">acl bypass_ultrasurf_ip dstdomain 172.24.23.1 192.168.1.2 59.167.154.20</span></div>
</span></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="color: blue;">http_access allow bypass_ultrasurf_ip</span> <span class="Apple-style-span" style="color: blue;">--- Put this line above the "<u>deny ultrasurf</u>" lines only.</span></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-family: 'Times New Roman';"></span></span><br />
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-family: 'Times New Roman';"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;">##################################</span></span></span></div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-family: 'Times New Roman';">
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
</span></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><b>SUM UP</b>:</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">This configuration has been tested to block "ultrasurf & all it's alternatives" as given below.</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">* tor</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">* GTunnel</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">* FreeGate</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">* Tunnelier</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Thanks,</span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><b>Nishith N.Vyas</b></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
</div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<br /></div>
Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com2tag:blogger.com,1999:blog-8498867271087223494.post-48114822010957974522013-03-15T14:19:00.000+05:302013-03-15T14:19:45.047+05:30IBM JFS (Journaling File System) Introduction<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">IBM JFS is a 128 bit file system available in AIX Operating System. Currently available versions are JFS v1 & v2.</span><div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">JFS means "keep track of file system changes", before committing them to the main file system. So, in the event of "sudden power failure or system crash", such file systems are quicker to bring back online & less likely to become corrupted. </span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;">JFS & i-nodes</span></b></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif; line-height: 16px;">JFS allows you to specify the number of disk i-nodes created within a file system in case more or fewer than the default number of disk i-nodes is desired.</span></div>
<div>
<div class="p" style="font-weight: bold; line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">NBPI<span class="Apple-style-span" style="font-weight: normal;"> = The number of disk i-nodes at file system creation is specified in a value called as the </span><em class="ph i" style="font-style: italic; font-weight: normal;">number of bytes per i-node</em><span class="Apple-style-span" style="font-weight: normal;"> or <u>NBPI</u></span></span></div>
<div class="p" style="font-weight: normal; line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="line-height: normal;"><b></b></span></div>
<div class="p" style="display: inline !important; font-weight: normal; line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;">For example, an <u><span class="Apple-style-span" style="color: red;">NBPI value of 1024</span></u> causes a disk i-node to be created for every <span class="Apple-style-span" style="color: red;">1024 bytes of file system</span> disk space. </span></b></div>
<br />
<div class="p" style="line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="line-height: normal;"></span></div>
<div class="p" style="display: inline !important; line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="line-height: normal;"></span></div>
<div class="p" style="display: inline !important; line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Another way to look at this is that a small NBPI value (512 for instance) results in a large number of i-nodes, while a large NBPI value (such as 16,384) results in a small number of i-nodes.</span></div>
<br />
<br />
<div class="p" style="line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">For JFS file systems, one i-node is created for every NBPI bytes of allocation group space allocated to the file system. The total number of i-nodes in a file system limits the total number of files and the total size of the file system. An allocation group can be partially allocated, though the full number of i-nodes per allocation group is still allocated. NBPI is inversely proportional to the total number of i-nodes in a file system.</span></div>
<div class="p" style="font-weight: normal; line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">The JFS restricts all file systems to <span class="Apple-style-span" style="color: blue;">16M (<samp class="ph codeph">2</samp><samp class="ph codeph"><sup class="ph sup">24</sup></samp>) i-nodes</span></span></div>
<div class="p" style="font-weight: normal; line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">The set of allowable NBPI values vary according to the allocation group size (<em class="ph i" style="font-style: italic;">agsize</em>). </span></div>
<div class="p" style="font-weight: normal; line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">The default is 8 MB. The allowable NBPI values are 512, 1024, 2048, 4096, 8192, and 16,384 with an <em class="ph i" style="font-style: italic;">agsize</em> of 8 MB. A larger <em class="ph i" style="font-style: italic;">agsize</em> can be used. </span></div>
<div class="p" style="font-weight: normal; line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">The allowable values for <em class="ph i" style="font-style: italic;">agsize</em> are 8, 16, 32, and 64. The range of allowable NBPI values scales up as <em class="ph i" style="font-style: italic;">agsize</em> increases. If the <em class="ph i" style="font-style: italic;">agsize</em> is doubled to 16 MB, the range of NBPI values also double: 1024, 2048, 4096, 8193, 16384, and 32768.</span></div>
</div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><b>JFS2 & i-nodes</b></span></div>
<div>
<span class="Apple-style-span" style="font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 16px;">JFS2 allocates i-nodes as needed.</span></div>
<div>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-family: Verdana, Arial, Helvetica, sans-serif;"><div class="p" style="line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
If there is room in the file system for additional i-nodes, they are automatically allocated. <span class="Apple-style-span" style="color: #38761d;"><b>Therefore, the number of i-nodes available is limited by the size of the file system itself</b></span>.</div>
<div class="p" style="line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<b><br /></b></div>
<div class="p" style="line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<b>Nishith N.Vyas</b></div>
<div class="p" style="line-height: 16px; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
</span></span></div>
</div>
Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-76175977145246609092013-03-14T14:54:00.002+05:302013-03-14T14:54:22.950+05:30Understanding Load Average in LINUX/UNIX/AIX<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The term “load average” is used in many "Linux/UNIX/AIX" Operating Systems as a major utility.</span></div>
<div style="margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;">
</div>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Everybody knows that the numbers the term “load average” refers to, usually three numbers, somehow represent the load on the system’s CPU. In this post I’ll try making this three numbers clearer and understandable.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The easiest way to see the “load average” of your system is by "uptime" command.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span id="more-61" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></span><br /></span>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">It also appears in "top" command in Linux & "topas" command in UNIX/AIX. </span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">In all three cases the load average refers to a group of three numbers. For example, in the following output of "uptime"</span><span class="Apple-style-span" style="font-family: monospace;">,</span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">10:41:47 up 5 days, 48 min, 1 user, load average:<span class="Apple-style-span" style="color: red;"> </span><b><span class="Apple-style-span" style="color: red;">0.82</span>, <span class="Apple-style-span" style="color: #38761d;">0.71</span>, <span class="Apple-style-span" style="color: blue;">0.66</span></b></span></div>
<div style="color: #222222; margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><code style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></code></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The last three numbers are the “load average”. Each number represent the systems load as a moving average over 1, 5 and 15 minutes respectively. Now, the important thing is to understand what is being averaged, the load metric.</span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The metric that represent the load at a given point in time is how many process are queued for running at each given time (including the process that is currently being ran). Generally speaking, on a single core machine, this can be looked at as CPU utilization percentage when multiplied by 100. </span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">For example if I had a load-average of 0.50 in the last minute, this means that over the last minute half of the time the CPU was idle as it had <span style="font-size: 18.3333px; font-weight: bold;"><span class="Apple-style-span" style="font-size: small; font-weight: normal;">no running process</span></span>. </span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">On the other hand if I had load average of 2.50 it means that over the last minute an average of <span style="font-size: 18.3333px; font-weight: bold;"><span class="Apple-style-span" style="font-size: small; font-weight: normal;">1.5 process</span></span> were waiting to their turn to run. So, the CPU was overloaded by 150%.</span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">On a <span style="font-size: 18.3333px; font-weight: bold;"><span class="Apple-style-span" style="font-size: small; font-weight: normal;">multi-core</span></span> (Like Core 2 Duo, IBM Power Servers, HP Itanium Servers) systems things are a bit different, but in order to avoid unnecessary complications one can usually <span style="font-size: 18.3333px; font-weight: bold;"><span class="Apple-style-span" style="font-size: small; font-weight: normal;">divide the load-average by the number of cores</span></span> and treat the result as the <span style="font-size: 18.3333px; font-weight: bold;"><span class="Apple-style-span" style="font-size: small; font-weight: normal;">load average of single core machine</span></span>.</span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">For example, let’s say the load average of a two-core machine was<span class="Apple-style-span" style="color: red;"> <span class="Apple-style-span"><b>3.00</b></span></span><b> <span class="Apple-style-span"><span class="Apple-style-span" style="color: #38761d;">2.00</span></span> <span class="Apple-style-span"><span class="Apple-style-span" style="color: blue;">0.50</span></span></b></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">This means that over the last minute we had an average of three runnable process (<span class="Apple-style-span"><b><span class="Apple-style-span" style="color: red;">3.00</span></b></span>), this means that <span style="font-size: 18.3333px; font-weight: bold;"><span class="Apple-style-span" style="font-size: small; font-weight: normal;">one process</span></span>, in average, was queued as there are <span style="font-size: 18.3333px; font-weight: bold;"><span class="Apple-style-span" style="font-size: small; font-weight: normal;">two core</span></span> in the machine that can run to process at a time. So the machine was <u>overloaded had a load of 150%</u> its capability. </span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Over the last 5 minutes the load average of <span class="Apple-style-span"><b><span class="Apple-style-span" style="color: #38761d;">2.00</span></b></span><span class="Apple-style-span"> means that we roughly had </span><span style="font-size: 18.3333px; font-weight: bold;"><span class="Apple-style-span" style="font-size: small; font-weight: normal;">2 process</span></span><span class="Apple-style-span"> running each time, so the machine was </span><span style="font-size: 18.3333px; font-weight: bold;"><span class="Apple-style-span" style="font-size: small; font-weight: normal;">fully utilized</span></span> but <u>wasn’t overloaded by work</u>. </span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Over last 15 minutes the load-average of <span class="Apple-style-span"><b><span class="Apple-style-span" style="color: blue;">0.50</span></b></span> means that we could handle 4 time that load without overloading the CPU, we only had (0.50/2)*100=<u>25% CPU utilization</u> in that 15 minutes.</span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Hope now everybody is clear about "Load Average Term".</span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Nishith N.Vyas</b></span></div>
</div>
Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com1tag:blogger.com,1999:blog-8498867271087223494.post-7483011525790936912012-04-11T15:55:00.004+05:302012-04-11T16:11:30.251+05:30Set User Password using single command line in Linux<span style="font-family: arial;"><span style="font-weight: bold;">To set "Linux User" password using single command line.</span><br /><br />On your shell prompt, type below command.<br />echo -e "Hello\nHello" | passwd nishith<br /><br />Here,<br /><span style="font-weight: bold;">-e</span> : effect<br /><span style="font-weight: bold;">\n </span>: New Line<br /><span style="font-weight: bold;">Hello</span> : Mentioned twice as "password & retype password" <span style="font-weight: bold;">;)</span><br /><span style="font-weight: bold;">nishith</span> : User Name<br /><br /><span style="font-weight: bold;">Change the password of "nishith" users on a bunch of servers i.e. 10-20 servers.</span><br /><br />Let's say server ip address range is from "192.168.10.1 to 192.168.10.20"<br /><br /></span><span style="font-family: arial;">On your shell prompt, type below command.<br /><br />for ((i=1,i<=20;i++); do ssh 192.168.10.$i 'echo -e "Hello\nHello" | passwd nishith'; done;<br /></span><br /><span style="font-family: arial;"><span style="font-weight: bold;">Create one user & set it's initial password remotely.</span><br /><br />ssh <remoteserver ip=""> 'useradd <newuser name="">; echo -e "passwdofuser\npasswordofuser" | passwd newuser<span style="font-family: monospace;">'<br /><br /></span><span style="font-weight: bold; font-family: arial;font-size:130%;" >Example:<br /><br /></span><span style="font-family: arial;font-size:100%;" >ssh root@192.168.10.10 'useradd nishith1; echo -e "Hello1\nHello1" | passwd nishith1'<br /><br />It will ask "root" password of 192.168.10.10 & rest will be taken care by the command itself.<br /><br /><br /><span style="font-weight: bold;">Enjoy Linux</span><br /></span><span style="font-family: monospace;"></span></newuser></remoteserver></span><span style="font-family: monospace;"></span>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-36973749657664617622012-03-30T14:00:00.004+05:302012-03-30T14:15:46.560+05:30Linux Boot Process Stages<span style="font-family: arial;">Hello,<br /><br />Herewith I am posting "Linux Boot Process" in such an easy way so that you can understand it properly.<br /><br />1) First stage is obviously called "POST"<br />(POST = Power On Self Test, Means if you get "beep" sound, the computer hardware is working properly i.e. your electronic circuit)<br /><br />2) BIOS<br /><br />3) MBR = Master Boot Record. Having size of 512 Bytes. The Byte distribution inside MBR is,<br /><br />446 Bytes = Primary Boot Loader<br />64 Bytes = Partition Table<br />2 Bytes = MBR Validation Check<br /><br />4) Loading Linux Loader called GRUB (<span style="color: rgb(255, 0, 0);">GR</span>and <span style="color: rgb(255, 0, 0);">U</span>nified <span style="color: rgb(255, 0, 0);">B</span>oot Loader)<br />(Please note that /etc/grub/grub.conf is<span style="color: rgb(51, 51, 255);"> linked</span> with /boot/grub/grub.conf"<br /><br />5) Kernel Loads. The sub processes are,<br /><br />* Mounts the "/root" file system<br />* PID of this process would be "1"<br />* "initrd" (Initial RAM Disk), used by kernel as a temporary "root" file system until kernel is boot properly & the real "root" file system is mounted.<br /><br />"initrd" contains necessary drivers to load.<br /><br />6) "init" process loads entries mentioned inside "/etc/inittab" & "/etc/rc.sysinit" files.<br /><br />7) "runlevel" loads the respective files & service mentioned inside "/etc/rc.d/rc*.d/<files><br />* There are total 6 runlevel are available by default.<br />* If you set "runlevel 5" in "/etc/inittab", then it will load all drivers & services available inside<br />"/etc/rc.d/rc5.d/<span style="color: rgb(102, 0, 204);"><files></files></span><br /><br />"S" letter shows (Service to start during "startup")<br />"K" letter shows (Service to kill during "startup")<br /><br />That's it.<br /><br />So, in short Linux boot stages are,<br />POST, BIOS,MBR,Kernel,INIT & Runlevel<br /><br /><span style="font-weight: bold; color: rgb(255, 0, 0);">EOF</span><br /></files></span>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-91931328366787838292012-03-15T12:16:00.009+05:302012-03-15T12:21:59.131+05:30Linux Server Monitoring Commands You Really Need To Know<span class="Apple-style-span" style="border-collapse: separate; color: rgb(55, 53, 74); font-family: Arial; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-size: 14px; line-height: 21px; text-align: left; "><p style="padding: 0px 0px 10px; margin: 0px; list-style-type: none;">Hello Friends,<br /></p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">Want to know what's really going on with your server? Then you need to know these essential commands. Once you've mastered them, you'll be well on your way to being an expert Linux system administrator.</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">Depending on the Linux distribution, you can run pull up much of the information that these shell commands can give you from a GUI program.<span class="Apple-converted-space"> </span><a href="http://www.suse.com/" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">SUSE Linux</a>, for example, has an excellent, graphical configuration and management tool,<span class="Apple-converted-space"> </span><a href="http://en.opensuse.org/Portal:YaST" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">YaST</a>, and<span class="Apple-converted-space"> </span><a href="http://www.kde/" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">KDE</a>'s<span class="Apple-converted-space"> </span><a href="http://userbase.kde.org/KSysGuard" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">KDE System Guard</a><span class="Apple-converted-space"> </span>is also excellent.</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">However, it's a Linux administrator truism that you should run a GUI on a server only when you absolutely must. That's because Linux GUI's take up system resources that could be better used elsewhere. So, while using a GUI program is fine for basic server health check ups, if you want to know what's<span class="Apple-converted-space"> </span><em style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-style: italic; font-weight: normal; ">really</em><span class="Apple-converted-space"> </span>happening, turn off the GUI and use these tools from the Linux command shell.</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">This also means that you should only start a GUI on a server when it's required; don’t leave it running. For optimum performance, a Linux server should run at<span class="Apple-converted-space"> "</span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">runlevel 3</tt>", which fully supports networking and multiple users but doesn't start the GUI when the machine boots. If you really need a graphical desktop, you can always get one by running "<tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">startx"</tt><span class="Apple-converted-space"> </span>from a shell prompt.</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><span style="font-weight: bold;">Note</span>: If your server starts by booting into a graphical desktop, you need to change this. To do so, head to a terminal window,<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">"su</tt><span class="Apple-converted-space">" </span>to the root user, and use your favourite editor on<tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "> /etc/inittab</tt>.</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">Once there, find the<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span style="font-weight: bold;">initdefault</span> line</tt><span class="Apple-converted-space"> </span>and change it from<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">id:5:initdefault:</tt><span class="Apple-converted-space"> </span>to<tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">id:3:initdefault:</tt></p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">If there is no<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">inittab</tt><span class="Apple-converted-space"> </span>file, create it, and add the<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">id:3</tt><span class="Apple-converted-space"> </span>line. Save and exit. The next time you boot into your server it will boot into "runlevel 3". If you don't want to reboot after this change, you can also set your server's run level immediately with the command:<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">init 3</tt></p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">Once your server is running at init 3, you can start using the following shell programs to see what's happening inside your server.</p><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">iostat</h3><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">The<span class="Apple-converted-space"> </span><a href="http://www.cyberciti.biz/tips/linux-disk-performance-monitoring-howto.html" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">iostat</a><span class="Apple-converted-space"> </span>command shows in detail what your storage subsystem is up to. You usually use<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">iostat</tt><span class="Apple-converted-space"> </span>to monitor how well your storage sub-systems are working in general and to spot slow input/output problems before your clients notice that the server is running slowly. Trust me, you want to spot these problems before your users do!</p><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">meminfo and free</h3><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><a href="http://www.redhat.com/advice/tips/meminfo.html" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">Meminfo</a><span class="Apple-converted-space"> </span>gives you a detailed list of what's going on in memory. Typically you access meminfo's data by using another program such as<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">cat</tt><span class="Apple-converted-space"> </span>or<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">grep</tt>. For example,</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">cat /proc/meminfo</tt></p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">gives you the details of what's going on in your server’s memory at any given moment.</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">For a quick “just the facts” look at memory, you can use the<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">free</tt><span class="Apple-converted-space"> </span>command. In short,<tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">free</tt><span class="Apple-converted-space"> </span>gives you the overview;<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">meminfo</tt><span class="Apple-converted-space"> </span>gives you the details.</p><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">mpstat</h3><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">The<span class="Apple-converted-space"> </span><a href="http://linuxcommand.org/man_pages/mpstat1.html" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">mpstat</a><span class="Apple-converted-space"> </span>command reports on the activities of each of the available CPUs on a multi-processor server. These days, thanks to<span class="Apple-converted-space"> </span><a href="http://h30565.www3.hp.com/t5/Feature-Articles/What-Does-x86-Need-to-Compete-With-RISC/ba-p/1222" target="_blank" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">multi-core processors</a>, that’s almost all servers.<tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">mpstat</tt><span class="Apple-converted-space"> </span>also reports on the average activities of all your server's CPUs. It enables you to display overall CPU statistics per system or per processor. This overview can alert you to possible application problems before they get to the point of annoying users.</p><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">netstat</h3><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><a href="http://www.thegeekstuff.com/2010/03/netstat-command-examples/" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">Netstat</a>, like<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">ps</tt>, is a Linux tool that administrators use every day. It displays a lot of network related information, such as socket usage, routing, interface, protocol, network statistics, and more. Some of the most commonly used options are:</p><blockquote style="padding-top: 10px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 10px; quotes: none; "><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-a</tt><span class="Apple-converted-space"> </span>Show all socket information</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-r</tt><span class="Apple-converted-space"> </span>Show routing information</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-i</tt><span class="Apple-converted-space"> </span>Show network interface statistics</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-s</tt><span class="Apple-converted-space"> </span>Show network protocol statistics</p></blockquote><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">nmon</h3><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><a href="http://nmon.sourceforge.net/pmwiki.php" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">Nmon</a>, short for Nigel's Monitor, is a popular<span class="Apple-converted-space"> </span><a href="http://h30565.www3.hp.com/t5/Feature-Articles/Crafting-Small-Business-Open-Source-Policies/ba-p/1368" target="_blank" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">open-source</a><span class="Apple-converted-space"> </span>tool to monitor Linux systems performance. Nmon watches the performance information for several subsystems, such as processor utilization, memory utilization, run queue information, disk I/O statistics, network I/O statistics, paging activity, and process metrics. You can then view nmon's real-time system measurements via its<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">curses</tt><span class="Apple-converted-space"> </span>“graphical” interface.</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><img src="http://h30565.www3.hp.com/t5/image/serverpage/image-id/470i5E2CC10E597C9FA7/image-size/original?v=mpbl-1&px=-1" alt="sjvn_LinuxServerMonitoring_nmon.png" title="sjvn_LinuxServerMonitoring_nmon.png" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; outline-style: none; outline-width: initial; outline-color: initial; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; max-width: 100%; display: inline-block; " align="middle" border="0" /></p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">To run<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">nmon</tt>, you start the tool from the shell. Once up, you select the subsystems to monitor by typing in its one-key commands. For example, to get CPU, memory, and disk statistics, you type<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">c</tt>,<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">m</tt>, and<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">d</tt>. You can also use<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">nmon</tt><span class="Apple-converted-space"> </span>with the<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-f</tt><span class="Apple-converted-space"> </span>flag to save performance statistics to a CSV file for later analysis.</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">For day to day server monitoring I find<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">nmon</tt><span class="Apple-converted-space"> </span>to be the single most useful program in my Linux system management tool-kit.</p><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">pmap</h3><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">The<span class="Apple-converted-space"> </span><a href="http://linuxcommand.org/man_pages/mpstat1.html" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">pmap</a><span class="Apple-converted-space"> </span>command reports the amount of memory that your server's processes are using. You can use this tool to determine which processes on the server are being allocated memory and whether any of these processes are being piggy with RAM.</p><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">ps and pstree</h3><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">The<span class="Apple-converted-space"> </span><a href="http://www.linux.ie/newusers/beginners-linux-guide/ps.php" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">ps</a><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><a href="http://www.linfo.org/pstree.html" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">pstree</a><span class="Apple-converted-space"> </span>commands are two of the Linux administrator’s best friends. They both provide a list of all currently running processes.<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Ps</tt><span class="Apple-converted-space"> </span>tells you how much memory and processor time the server’s programs are using.<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Pstree</tt><span class="Apple-converted-space"> </span>shows less information, but highlights which processes are the children of other processes. Armed with this information, you can spot out–of-control processes and kill them off with Linux's “take no prisoners”<span class="Apple-converted-space"> </span><a href="http://linux.about.com/library/cmd/blcmdl_kill.htm" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">kill</a><span class="Apple-converted-space"> </span>command.</p><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">sar</h3><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">The<span class="Apple-converted-space"> </span><a href="http://www.thegeekstuff.com/2011/03/sar-exampl" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">sar</a><span class="Apple-converted-space"> </span>program is a Swiss-army knife of a system monitoring tool. The<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">sar</tt><span class="Apple-converted-space"> </span>command is actually made up of three programs:<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">sar</tt>, which displays the data, and<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">sa1</tt><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">sa2</tt>, which collect and store it. Once installed,<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">sar</tt><span class="Apple-converted-space"> </span>creates a detailed overview of CPU utilization, memory paging, network I/O and transfer statistics, process creation activity, and<span class="Apple-converted-space"> </span><a href="http://h30565.www3.hp.com/t5/Feature-Articles/Securing-Data-at-Rest-with-Encrypted-Portable-Drives/ba-p/243" target="_blank" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">storage device</a><span class="Apple-converted-space"> </span>activity. The big difference between<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">sar</tt><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">nmon</tt><span class="Apple-converted-space"> </span>is that the former is better at long-term system monitoring, while I find<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">nmon</tt><span class="Apple-converted-space"> </span>to be better at giving me a quick read on my server's status.</p><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">strace</h3><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><a href="http://www.hokstad.com/5-simple-ways-to-troubleshoot-using-strace.html" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">strace</a><span class="Apple-converted-space"> </span>is often thought of a programmer's debugging tool, but it's more than that. It intercepts and records the system calls that are called by a process. This makes it a useful diagnostic, instructional, and debugging tool. For example, you can use<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">strace</tt><span class="Apple-converted-space"> </span>to find out which configuration file a program is actually using when it starts up.</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Strace</tt><span class="Apple-converted-space"> </span>does have one flaw though. When it's checking out a specific process, that process' performance will fall through the floor. Thus, I only use<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">strace</tt><span class="Apple-converted-space"> </span>when I already have a darned good reason to think that<span class="Apple-converted-space"> </span><em style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-style: italic; font-weight: normal; ">that</em><span class="Apple-converted-space"> </span>program is causing trouble.</p><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">tcpdump</h3><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><a href="http://danielmiessler.com/study/tcpdump/" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">Tcpdump</a><span class="Apple-converted-space"> </span>is a simple, robust network monitoring utility. Its basic protocol analyzing capability enables you to get a rough view of<span class="Apple-converted-space"> </span><a href="http://h30565.www3.hp.com/t5/Feature-Articles/Understanding-Syslog-Managers-and-How-to-Use-Them/ba-p/1488" target="_blank" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">what is happening on your network</a>. To really dig into what's going on with your network however, you'll want to use<span class="Apple-converted-space"> </span><a href="http://ww/" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">Wireshark</a><span class="Apple-converted-space"> </span>(see below).</p><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">top</h3><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">The<span class="Apple-converted-space"> </span><a href="http://adminlinux.blogspot.com/2009/06/how-do-i-use-linux-top-command.html" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">top</a><span class="Apple-converted-space"> </span>command shows what's going on with your active processes. By default, it displays the most CPU-intensive tasks running on the server and updates the list every five seconds. You can sort the processes by PID (Process ID); age, newest first; time, by cumulative time; and resident memory usage and total time it's been using the CPU since startup. I find this a fast and easy way to see if any process is starting to go out of control and about to get into trouble.</p><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">uptime</h3><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">Use<span class="Apple-converted-space"> </span><a href="http://www.computerhope.com/unix/uptime.htm" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">uptime</a><span class="Apple-converted-space"> </span>to see how long the server has been running and how many users are logged on. It also gives you an overview of the average server load. The optimal value of the load is 1 or less, which means that each process has immediate access to the CPU and there are no CPU cycles lost.</p><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">vmstat</h3><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">For the most part, you use<span class="Apple-converted-space"> </span><a href="http://www.linuxjournal.com/article/8178" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">vmstat</a><span class="Apple-converted-space"> </span>to monitor what's going on with virtual memory. Linux constantly uses virtual memory to get the best possible storage performance.</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">If your applications are taking up too much memory you get excessive page-outs — programs moving from RAM to your system's swap space, which is on the hard drive. Your server can reach a point where it's spending more time managing memory paging than running your applications, a condition called thrashing. When your computer is thrashing, its performance falls through the floor.<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Vmstat</tt>, which can display either average data or actual samples, can help you spot memory pig programs and processes before they bring your server to a crawl.</p><h3 style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; font-size: 14px; font-weight: bold; line-height: 17px; font-family: Arial; ">Wireshark</h3><p style="padding: 0px 0px 10px; margin: 0px; list-style-type: none;"><a href="http://www.wireshark.org/" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">Wireshark</a>, formerly known as Ethereal (and still often referred to that way), is<span class="Apple-converted-space"> </span><tt style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">tcpdump</tt>'s big brother, though it is more sophisticated and with far more advanced protocol analyzing and reporting. Wireshark has both a GUI interface and a shell interface. If you do any serious network administration, you<span class="Apple-converted-space"> </span><em style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-style: italic; font-weight: normal; ">must</em><span class="Apple-converted-space"> </span>use ethereal.</p><p style="padding: 0px 0px 10px; margin: 0px; list-style-type: none;"><span style="font-weight: bold;">Note:</span> If you're using Wireshark/ethereal, I highly recommend Chris Sander's<span class="Apple-converted-space"> </span><a href="http://www.amazon.com/gp/product/B002N3M6RC/ref=as_li_ss_tl?ie=UTF8&tag=thegroovycorpora&linkCode=as2&camp=1789&creative" target="_blank" rel="nofollow" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; text-decoration: none; color: rgb(51, 153, 204); ">Practical Packet Analysis</a>, a great book on how to get the most out of this useful program.</p><p style="padding: 0px 0px 10px; margin: 0px; list-style-type: none;"><br /></p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">Have A Good Day Ahead...<br /></p></span></span>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-56031578759248199752012-01-23T11:42:00.008+05:302012-01-23T12:05:44.164+05:30LVM In Linux<span class="Apple-style-span"><b>Practical steps to "Extend/Reduce" LVM Partition in RedHat/CentOS 5x & Fedora Linux upto version 12 only.</b></span><div><span class="Apple-style-span"><br /></span></div><meta equiv="content-type" content="text/html; charset=utf-8"><div><span class="Apple-style-span"><b><span class="Apple-style-span" style="font-weight: normal; "><b>############</b></span>To Extend LVM Partition:</b></span><span class="Apple-style-span" style="font-family: verdana; "><b>############</b></span></div><meta equiv="content-type" content="text/html; charset=utf-8"><div><span class="Apple-style-span" style="font-family: verdana; "><b>Note</b>: No need to unmount the partition.</span></div><div><span class="Apple-style-span" style="font-family: verdana; "><br /></span></div><div><span class="Apple-style-span" style="font-family: verdana; ">In my case, I want to extend my LVM partition to 200MB on LV0, the command is,</span></div><div><span class="Apple-style-span" style="font-family: verdana; "><b>Command:1</b></span></div><div><span class="Apple-style-span" style="font-family: verdana; ">lvextend -L 200M /dev/vg0/lv0</span></div><div><span class="Apple-style-span" style="font-family: verdana; "><br /></span></div><div><span class="Apple-style-span"><b>Command:2</b></span></div><div><span class="Apple-style-span">fsck /dev/vg0/lv0</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"><b>Command:3</b></span></div><div><span class="Apple-style-span">e2fsck -f /dev/vg0/lv0</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"><b>Command:4 </b></span><span class="Apple-style-span" style="font-family: verdana; "> (Used to get output of the said extended partition)</span></div><meta equiv="content-type" content="text/html; charset=utf-8"><div><span class="Apple-style-span">lvdisplay /dev/vg0/lv0 </span></div><div><span class="Apple-style-span">df -kh</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"><meta equiv="content-type" content="text/html; charset=utf-8"><b>############To Reduce LVM Partition:</b></span><span class="Apple-style-span" style="color: rgb(0, 0, 153); font-family: verdana; "><b>############</b></span></div><meta equiv="content-type" content="text/html; charset=utf-8"><div><span class="Apple-style-span"><b><br /></b></span></div><div><span class="Apple-style-span"><b>Note</b>: Unmount the said partition first before reducing.</span></div><div><span class="Apple-style-span" style="font-family: verdana; "><br /></span></div><div>In my case, I have mounted "lv0" on "google0" directory, the command would be,</div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"><b><meta equiv="content-type" content="text/html; charset=utf-8">Command:1</b></span></div><div><span class="Apple-style-span">umount /google0 /dev/vg0/lv0</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"><b><meta equiv="content-type" content="text/html; charset=utf-8">Command:2</b></span></div><div><span class="Apple-style-span">e2fsck -f /dev/vg0/lv0</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"><b><meta equiv="content-type" content="text/html; charset=utf-8">Command:3</b></span></div><div><span class="Apple-style-span">resize2fs /dev/vg0/lv0 50M (I have reduced LVM Partition size from 150 MB to 50 MB)</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"><b><meta equiv="content-type" content="text/html; charset=utf-8">Command:4</b></span></div><div><span class="Apple-style-span">lvreduce /dev/vg0/lv0 -L 50M</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"><b><meta equiv="content-type" content="text/html; charset=utf-8">Command:5</b></span></div><div><span class="Apple-style-span">mount /dev/vg0/lv0 /google0/ (Remount LV0 on google0 directory)</span></div><div><span class="Apple-style-span"><br /></span></div><div><span class="Apple-style-span"><meta equiv="content-type" content="text/html; charset=utf-8"><b>Command:6 </b> </span><span class="Apple-style-span" style="font-family: verdana; "> (Used to get output of the said reduced partition)</span></div><meta equiv="content-type" content="text/html; charset=utf-8"><div><span class="Apple-style-span">lvdisplay /dev/vg0/lv0</span></div><div><span class="Apple-style-span">df -kh</span></div>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-73401280567465033092011-06-29T13:23:00.003+05:302013-03-15T15:19:36.944+05:30Backup an entire hard disk using "dd" command<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: arial; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="font-size: 12px;"></span></span><br />
<div style="margin-bottom: 14px; margin-top: 14px; padding-bottom: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: arial; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;">The "dd" command is one of the original Unix utilities and should be in everyone's tool box. It can strip headers, extract parts of binary files and write into the middle of floppy disks; it is used by the Linux kernel Makefiles to make<span class="Apple-converted-space"> </span><a class="kLink" href="http://www.debianhelp.co.uk/ddcommand.htm#" id="KonaLink1" style="background-color: transparent ! important; background-image: none ! important; border-color: transparent ! important; border-style: none ! important; border-width: 0px ! important; bottom: 0px; color: rgb(0, 153, 0) ! important; cursor: pointer; display: inline ! important; font-size: inherit ! important; font-variant: normal; font-weight: inherit ! important; left: 0px; margin: 0px; outline-style: none; padding: 0px ! important; position: static; right: 0px; text-decoration: underline ! important; text-transform: none ! important; top: 0px;"><span style="color: #009900; color: rgb(0, 153, 0) !important; font-family: inherit !important; font-size: inherit !important; font-weight: inherit !important; position: static;"><span class="kLink" style="background-color: transparent; background-image: none; border-bottom: 1px solid rgb(0, 153, 0); border-left-style: none ! important; border-left-width: 0px ! important; border-right-style: none ! important; border-right-width: 0px ! important; border-top-style: none ! important; border-top-width: 0px ! important; color: rgb(0, 153, 0) ! important; display: inline ! important; float: none ! important; font-size: inherit ! important; font-weight: inherit ! important; padding: 0px 0px 1px ! important; position: static; width: auto ! important;">boot<span class="Apple-converted-space"> </span></span><span class="kLink" style="background-color: transparent; background-image: none; border-bottom: 1px solid rgb(0, 153, 0); border-left-style: none ! important; border-left-width: 0px ! important; border-right-style: none ! important; border-right-width: 0px ! important; border-top-style: none ! important; border-top-width: 0px ! important; color: rgb(0, 153, 0) ! important; display: inline ! important; float: none ! important; font-size: inherit ! important; font-weight: inherit ! important; padding: 0px 0px 1px ! important; position: static; width: auto ! important;">images</span></span></a>. It can be used to copy and convert magnetic tape formats, convert between ASCII and EBCDIC, swap bytes, and force to upper and lower case.<span class="Apple-converted-space"> </span><br /><br />For blocked I/O, the dd command has no competition in the standard tool set. One could write a custom utility to do specific I/O or formatting but, as dd is already available almost everywhere, it makes sense to use it.<span class="Apple-converted-space"> </span><br /><br />Like most well-behaved commands, dd reads from its standard input and writes to its standard output, unless a command line specification has been given. This allows dd to be used in pipes, and remotely with the rsh remote shell command.<span class="Apple-converted-space"> </span><br /><br />Unlike most commands, dd uses a keyword=value format for its parameters. This was reputedly modeled after IBM System/360 JCL, which had an elaborate DD 'Dataset Definition' specification for I/O devices.<span class="Apple-converted-space"></span><br /><br />Using "dd" you can create backups of an entire<span class="Apple-converted-space"> </span><a class="kLink" href="http://www.debianhelp.co.uk/ddcommand.htm#" id="KonaLink2" style="background-color: transparent ! important; background-image: none ! important; border-color: transparent ! important; border-style: none ! important; border-width: 0px ! important; bottom: 0px; color: rgb(0, 153, 0) ! important; cursor: pointer; display: inline ! important; font-size: inherit ! important; font-variant: normal; font-weight: inherit ! important; left: 0px; margin: 0px; outline-style: none; padding: 0px ! important; position: static; right: 0px; text-decoration: underline ! important; text-transform: none ! important; top: 0px;"><span style="color: #009900; color: rgb(0, 153, 0) !important; font-family: inherit !important; font-size: inherit !important; font-weight: inherit !important; position: static;"><span class="kLink" style="background-color: transparent; background-image: none; border-bottom: 1px solid rgb(0, 153, 0); border-left-style: none ! important; border-left-width: 0px ! important; border-right-style: none ! important; border-right-width: 0px ! important; border-top-style: none ! important; border-top-width: 0px ! important; color: rgb(0, 153, 0) ! important; display: inline ! important; float: none ! important; font-size: inherit ! important; font-weight: inherit ! important; padding: 0px 0px 1px ! important; position: static; width: auto ! important;">harddisk</span></span></a><span class="Apple-converted-space"> </span>or just a parts of it. This is also useful to quickly copy installations to similar machines. It will only work on disks that are exactly the same in disk geometry, meaning they have to the same model from the same brand.<br /><br /><b><span style="color: #cc0066;">Full Hard<span class="Apple-converted-space"> </span><a class="kLink" href="http://www.debianhelp.co.uk/ddcommand.htm#" id="KonaLink3" style="background-color: transparent ! important; background-image: none ! important; border-color: transparent ! important; border-style: none ! important; border-width: 0px ! important; bottom: 0px; color: rgb(0, 153, 0) ! important; cursor: pointer; display: inline ! important; font-size: inherit ! important; font-variant: normal; font-weight: inherit ! important; left: 0px; margin: 0px; outline-style: none; padding: 0px ! important; position: static; right: 0px; text-decoration: underline ! important; text-transform: none ! important; top: 0px;"><span style="color: #009900; color: rgb(0, 153, 0) !important; font-family: inherit !important; font-size: inherit !important; font-weight: inherit !important; position: static;"><span class="kLink" style="background-color: transparent; background-image: none; border-bottom-style: solid; border-bottom-width: 1px; border-left-style: none ! important; border-left-width: 0px ! important; border-right-style: none ! important; border-right-width: 0px ! important; border-top-style: none ! important; border-top-width: 0px ! important; color: rgb(0, 153, 0) ! important; display: inline ! important; float: none ! important; font-size: inherit ! important; font-weight: inherit ! important; padding: 0px 0px 1px ! important; position: static; width: auto ! important;">Disk<span class="Apple-converted-space"> </span></span><span class="kLink" style="background-color: transparent; background-image: none; border-bottom-style: solid; border-bottom-width: 1px; border-left-style: none ! important; border-left-width: 0px ! important; border-right-style: none ! important; border-right-width: 0px ! important; border-top-style: none ! important; border-top-width: 0px ! important; color: rgb(0, 153, 0) ! important; display: inline ! important; float: none ! important; font-size: inherit ! important; font-weight: inherit ! important; padding: 0px 0px 1px ! important; position: static; width: auto ! important;">copy </span></span></a></span></b><br />dd if=/dev/hdx of=/dev/hdy<br />dd if=/dev/hdx of=/path/to/image<br />dd if=/dev/hdx | gzip > /path/to/image.gz<br /><br />Hdx could be hda,<span class="Apple-converted-space"> </span><a class="kLink" href="http://www.debianhelp.co.uk/ddcommand.htm#" id="KonaLink4" style="background-color: transparent ! important; background-image: none ! important; border-color: transparent ! important; border-style: none ! important; border-width: 0px ! important; bottom: 0px; color: rgb(0, 153, 0) ! important; cursor: pointer; display: inline ! important; font-size: inherit ! important; font-variant: normal; font-weight: inherit ! important; left: 0px; margin: 0px; outline-style: none; padding: 0px ! important; position: static; right: 0px; text-decoration: underline ! important; text-transform: none ! important; top: 0px;"><span style="color: #009900; color: rgb(0, 153, 0) !important; font-family: inherit !important; font-size: inherit !important; font-weight: inherit !important; position: static;"><span class="kLink" style="background-color: transparent; background-image: none; border-bottom-style: solid; border-bottom-width: 1px; border-left-style: none ! important; border-left-width: 0px ! important; border-right-style: none ! important; border-right-width: 0px ! important; border-top-style: none ! important; border-top-width: 0px ! important; color: rgb(0, 153, 0) ! important; display: inline ! important; float: none ! important; font-size: inherit ! important; font-weight: inherit ! important; padding: 0px 0px 1px ! important; position: static; width: auto ! important;">hdb</span></span></a><span class="Apple-converted-space"> </span>etc. In the second example gzip is used to compress the image if it is really just a backup.<span class="Apple-converted-space"> </span><br /><br /><span style="color: #cc0066;"><b>Restore Backup of<span class="Apple-converted-space"> </span><a class="kLink" href="http://www.debianhelp.co.uk/ddcommand.htm#" id="KonaLink5" style="background-color: transparent ! important; background-image: none ! important; border-color: transparent ! important; border-style: none ! important; border-width: 0px ! important; bottom: 0px; color: rgb(0, 153, 0) ! important; cursor: pointer; display: inline ! important; font-size: inherit ! important; font-variant: normal; font-weight: inherit ! important; left: 0px; margin: 0px; outline-style: none; padding: 0px ! important; position: static; right: 0px; text-decoration: underline ! important; text-transform: none ! important; top: 0px;"><span style="color: #009900; color: rgb(0, 153, 0) !important; font-family: inherit !important; font-size: inherit !important; font-weight: inherit !important; position: static;"><span class="kLink" style="background-color: transparent; background-image: none; border-bottom-style: solid; border-bottom-width: 1px; border-left-style: none ! important; border-left-width: 0px ! important; border-right-style: none ! important; border-right-width: 0px ! important; border-top-style: none ! important; border-top-width: 0px ! important; color: rgb(0, 153, 0) ! important; display: inline ! important; float: none ! important; font-size: inherit ! important; font-weight: inherit ! important; padding: 0px 0px 1px ! important; position: static; width: auto ! important;">hard<span class="Apple-converted-space"> </span></span><span class="kLink" style="background-color: transparent; background-image: none; border-bottom-style: solid; border-bottom-width: 1px; border-left-style: none ! important; border-left-width: 0px ! important; border-right-style: none ! important; border-right-width: 0px ! important; border-top-style: none ! important; border-top-width: 0px ! important; color: rgb(0, 153, 0) ! important; display: inline ! important; float: none ! important; font-size: inherit ! important; font-weight: inherit ! important; padding: 0px 0px 1px ! important; position: static; width: auto ! important;">disk</span></span></a><span class="Apple-converted-space"> </span>copy</b></span><br />dd if=/path/to/image of=/dev/hdx<br /><br />gzip -dc /path/to/image.gz | dd of=/dev/hdx<span class="Apple-converted-space"> </span><br /><br /><span style="color: #cc0066;"><b>MBR backup</b></span><br /><br />In order to backup only the first few bytes containing the MBR and the partition table you can use dd as well.<br /><br />dd if=/dev/hdx of=/path/to/image count=1 bs=512<span class="Apple-converted-space"> </span><br /><br /><span style="color: #cc0066;"><b>MBR restore</b></span><br /><br />dd if=/path/to/image of=/dev/hdx</span></span></span></div>
<div style="margin-bottom: 14px; margin-top: 14px; padding-bottom: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: arial; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Add "count=1 bs=446" to exclude the partition table from being written to disk. You can manually restore the table.</span></span></span></div>
<div style="margin-bottom: 14px; margin-top: 14px; padding-bottom: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: arial; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Another popular tools are: "Clonezilla, Mondo Rescue"</span></span></span></div>
<div style="margin-bottom: 14px; margin-top: 14px; padding-bottom: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: arial; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></span></span></div>
<div style="margin-bottom: 14px; margin-top: 14px; padding-bottom: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: arial; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br /></span></span></span></div>
<div style="margin-bottom: 14px; margin-top: 14px; padding-bottom: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: arial; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Regards,</span></span></span></div>
<div style="font-weight: bold; margin-bottom: 14px; margin-top: 14px; padding-bottom: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: arial; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Nishith N.Vyas</span></span></span></div>
<div style="margin-bottom: 14px; margin-top: 14px; padding-bottom: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: arial; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="font-size: 12px;"><span style="font-size: 85%;"><br /></span></span></span></div>
</div>
Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-9392633414881808702011-05-23T15:36:00.004+05:302011-05-23T15:51:11.118+05:30Zombie Process Understanding.<span style="font-family:arial;"><span style="font-weight: bold;">A zombie</span> process is a process that has completed execution but still has an entry in the process table, allowing the process that started it to read its exit status.</span><br /><br /><span style="font-family:arial;">When a process ends, all of the memory and resources associated with it are deallocated so they can be used by other processes.<br /><br />However, the process's entry in the process table remains. The parent is sent a<span style="font-weight: bold;"> SIGCHLD</span> signal indicating that a <span style="font-weight: bold;">child has died</span>; the handler for this signal will typically<span style="font-weight: bold;"> execute the wait </span>system call, which reads the <span style="font-weight: bold;">exit status</span> and <span style="font-weight: bold;">removes the zombie.</span><br /><br />The zombie's process ID and entry in the process table can then be reused. However, if a parent ignores the <span style="font-weight: bold;"> SIGCHLD</span>, the zombie will be left in the process table.<br /><br />In some situations this may be desirable, for example if the parent creates another child process it ensures that it will not be allocated the same process ID.</span><br /><br /><span style="font-family:arial;"><span style="color: rgb(255, 0, 0);">If you have zombie processes it means those zombies have not been waited for by their parent.</span><br /><br /><span style="font-weight: bold;">To remove zombies from a system</span>, the <span style="font-weight: bold;">SIGCHLD </span>signal can be sent to the parent manually, using the kill command. If the parent process still refuses to reap the zombie, the next step would be to remove the parent process. When a process loses its parent, init becomes its new parent. Init periodically executes the wait system call to reap any zombies with init as parent.</span><br /><br /><span style="font-family:arial;"><span style="color: rgb(255, 0, 0);">How to find "zombie" process in Linux ?</span><br /><br />Execute<span style="font-weight: bold;"> "top" </span>command & read top left corner to check zombie process. If you are unable to identify the process, press <span style="font-weight: bold;">"z"</span> & you will get<span style="color: rgb(255, 0, 0);"> "red"</span> colored identification for easy understanding.<br /><br /><span style="color: rgb(255, 0, 0);">How to kill "zombie" process in Linux ?</span><br /><br /></span><code style="font-family: arial;">Run this command.<br />ps aux | awk '{ print $8 " " $2 }' | grep -w Z</code><br /><span style="font-family:arial;"><br /><span style="font-weight: bold;">Output would be</span>,<br /></span><pre style="font-family: arial;">Z 3456<br />Z 2107<br />Z 1708<br /></pre><span style="font-family:arial;">Use "Kill command" for all three processes as given below.</span><br /><br /><span style="font-family:arial;">kill -9 3456</span><br /><span style="font-family:arial;">kill -9 2107</span><br /><span style="font-family:arial;">kill -9 1708</span><br /><br /><span style="font-family:arial;">That's it.</span> <span style="font-family:arial;">Enjoy Linux</span>.<br /><span style="font-family:arial;"><br /><br /></span>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-78154373810294771082011-05-03T19:36:00.004+05:302011-05-03T19:48:38.242+05:30Commands to check "Disk Usage" in Linux<span style="color: rgb(255, 0, 0);font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;" ><b>'du' = Finding the "disk usage"</b></span><br /><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;"><b><br />du</b><br /> Typing the above at the prompt gives you a list of directories that exist in the current directory along with their sizes. The last line of the output gives you the total size of the current directory including its subdirectories. The size given includes the sizes of the files and the directories that exist in the current directory as well as all of its subdirectories. Note that by default the sizes given are in kilobytes.<br /><br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;"><b>du /home/nishith</b><br /> The above command would give you the directory size of the directory /home/nishith</span><br /><br /><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;"><b>du -h</b><br /> This command gives you a better output than the default one. The option '-h' stands for <i>human readable format</i>. So the sizes of the files / directories are this time suffixed with a 'k' if its kilobytes and 'M' if its Megabytes and 'G' if its Gigabytes.<br /><br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;"><b>du -ah</b><br /> This command would display in its output, not only the directories but also all the files that are present in the current directory. Note that 'du' always counts all files and directories while giving the final size in the last line. But the '-a' <i>displays</i> the filenames along with the directory names in the output. '-h' is once again human readable format.<br /><br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;"><b>du -c</b><br /> This gives you a <i>grand total</i> as the last line of the output. So if your directory occupies 100MB the last 2 lines of the output would be<br /> <br /> 100M .<br /> 100M total</span><br /><br /><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;">The first line would be the default last line of the 'du' output indicating the total size of the directory and another line displaying the same size, followed by the string '<i>total</i>'. This is helpful in case you this command along with the grep command to only display the final total size of a directory as shown below.<br /><br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;"><b>du -ch | grep total</b><br /> This would have only one line in its output that displays the total size of the current directory including all the subdirectories.<br /><br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;"><b>du -s</b><br /> This displays a summary of the directory size. It is the simplest way to know the total size of the current directory.<br /><br /></span><b><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;">du -S</span></b><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;"><br /> This would display the size of the current directory excluding the size of the subdirectories that exist within that directory. So it basically shows you the total size of <i>all the files</i> that exist in the current directory.<br /><br /></span><b><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;">du --exclude=mp3</span></b><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;"><br /> The above command would display the size of the current directory along with all its subdirectories, <i><b>but</b></i> it would exclude all the files having the given pattern present in their file names. Thus in the above case if there happens to be any mp3 files within the current directory or any of its subdirectories, their size <i>would not be included</i> while calculating the total directory size.</span><br /><br /><span style="color: rgb(255, 0, 0);font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;" ><b>'df' = Finding the "disk free" space</b></span><br /><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;"><b><br />df</b><br /> Typing the above, outputs a table consisting of 6 columns. All the columns are very easy to understand. Remember that the 'Size', 'Used' and 'Avail' columns use kilobytes as the unit. The 'Use%' column shows the usage as a percentage which is also very useful.<br /> </span><br /><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;"><b>df -h</b><br /> Displays the same output as the previous command but the '-h' indicates <i>human readable format</i>. Hence instead of kilobytes as the unit the output would have 'M' for Megabytes and 'G' for Gigabytes.<br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;"><b>Example :<br /> </b><br /> I have my Linux installed on /dev/hda1 and I have mounted my Windows partitions as well (by default every time Linux boots). So 'df' by default shows me the disk usage of my Linux as well as Windows partitions. And I am only interested in the disk usage of the Linux partitions. This is what I use :<br /> <br /> <b>$ df -h | grep /dev/sda1 | cut -c 41-43</b><br /> <br /> This command displays the following on my machine<br /> <br /> <b>78%<br /><br /><span style="color: rgb(51, 102, 255);">Please Note: You can find your drive letter by typing "fdisk -l / df -kh" command line.<br /><br /><br /><br /><span style="color: rgb(0, 0, 0);">Thanks,</span><br /><span style="color: rgb(0, 0, 0);">Nishith N.Vyas</span><br /></span></b></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:-1;"> </span>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-91793143411429224472011-04-29T13:37:00.004+05:302013-03-15T15:20:15.566+05:30Kickstart installation guide for CentOS 5.5<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">This guide explain how to install and configure kickstart server for network based deployments of CentOS, from an NFS share.<br /><br />The instructions should work the same on RedHat and Fedora.<br /><br /><span style="font-weight: bold;">Requirement</span>:<br /><br /> * CentOS 5.5 DVD<br /> * Static IP address for the Kickstart/DHCP server<br /> * /data partition or any other<br /><br /><span style="font-weight: bold;">Installation Steps:</span><br /><br /> 1. Login to the CentOS server using Root account.<br /><br />2. Mount the CentOS DVD. Command would be : mount /dev/cdrom /media<br /><br />3. Move to the CentOS RPM folder inside the DVD: cd /media/CentOS<br /><br />4. Run the command bellow to install the TFTP-Server:<br />rpm -ivh xinetd-2.3.14-10.el5.i386.rpm<br /> rpm -ivh tftp-server-0.49-2.el5.centos.i386.rpm<br /><br />(If you get dependency error, download all necessary packages using "yum")<br /><br />5. Run the command bellow to install the DHCP server:<br /> rpm -ivh dhcp-3.0.5-23.el5.i386.rpm<br /><br />6. Create new folder for the Kickstart server:<br /> mkdir -p /data/kickstart<br /><br />7. Edit using "vi", the file /etc/xinetd.d/tftp and change the following settings:<br /> From:<br /> disable = yes <span style="font-weight: bold;">To:</span> disable = no<br />From:<br /> server_args = -s /tftpboot <span style="font-weight: bold;">To:</span> server_args = -s /data/kickstart<br /><br />8. Run the command bellow to start the TFTP server:<br /> /sbin/service xinetd start<br /><br />9. Run the command bellow to start the TFTP server run at startup:<br /> chkconfig xinetd on<br /><br />10. Edit using "vi", the file /etc/dhcpd.conf and add the following lines:<br /> ddns-update-style none;<br /> allow bootp;<br /> allow booting;<br /> subnet 10.1.1.0 netmask 255.255.255.0 {<br /> option routers 10.1.1.254;<br /> option domain-name-servers 10.1.1.2;<br /> next-server 10.1.1.1;<br /> filename "pxelinux.0";<br /> range dynamic-bootp 10.1.1.200 10.1.1.210;<br /> }Note 1: Replace 10.1.1.0 with the correct network ID.<br /> Note 2: Replace 255.255.255.0 with the correct subnet mask.<br /> Note 3: Replace 10.1.1.254 with the correct default gateway.<br /> Note 4: Replace 10.1.1.1 with the Kickstart server IP address.<br /> Note 5: Replace 10.1.1.200 with the first IP of the DHCP pool.<br /> Note 6: Replace 10.1.1.210 with the last IP of the DHCP pool.<br /> Note 7: Replace 10.1.1.2 with the correct DNS server.<br /><br />11. Start the DHCP server<br /> service dhcpd start or /etc/init.d/dhcpd start<br /><br />12. Run the command bellow to start the DHCP server run at startup:<br /> chkconfig dhcpd on<br /><br />13. Copy Boot Files<br /> cp /usr/lib/syslinux/{pxelinux.0,menu.c32,memdisk,mboot.c32,chain.c32} /data/kickstart<br /><br />14. Create a folder for the PXE menu files:<br /> mkdir -p /data/kickstart/pxelinux.cfg<br /><br />15. Move to the CentOS DVD root folder:<br /> cd /media<br /><br />16. Copy vmlinuz and initrd.img from the DVD to the images directory:<br /> cp /media/images/pxeboot/{vmlinuz,initrd.img} /data/kickstart/images<br /><br />17. Create the CentOS DVD structure:<br /> cp -r CentOS /data/kickstart/<br /> cp -r isolinux /data/kickstart/<br /> cp -r repodata /data/kickstart/<br /> cp -r images /data/kickstart/<br /><br />18. Create using "vi", the file /data/kickstart/pxelinux.cfg/default with the following content:<br /> default menu.c32<br /> prompt 0<br /> MENU TITLE PXE Menu<br /> LABEL CentOS<br /> MENU LABEL CentOS<br /> KERNEL images/vmlinuz<br /> append initrd=images/initrd.img vga=normal network ks=nfs:10.1.1.1:/data/kickstart/ks.cfg textNote: Replace 10.1.1.1 with the Kickstart server IP address.<br />19. Create an unattended installation script /data/kickstart/ks.cfg<br /><br /><span style="font-weight: bold;">Note:</span> Make sure the file starts with the following lines:<br /> install<br /> nfs --server=10.1.1.1 --dir=/data/kickstartNote 1: Replace 10.1.1.1 with the Kickstart server IP address.<br /> <br /><span style="font-weight: bold;">Note:</span> Make sure the lines beginning with “cdrom” and “url” does not exist on the file.<br /> <span style="font-weight: bold;"><br />Note:</span> To review ks.cfg file options, see the link:<br /> http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.4/html/Installation_Guide/s1-kickstart2-options.html<br /><br />20. Edit using "vi", the file /etc/exports and add the following line:<br /> /data/kickstart *(ro,no_root_squash)<br /><br />21. Start the NFS service:<br /> service portmap start<br /> service nfs start<br /> chkconfig nfs on<br /><br />That' it.</span></div>
Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com2tag:blogger.com,1999:blog-8498867271087223494.post-3866722360868695572011-04-20T11:21:00.011+05:302011-04-22T17:37:02.179+05:30Alert "Disk Usage" on your email id<span class="Apple-style-span">Hello,
<br />
<br /><span class="Apple-style-span"><b>Below shell script shows "Hard Disk Usage" on your email address on regular basis.</b></span>
<br />
<br /><b>Step:1</b>
<br /></span>
<br /><div>Make a file & named "disk-alert" & copy below contents in it.</div><div>
<br /></div><div>######################################################################</div><div><div># set admin email so that you can get email</div><div>ADMIN="abc@xyz.com"<span class="Apple-style-span"> <span class="Apple-style-span"> (Mention Your Mail Id Here)</span></span></div><div># set alert level 90% is default<span class="Apple-style-span"> <span class="Apple-style-span">(Set Usage Level as per the need)</span></span></div><div>ALERT=90</div><div>df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;</div><div>do</div><div> #echo $output</div><div> usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )</div><div> partition=$(echo $output | awk '{ print $2 }' )</div><div> if [ $usep -ge $ALERT ]; then</div><div> echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |</div><div> mail -s "Alert: Almost out of disk space $usep" $ADMIN</div><div> fi</div><div>done</div></div><div><meta equiv="content-type" content="text/html; charset=utf-8">######################################################################</div><div>
<br /></div><div><b>Step:2</b></div><div>Edit "crontab" & make below setting.</div><div>
<br /></div><div>crontab -e</div><div><div>59 23 * * * /root/script/diskalert</div></div><div>
<br /></div><div>Save & Exit (:wq)</div><div>
<br /></div><div><b>Step:3</b></div><div>service crond start</div><div>service sendmail start</div><div>chkconfig crond on</div><div>chkconfig sendmail on</div><div>
<br /></div><div><b>Please Note : </b>You can use any other mail service in your network as per the availability.</div><div>
<br /></div><div><b>Conclusion:</b></div><div>This shell script will give you "Disk Usage" output on the mentioned email id on daily basis @ 23 Hrs:59 Minutes</div><div>
<br /></div><div>Note: Thanks to "cyberciti.biz" to make such a nice effort to make my post more powerful.
<br /></div><div>
<br /></div>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-86012902575749154172010-09-27T15:07:00.013+05:302010-09-27T15:25:41.399+05:30Faster Internet Browsing Thru. Local DNS Cache<span style=";font-family:arial;font-size:100%;" ><span style="font-family: arial;">A local DNS cache can help for faster browsing since you’re caching the DNS request instead of attempting that request multiple times. The internet speed will not get any faster, but the browsing speed will improve, because on each website there are usually quite a few DNS requests for which the local DNS cache will be used, bringing the query time to almost 0.</span><br /><br /><span style="font-family: arial;">To see how fast your current domain name servers (DNS) are, open a terminal execute below command.</span><br /></span><pre class="linux-code" style="font-family:arial;"><span style="font-size:100%;"><code><span style="font-size:130%;"><span style="font-size:100%;">]# dig y</span><span style="font-size:100%;">ahoo.com</span><br /><br />You Should get something like this.<br /></span></code><code>*************************************************************************<br />; <<>> DiG 9.6.1-P1 <<>> yahoo.com<br />;; global options: +cmd<br />;; Got answer:<br />;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42045 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0<br /><br />;; QUESTION SECTION: ;yahoo.com. IN A <br /><br />;; ANSWER SECTION: yahoo.com. 20142 IN A 69.147.114.224 yahoo.com. 20142 IN A 209.131.36.159 yahoo.com. 20142 IN A 209.191.93.53 <span style="font-weight: bold;"><br /><br />;; Query time: 50 msec</span><br />;; SERVER: 208.67.220.220#53(208.67.220.220)<br />;; WHEN: Wed Dec 9 13:21:48 2009<br />;; MSG SIZE rcvd: 75</code><br /><code>*************************************************************************</code><br /><br /><span style="font-size:130%;">N<span style="font-family: arial;">otice the "Query time" in bold. It's usually somewhere near 50 msec. (it depends on your domain name servers).</span><br /><br /><span style="font-family: arial;">Run this one more time. If the query time decreases to less than 5</span><br /><span style="font-family: arial;">msec, it means your internet service provider DNS already uses some</span><br /><span style="font-family: arial;">caching method and you do not need to follow this how-to. If the</span><br /><span style="font-family: arial;">response time is almost the same and you are using a cable (broadband)</span><br /><span style="font-family: arial;">internet connection, you can use this guide to cache the DNS for faster</span><br /><span style="font-family: arial;">internet browsing.</span><br /></span><br /><span style="font-size:130%;"><span style="font-family: arial;">Now, Let's Start The Practical.</span></span><br /></span><span style="font-size:100%;"><br /><span style="font-size:130%;"><span style="font-family: arial;">Manually configuring the local DNS cache</span></span></span></pre><span style="font-family: arial;font-size:85%;" >1. Install DNSMasq:</span> <span style=";font-family:arial;font-size:100%;" ><br /><span style="font-size:85%;">yum install dnsmasq<br /><br /><br />2. Edit "Dnsmasq" configuration file.<br />vim /etc/dnsmasq.conf<br /><br />3. </span></span><span style="font-size:85%;"><span style="font-family: arial;">N</span></span><span style="font-size:85%;"><span style="font-family: arial;">ow search for "listen-address" (it's on line 90 on my Ubuntu Karmic installation), remove the "#" character in front of "listen-address" and add "127.0.0.1" after the "=" (all without the quotes). Basically, this is how the "listen-address" line should look like after editing it :</span></span><span style="font-size:100%;"><code><span style="font-family: arial;"><br /><br /></span>listen-address=127.0.0.1</code></span><br /><br /><span style="font-family: arial;font-size:85%;" ><span style="font-family: arial;">4. </span>You can also edit the cache size if you want. Search for this in the same file: "#cache-size=150" (it's on line 432 on my Ubuntu Karmic installation), remove the "#" character in front of the line (this uncomments it) and change "150" with the size you want for you DNS cache. This is how the line should look after editing it :</span><code><span style="font-family: arial;"><br /><br /></span>cache-size=500</code><br /><br /><span style="font-family: arial;font-size:85%;" >Note :- "500" can be any number you want.</span><br /><br /><span style="font-family: arial;font-size:85%;" >5. Edit "/etc/resolv.conf" file & modify First Line.</span><br /><br /><span style="font-weight: bold;font-size:85%;" ><span style="font-family: arial;">nameserver 127.0.0.1</span></span><br /><span style="font-family: arial;font-size:100%;" ><span style="font-size:85%;"><span style="font-weight: bold;">nameserver ISP_DNS1<br />nameserver ISP_DNS2</span></span></span><br /><br /><span style="font-size:85%;"><span style="font-family: arial;">6. Finally "service network restart" & "service dnsmasq restart"<br /><br />7. </span><span style="font-weight: bold; font-family: arial;">Testing</span><br /><span style="font-family: arial;">To see the performance improvement, open a terminal and type:</span></span><br /><br /><span style="font-family: arial;font-size:100%;" >dig yahoo.com<br /></span><pre style="font-family: arial;" class="source-code"><span style="font-size:100%;"><code>************************************************************<br />; <<>> DiG 9.6.1-P2 <<>> yahoo.com<br />;; global options: +cmd<br />;; Got answer:<br />;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57501<br />;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0<br /><br />;; QUESTION SECTION:<br />;yahoo.com. IN A<br /><br />;; ANSWER SECTION:<br />yahoo.com. 20982 IN A 209.131.36.159<br />yahoo.com. 20982 IN A 69.147.114.224<br />yahoo.com. 20982 IN A 209.191.93.53<br /><br /><span style="font-weight: bold;">;; Query time: 0 msec</span><br />;; SERVER: 127.0.0.1#53(127.0.0.1)<br />;; WHEN: Wed Dec 9 14:43:41 2009<br />;; MSG SIZE rcvd: 75<br /></code></span><span><span style="font-size:100%;"><code>************************************************************</code></span></span><br /><span style="font-weight: bold; color: rgb(255, 0, 0);font-size:85%;" ><span style="font-family: arial;">0 msec. query time, because the domains are now cached.</span></span><br /><br /><span style="font-weight: bold;">That's it.</span><br /></pre><span style="font-family: arial;font-size:100%;" ><br /></span>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-40440959567518613422010-09-21T12:31:00.003+05:302010-09-21T12:34:54.206+05:30Limit CPU Usage Per Process in Linux<span style="font-family: arial;">This practical is tested successfully on Fedora 11 i386 & CentOS 5.4 Only.<br /></span><br /><span style="font-family: arial;"></span><span style="font-family: arial;">Download "cpulimit" setup file first.<br /><br /> wget '</span><a style="font-family: arial;" href="http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz" target="_blank">http://downloads.sourceforge.<wbr>net/cpulimit/cpulimit-1.1.tar.<wbr>gz</a><span style="font-family: arial;">'</span><br /><span style="font-family: arial;"><br />Extract it & go inside the directory.<br /> tar -zxvf cpulimit-1.1.tar.gz</span><br /><span style="font-family: arial;"> cd cpulimit-1.1</span><br /><span style="font-family: arial;"><br /> make</span><br /><span style="font-family: arial;"> cp cpulimit /usr/local/sbin/</span><br /><span style="font-family: arial;"> rm -rf cpulimit*</span><br /><span style="font-family: arial; font-weight: bold;"><br />Command to run cpulimit.</span><br /> <br /><span style="font-family: arial;"> To limit CPU usage of the process called firefox to 30%, enter:</span><br /><span style="font-family: arial;"> # cpulimit -e firefox -l 30</span><br /><span style="font-family: arial;"><br />To limit CPU usage of the process to 30% by using its PID, enter:</span><br /><span style="font-family: arial;"> # cpulimit -p 1313 -l 30</span><br /><span style="font-family: arial;"> To find out PID of the process use any of the following:</span><br /><span style="font-family: arial;"><br /># ps aux | less</span><br /><span style="font-family: arial;"><br /># ps aux | grep firefox</span><br /><span style="font-family: arial;"><br /># pgrep -u nnv php-cgi</span><br /><span style="font-family: arial;"><br /># pgrep lighttpd</span><br /><span style="font-family: arial;"><br />You can also use absolute path name of the executable, enter:</span><br /><span style="font-family: arial;"> # cpulimit -P /opt/firefox/firebox -l 30</span><br /><span style="font-family: arial;"> Where,</span><br /> <br /><span style="font-family: arial;"> * -p : Process PID.</span><br /><span style="font-family: arial;"> * -e : Process name.</span><br /><span style="font-family: arial;"> * -l : percentage of CPU allowed from 0 to 100.</span><br /><span style="font-family: arial;"> * -P: absolute path name of the executable program file.</span><br /> <span style="font-family: arial;color:#888888;" ><br />Thanks,<br />Nishith N.Vyas.<br />Call : +91 9879597301<br /></span>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-26482708803689284042010-09-21T12:16:00.005+05:302010-09-21T12:18:43.719+05:30Root Filesystem Definition.<p style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:100%;"> The root filesystem is the <a href="http://www.linfo.org/filesystem.html">filesystem</a> that is contained on the same <a href="http://www.linfo.org/partition.html">partition</a> on which the <a href="http://www.linfo.org/root_directory.html">root directory</a> is located, and it is the filesystem on which all the other filesystems are mounted (i.e., logically attached to the system) as the system is <a href="http://www.linfo.org/boot.html">booted up</a> (i.e., started up). </span></p> <p style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:100%;"> A partition is a logically independent section of a hard disk drive (HDD). A filesystem is a hierarchy of directories (also referred to as a <a href="http://www.linfo.org/directory_tree.html">directory tree</a>) that is used to organize files on a computer system. On <a href="http://www.linfo.org/linuxdef.html">Linux</a> and and other <a href="http://www.linfo.org/unix-like.html">Unix-like</a> <a href="http://www.linfo.org/operating_systems_list.html">operating systems</a>, the directories start with the root directory, which contains a series of subdirectories, each of which, in turn, contains further subdirectories, etc. A variant of this definition is the part of the entire hierarchy of directories (i.e., of the directory tree) that is located on a single partition or disk. </span></p> <p style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:100%;"> The exact contents of the root filesystem will vary according to the computer, but they will include the files that are necessary for booting the system and for bringing it up to such a state that the other filesystems can be mounted as well as tools for fixing a broken system and for recovering lost files from backups. The contents will include the root directory together with a minimal set of subdirectories and files including /boot, /dev, /etc, <a href="http://www.linfo.org/bin.html">/bin</a>, <a href="http://www.linfo.org/sbin.html">/sbin</a> and sometimes /tmp (for temporary files). </span></p> <p style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:100%;"> Only the root filesystem is available when a system is brought up in single user mode. Single user mode is a way of booting a damaged system that has very limited capabilities so that repairs can be made to it. After repairs have been completed, the other filesystems that are located on different partitions or on different media can then be mounted on (i.e., attached to) the root filesystem in order to restore full system functionality. The directories on which they are mounted are called <a href="http://www.linfo.org/mount_point.html">mount points</a>. </span></p> <p style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:100%;"> The root filesystem should generally be small, because it contains critical files and a small, infrequently modified filesystem has a better chance of not becoming corrupted. A corrupted root filesystem will generally mean that the system becomes unbootable (i.e., unstartable) from the HDD, and must be booted by special means (e.g., from a boot floppy). </span></p> <p style="font-family: arial; color: rgb(0, 0, 0);"><span style="font-size:100%;"> A filesystem can be mounted anywhere in the directory tree; it does not necessarily need to be mounted on the root filesystem. For example, it is possible (and very common) to have one filesystem mounted at a mount point on the root filesystem, and another filesystem mounted at a mount point contained in that filesystem. </span></p>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-30470981467217345962010-05-15T13:53:00.008+05:302013-03-15T15:10:52.557+05:30"rsync" configuration in Linux/Unix<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: arial;">What "rsync" can do ?<br /><br />"rsync" can perform differential uploads and downloads (synchronization) of files across the network, transferring only data that has changed. The<span style="font-weight: bold;"> rsync remote-update protocol </span>allows rsync to transfer just the differences between two sets of files across the network connection.<br /><br /><span style="font-weight: bold;">Hand's ON Practical </span>:-<br /><br />Recommended : Install "rsync" on both linux or unix machines. (only for redhat/fedora)<br />yum install rsync</span><br />
<br />
<span style="font-family: arial; font-weight: bold;">Note: Always use rsync over ssh</span> <br />
<div style="font-family: arial;">
Since rsync does not provide any security while transferring data it is recommended that you use rsync over ssh . This allows a secure remote connection. Now let us see some examples of rsync.</div>
<span style="font-family: arial; font-size: 100%;"><span style="font-weight: bold;">Task</span> <span style="font-weight: bold;">1</span>: Copy file from a local computer to a remote server</span><span style="font-family: arial;">. Copy file from "/data/office.tar.gz" to a remote server called "192.168.1.1"</span><br />
<code style="font-family: arial;"><br />$ rsync -v -e ssh </code><span style="font-family: arial;">/data/office.tar.gz</span><code style="font-family: arial;"> rohit@192.168.1.1:/home/nishith</code><br />
<br />
<h3 style="font-family: arial;">
Task 2: <span style="font-size: 100%; font-weight: normal;">Copy file from a remote server to a local computer</span></h3>
<span style="font-family: arial;">Copy file "/home/nishith/data.txt" from a remote server "192.168.1.1" to a local computer "/tmp" directory:</span><br />
<code style="font-family: arial;">$ rsync -v -e ssh nishith@192.168.1.1:/home/nishith/data.txt /tmp<br /><br />Give Password:</code><br />
<h3 style="font-family: arial;">
Task: <span style="font-size: 100%; font-weight: normal;">Synchronize a local directory with a remote directory</span></h3>
<div style="font-family: arial; text-align: left;">
<span style="font-size: 100%;"><code>$<span style="font-size: 130%;"> rsync -r -a -v -e "ssh -l nishith" --delete 192.168.1.1:/home/nishith/ /data </span></code></span></div>
<br />
<h3 style="font-family: arial;">
Task: Synchronize a remote directory with a local directory</h3>
<div style="font-family: arial;">
<code>$<span style="font-size: 130%;"> rsync -r -a -v -e "ssh -l nishith" --delete /data 192.168.1.1:/home/nishith/ </span></code></div>
<h3 style="font-family: arial;">
Task: Synchronize a local directory with a remote rsync server</h3>
<div style="font-family: arial;">
<code>$ rsync -r -a -v --delete rsync://192.168.1.1/data /home/nishith/</code></div>
<span style="font-family: arial;"><br />"rsync" command common options.</span> <br />
<ul style="font-family: arial;">
<li><strong>--delete</strong> : delete files that don't exist on sender (system)</li>
<li><strong>-v</strong> : Verbose (try <strong>-vv</strong> for more detailed information)</li>
<li><strong>-e "ssh options"</strong> : specify the ssh as remote shell</li>
<li><strong>-a</strong> : archive mode</li>
<li><strong>-r</strong> : recurse into directories</li>
<li><strong>-z</strong> : compress file data</li>
</ul>
<br />
<br />
<br />
<span style="font-family: arial;"></span></div>
Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-51626880353588832562010-05-15T13:49:00.004+05:302010-05-15T13:53:12.763+05:30Use "Iptables" for ssh & http connections per IP Address.<pre style="font-family: arial;"><span style="font-weight: bold; color: rgb(0, 204, 204);">Allow "3 ssh" connections per client host:</span><br />/sbin/iptables -A INPUT -p tcp --syn --dport 22 -m connlimit --connlimit-above 3 -j REJECT<br /><br /><span style="font-weight: bold; color: rgb(0, 204, 204);">Allow "20 http" connections per IP (MaxClients is set to 60 in httpd.conf)</span><br />/sbin/iptables -A INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 20 -j REJECT --reject-with tcp-reset<br /><br /><br /><br /><br /></pre>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-67648320151806724302010-05-15T13:00:00.003+05:302010-05-15T13:05:18.593+05:30Mount a remote folder through SSH<h2 style="font-family: arial;"><span style="font-size:100%;">Subject : Mount a remote folder through SSH Service.<br /></span></h2> <pre style="font-family: arial;"><span style="font-size:100%;"><span style="font-weight: bold;">Command is</span> :<br /><span style="color: rgb(255, 0, 0);">$ sshfs user@server:/path/to/folder /mount/point</span><br /><br /><span style="color: rgb(255, 0, 0);">Syntax :</span><br /><span style="color: rgb(255, 0, 0);">$sshfs nishith@192.168.1.21:/home/nishith /data/</span><br /></span></pre> <p style="font-family: arial;"><span style="font-size:100%;">You can mount a remote directory locally via SSH! You'll first need to install below programs however:</span></p> <ul style="font-family: arial;"><li><span style="font-size:100%;">FUSE that allows to implement filesystems in userspace programs. (yum install fuse)<br /></span></li><li><span style="font-size:100%;">sshfs client that uses FUSE<br /></span></li><li><span style="font-size:100%;"><code>sftp</code> (secure ftp - comes with OpenSSH, and is on your system already) to access the remote host.</span></li></ul> <p style="font-family: arial;"><span style="font-size:100%;">And that's it, now you can use<span style="font-weight: bold;"> </span><code style="font-weight: bold;">sshfs</code> to mount remote directories via SSH.</span></p> <p style="font-family: arial;"><span style="font-size:100%;">To Unmount, use<code></code>:</span></p> <pre style="font-family: arial; color: rgb(255, 0, 0);"><span style="font-size:100%;">fusermount -u "mount point"<br /><br /><br /><span style="color: rgb(0, 0, 0);">Regards,</span><br /><span style="color: rgb(0, 0, 0); font-weight: bold;">Nishith Vyas</span><br /></span></pre>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-67937853860805149562010-05-03T08:54:00.004+05:302010-05-03T08:58:39.957+05:30Login as a root from GUI RHEL6 BETA<p style="font-family: arial;"><span style="font-size:85%;"><strong>WARNING :- Its not at all good to login as root from GUI. It’ DANGEROUS. BUT if some one wants to know that how to login as a root from GUI then follow the instructions.<br /></strong><br />In RHEL6 Beta You cannot login as a root from GUI. By Default, Only Normal users are allowed in GUI Mode.<br /></span></p> <p style="font-family: arial;"><span style="font-size:85%;">Follow these steps and you will able to login as a root from GUI on RHEL6 Beta.<br /></span></p> <p style="font-family: arial;"><span style="font-size:85%;">Main Configurable File is "/etc/pam.d/".<br /></span></p><p style="font-family: arial;"><span style="font-size:85%;">Have a look of below steps.<br /></span></p> <p style="font-family: arial;"><span style="font-size:85%;">Open your Terminal from Applications -> System Tools -> Terminal</span></p> <p style="font-family: arial;"><span style="font-size:85%;">Now Login as a root from your terminal</span></p> <p style="font-family: arial;"><span style="font-size:85%;">Step 1 :- [user@localhost]$ su – root<br />Password:-</span></p> <p style="font-family: arial;"><span style="font-size:85%;">Step 2:- Now go to your /etc/pam.d/ directory.</span></p> <p style="font-family: arial;"><span style="font-size:85%;"><strong>[root@localhost]# cd /etc/pam.d/</strong></span></p> <p style="font-family: arial;"><span style="font-size:85%;">Then first take a backup of gdm file</span></p> <p style="font-family: arial;"><span style="font-size:85%;">cp gdm gdm.bkp ( always take backup if anything goes wrong you can correct it by original file)</span></p> <p style="font-family: arial;"><span style="font-size:85%;">Step 3 :- Now Open gdm file in your favorite editor. I am using vi as my editor.</span></p> <p style="font-family: arial;"><span style="font-size:85%;"><strong>[root@localhost]#</strong> vi gdm</span></p> <p style="font-family: arial;"><span style="font-size:85%;"><strong>Find and Comment or remove this line into your gdm file<br />auth required pam_succeed_if.so user != root quiet</strong></span></p> <p style="font-family: arial;"><span style="font-size:85%;">Step 4 :- Save & Exit From that File.<br /></span></p> <p style="font-family: arial;"><span style="font-size:85%;">Step 5 :- Here is the additional file that you need to edit and that file name is gdm-password. Open "gdm-password" file in your favorite editor. I am using vi as my editor.</span></p> <p style="font-family: arial;"><span style="font-size:85%;">Then first take a backup of gdm-password file</span></p> <p style="font-family: arial;"><span style="font-size:85%;">cp gdm-password gdm-password.bkp ( always take backup if anything goes wrong you can correct it by original file)</span></p> <p style="font-family: arial;"><span style="font-size:85%;"><strong>[root@localhost]#</strong><strong> vi gdm-password</strong></span></p> <p style="font-family: arial;"><span style="font-size:85%;"><strong>Find and Comment or remove this line into your gdm file<br />auth required pam_succeed_if.so user != root quiet</strong><br /><br /><strong><br />Step 6 :- Save & Exit from File. Now Logout and Try to Login as a root user. Now you are able to Login as a root user from GUI in RHEL6 Beta.<br /></strong></span> </p> <p style="font-family: arial;"><span style="font-size:85%;">Thanks,</span></p><p style="font-family: arial;"><span style="font-size:85%;">RHEL6 Beta Edition.<br /></span></p><span style="font-size:85%;"><span style="font-family: arial;"></span></span>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-72762364605848811312010-03-25T14:50:00.004+05:302010-03-25T15:05:06.408+05:30Mirroring entire directory with "mirrordir" command<span style="font-family: arial; color: rgb(255, 102, 0); font-weight: bold;">Note :- "mirrordir" setup has been tested on CentOS / RHEL 5x versions only. </span><br /><br /><span style="font-weight: bold; font-family: arial;">Introduction :</span><br /><br /><span style="font-family: arial;"> mirrordir copies files that are different between the directories control and mirror to the directory mirror. Files whose modification times or sizes differ are copied. File permissions, ownerships, modification times, access times (only if --access-times is used), sticky bits, and device types are duplicated. Symlinks are duplicated without any translation. Symlink modification and access times (of the symlink itself, not the file it points to) are not preserved. Hard linked files are merely copied. </span><br /><br /><span style="font-family: arial;"><span style="font-weight: bold;">mirrordir</span> command supports strong stream cipher encryption and Diffie-Hellman key exchanges with several possible key sizes.<br /><br /><span style="font-weight: bold;">Hand's On Exercise :</span><br /><br />yum install mirrordir<br /><br />Create a new directory named "backup"<br />cd /<br />mkdir backup<br /><br />Now, mirror existing data onto "backup" directory.For Example, We will take backup of "nishith" directory.<br /><br /><span style="font-weight: bold;">mirrordir -v nishith nvbkup</span><br />Output is as shown below.<br /><br />mirrordir: ---verbose--- copying file: /nvbkup/file5<br />mirrordir: ---verbose--- copying file: /nvbkup/file1<br />mirrordir: ---verbose--- copying file: /nvbkup/file2<br />mirrordir: ---verbose--- copying file: /nvbkup/file3<br />mirrordir: ---verbose--- copying file: /nvbkup/file4<br />mirrordir: ---verbose--- all hardlinks located<br />mirrordir: Total mirrored: 5kB<br /><br />If you rerun the "mirrordir" command, only the updated files are copied.<br /></span><br /><span style="font-family: arial;"><span style="font-weight: bold;">mirrordir -v nishith nvbkup</span><br />Output is as shown below.<br /><br />mirrordir: ---verbose--- copying file: /nvbkup/file6<br />mirrordir: ---verbose--- copying file: /nvbkup/file1<br />mirrordir: ---verbose--- all hardlinks located<br />mirrordir: Total mirrored: 5kB<br /><br />For More Information, "man mirrordir"<br /><br />You can use "cron" script for automated backup of your data directories.<br /><br /><br /></span><br /><span style="font-family: arial;"><br /></span>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-78384947418164447972010-02-09T14:03:00.009+05:302010-10-08T08:08:40.382+05:30<h2 style="text-align: center; margin-left: 40px; color: rgb(153, 51, 0); font-weight: bold;font-family:arial;"><span style="font-size:100%;">HOWTO- Apache "httpd" authentication in Linux</span></h2><br /><span style=";font-family:arial;font-size:100%;" >Create a directory on "apache" document root,which is "/var/www/html"</span><br /><div style="margin-left: 40px; color: rgb(0, 0, 0);font-family:arial;"><span style="font-size:100%;"><br />mkdir /var/www/html/nishith<br />cd /var/www/html/nishith<br /><br /><span style="font-weight: bold;">Create simple "index.html" page. </span><br /><br /><eof></eof>Now, Open "/etc/httpd/conf/httpd.conf" file and <span style="color: rgb(255, 0, 0); font-weight: bold;">add/modify </span>following lines.<br /><br /><directory>Options Indexes Includes </directory><br /><directory> AllowOverride AuthConfig </directory><br /><directory> </directory><br /><directory>Create ".htaccess" file in "/var/www/html/nishith/.htaccess" & add below lines.<br /> AuthType Basic<br /> AuthName "My Private Page"<br /> AuthUserFile /etc/httpd/conf/.htaccess<br /> require valid-user<br /></directory><br /><br />Now, Create/Add new user to access<span style="font-weight: bold;"> "/var/www/html/nishith"</span> page<br /><br /><span style="color: rgb(255, 0, 0); font-weight: bold;">htpasswd -mc /etc/httpd/conf/htpasswd nishith </span><br />New password:<br />Re-type new password:<br />Adding password for user nishith<br /><br />View the content of "htpasswd" file<br />cat /etc/httpd/conf/htpasswd<br />nishith:$apr1$akwCX...$c3uo.k4oHIQNzlSEDQYMh0<br /><br /><span style="font-weight: bold;">Note</span>:-<br />To add few more user we should use only -m, the -c option will create the file always, but as the file exist so do not use -cm option once the file was created.<br /><br />htpasswd -m /etc/httpd/conf/htpasswd alex<br />New password:<br />Re-type new password:<br />Adding password for user alex<br /><br />cat /etc/httpd/conf/htpasswd<br /><span style="font-weight: bold;">nishith:$apr1$akwCX...$c3uo.k4oHIQNzlSEDQYMh0 </span><br /><span style="font-weight: bold;">alex:$apr1$70g94/..$m8QyD4gQisd265nLW7pbR0 </span><br /><br />Finally, access your webpage in your browser by typing,<br />http://ip address/nishith (from remote pc)<br /><br />OR<br /><br />http://localhost/nishith ( from local pc only)<br /><br /><span style="font-weight: bold; color: rgb(51, 102, 255);">That's it.</span><br /></span></div>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0tag:blogger.com,1999:blog-8498867271087223494.post-30870687606788101602010-02-09T13:43:00.007+05:302010-02-09T13:55:49.928+05:30Increase "swap" space in Linux<span style="font-family: arial;"><span style="font-weight: bold; color: rgb(255, 153, 0);">How to increase "swap" memory in Linux.</span><br /><br />1) Create a new hard drive partition. I will use<span style="font-weight: bold;"> "/dev/sda"</span> for this practical.<br /><br />To verify your hard drive identity, use <span style="font-weight: bold;">"fdisk -l" </span><br /><br />2) Follow these steps.<br /><br />- fdisk /dev/sda<br />Press "n" for new partition.<br />You'll get First Cylinder Name :- Press Enter<br />You'll get Last Cylinder Name :- type "+500M" (Adding 500MB as a swap space)<br /><br />- Press "t" to assign "swap" id for a newly created partition. Here,redhat uses "82" as a swap id.<br />- Press "w" to write changes to disk & exit.<br /><br />3) Use "partprobe" command<br /><br />4) mkfs.ext3 /dev/sda6 Making File System on a newly created partition,i.e.<span style="font-weight: bold;"> /dev/sda6</span><br /><br />5) mkswap /dev/sda6 Make this partition as a "swap"<br /><br />6) swapon /dev/sda6 Enable "swap" partition.<br /><br />7) Use "top" command to check the total memory size.<br /><br />8) Make permanent entry of "swap" space during reboot, Write a new line in "/etc/fstab"<br /> /dev/sda6 swap swap defaults 0 0<br /><br />save & exit (:wq)<br /><br />9) Reboot Linux & Check.<br /><br /><span style="font-weight: bold; color: rgb(153, 153, 153);">That's it</span><br /></span>Nishith Vyashttp://www.blogger.com/profile/05856051335663380707noreply@blogger.com0