Tuesday, February 14, 2023

How to increase Swap Memory in CentOS 7

 

Copied from : https://www.edureka.co/community/24087/how-to-increase-swap-memory-in-centos-7



Follow the below steps and procedures:

Prerequisites

Must have free space on mounted disk. You can check by using df -Th command.

Next follow these:

1. Create swapfile-additional file with dd command in / (root). You can select any other partition but it should be mounted (For eg. /opt, /usr ,/NewMountedPartition)

dd if=/dev/zero of=/swapfile-additional bs=1M count=4048

dd = It is a unix command used for convert and copy a file
if = read from FILE instead of stdin
/dev/zero = /dev/zero is a special file in Unix-like operating systems that provides as many null characters (ASCII NUL, 0x00) as are read from it
of = write to FILE instead of stdout
/swapfile-additional = file named swapfile-additional will be created in /
bs = Read and write bytes at a time but if you do not mention MB or GB like only number it will read as bytes. for eg. bs=1024 means 1024 bytes
count = Copy input blocks in our case it is 1024 (1M * 4048 = 4GB)

2. Run mkswap command to make swap area

mkswap /swapfile-additional

3. Change the permission of file swapfile-additional

chmod 600 /swapfile-additional

4. Permanent mounting the swap space by editing the /etc/fstab file .
Use your file editor, I generally use vi editor.

vi /etc/fstab

Paste below given content in /etc/fstab file

/swapfile-additional swap swap    0   0

5. Now mount the swap area, run below given command.

mount -a

6. Enable the swap area

swapon -a

7. Check the number swap space mounted on your system

swapon -s

8. To check how much is swap space available on system. Run below given command

free -m


Hope it helps!

 

 

Friday, February 10, 2023

CPU Isolation

Copied from  

https://www.linkedin.com/pulse/cpu-isolation-affinity-linux-vinit-tirnagarwar

 

3. To check CPU isolation is done or not. Fire below command

cat /sys/devices/system/cpu/isolated Isolated CPU number you will get as output. If No Cpu is isolated then you will get an empty Output

Note: This change will be applicable for current boot only. Once system is rebooted settings will go away.

*To isolate CPU permanently for every boot done by grub follow below method.

1. In kernel boot options we can provide kernel boot parameter. “ isolcpus= ‘CPU Number’ ” In grub config we can mention this boot parameter. To update grub config mention this parameter in file “/etc/default/grub” mention parameter as isolcpus=2 in front of GRUB_CMDLINE_LINUX which says isolate cpu number 2.

Note: remember you can’t isolate all the processors.

For example: GRUB_CMDLINE_LINUX = “isolcpu=0-2” 

arameter as isolcpus=2 in front of GRUB_CMDLINE_LINUX which says isolate cpu number 2.


Updating Grub boot loader on an RHEL or CentOS Linux

    Open the terminal app
    Edit the /etc/default/grub as per your needs. For example:
    sudo vim /etc/default/grub
    Type the following command as root user:
    sudo grub2-mkconfig -o /boot/grub2/grub.cfg

    Reboot your Linux box
    sudo reboot

Monday, February 6, 2023

VIM C++ SUPPORT

 Install latest VIM from git

 

 vi .bashrc

alias vi="vim"


vi ~/.vimrc

unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
set mouse=