Posts

Showing posts from February, 2017

How to Increase the size of a Linux LVM by expanding the virtual machine disk

Image
Identifying the partition type As this method focuses on working with LVM, we will first confirm that our partition type is actually Linux LVM by running the below command. fdisk -l As you can see in the above image /dev/sda5 is listed as “Linux LVM” and it has the ID of 8e. The 8e hex code shows that it is a Linux LVM, while 83 shows a Linux native partition. Now that we have confirmed we are working with an LVM we can continue. For increasing the size of a Linux native partition (hex code 83)  see this article. Below is the disk information showing that our initial setup only has the one 20gb disk currently, which is under the logical volume named /dev/mapper/Mega-root – this is what we will be expanding with the new disk. Note that /dev/mapper/Mega-root is the volume made up from /dev/sda5 currently – this is what we will be expanding. Increasing the virtual hard disk First off we increase the allocated disk space on the virtual machine itself. This is done by right

Generate CPU, Memory & I/O report using SAR command RHEL 7

Using sar you can monitor performance of various Linux subsystems (CPU, Memory, I/O..) in real time. Using sar, you can also collect all performance data on an on-going basis, store them, and do historical analysis to identify bottlenecks. Sar is part of the sysstat package. This article explains how to install and configure sysstat package (which contains sar utility) and explains how to monitor the following Linux performance statistics using sar. Collective CPU usage Individual CPU statistics Memory used and available Swap space used and available Overall I/O activities of the system Individual device I/O activities Context switch statistics Run queue and load average data Network statistics Report sar data from a specific time This is the only guide you’ll need for sar utility. So, bookmark this for your future reference. I. Install and Configure Sysstat Install Sysstat Package First, make sure the latest version of sar is available on your system. Install

How to Clear RAM Memory Cache, Buffer and Swap Space on Linux

Every Linux System has three options to clear cache without interrupting any processes or services. 1.  Clear PageCache only. # sync; echo 1 > /proc/sys/vm/ 2. # sync; echo 2 > /proc/sys/vm/drop_caches 3.  Clear PageCache, dentries and inodes. # sync; echo 3 > /proc/sys/vm/drop_caches Explanation of above command. sync  will flush the file system buffer. Command Separated by  “;”  run sequentially. The shell wait for each command to terminate before executing the next command in the sequence. As mentioned in kernel documentation, writing to  drop_cache  will clean cache without killing any application/service,  command echo  is doing the job of writing to file. If you have to clear the disk cache, the first command is safest in enterprise and production as  “...echo 1 > ….”  will clear the  PageCache  only. It is not recommended to use third option above  “...echo 3 >”  in production until you know what you are doing, as it will clear  PageCache ,  dentri