Skip to content
Technology News Information & Jobs

Technology News Information & Jobs

Ubuntu Tutorials, Ubuntu How To , Linux Tips, Tech Jobs

  • Work with US
  • Search Jobs
  • Post a Job
  • Contact Us
  • Ubuntu
    • Ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • Themes
  • Linux
  • Laptops
  • Tutorials
  • Job Dashboard
  • Toggle search form
How To Add Swap Space On CentOS 8

How To Add Swap Space On CentOS 8

Posted on May 14, 2020 By admin No Comments on How To Add Swap Space On CentOS 8

Tutorial to add swap space on CentOS 8

Previously we covered an article on adding swap space on Ubuntu 20.04 LTS. In this article, we are going to do the same thing but with CentOS 8 Linux.

When RAM is full, It takes inactive pages from the RAM. Swap space is used when RAM is full in your system.

How To Define Swap Space In CentOS 8

  • Swap space 3 times of the RAM if your system has less than 2 GB RAM
  • Swap space same size of the RAM if your system has systems has 2 to 8 GB RAM
  • Systems with more than 8 GB RAM then your Swap space will be at least 4 GB of Swap

How To Add Swap Space On CentOS 8

At first, we need to create a swap file that will serve as swap space in your CentOS 8. We are creating a Swap file with 2 G.

sudo fallocate -l 2G /swapfile

Now, use the dd command to create the swap file:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=2097152

We are setting permission right to 600.

sudo chmod 600 /swapfile

Create a Linux swap area on the file:

sudo mkswap /swapfile

Run the following command to activate the swap file.

sudo swapon /swapfile

Verify that the swap is active.

sudo swapon --show

Or,

sudo free -h

Now, You can make the change permanent by adding a swap entry in the /etc/fstab file:

sudo nano /etc/fstab

and paste the following line:

/swapfile swap swap defaults 0 0

Swappiness Value In CentOS 8

Swappiness is a method that defines how often your Linux system will use the swap space.  Default swappiness value is30 in CentOS 8. You can check the current value with the following command.

cat /proc/sys/vm/swappiness

Note: It can have a value between 0 and 100. A lower value is better as it will make the kernel try to avoid swapping whenever possible and at the same when you have a higher value, the kernel will try to use Swap Space like never before.

READ More Relevant Stuff:  List Of Best Tutorial Websites To Learn Linux Online In 2023

Meanwhile, if you want to set the swappiness value, then you need to open the /etc/sysctl.conf file and add the following line.

vm.swappiness=20

Run the following command to delete or deactivate the Swap value in CentOS 8

sudo swapoff -v /swapfile

Now, you can remove the swap file entry /swapfile swap swap defaults 0 0 from the /etc/fstab file.

Run the following command to remove the actual swapfile file with the following command:

sudo rm /swapfile
Linux, Linux Commands Tags:CentOS 8, linux commands

Post navigation

Previous Post: Configure CTRL+ALT+DEL As Task Manager In Ubuntu 20.04/18.04
Next Post: Install Numix Circle Icon Theme In Ubuntu 20.04 LTS : Ubuntu Themes

Related Posts

Downgrade Packages On Linux System: Linux Guide 2020 Downgrade Packages On Linux System: Linux Guide 2022 Linux
Pop!_OS 20.10 Released Pop!_OS 20.10 Released: Based On Ubuntu 20.10 Linux
Best Digital Audio Workstation Apps For Linux Best Digital Audio Workstation Apps For Linux [ DAW For Linux] Linux
List Of Open Source Cloud Storage Software For Linux In 2021 List Of Open Source Cloud Storage Software For Linux In 2023 Linux
Linux Mint 21.2 Beta Is Now Available For Download Linux Mint 21.2 Beta Is Now Available For Download Linux
Visual Studio Code 1.26 Released : Download Now Ubuntu

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Enable Hibernate in Ubuntu 22.04 LTS May 20, 2024
  • Popular Ubuntu Games: Top 5 Games To Play March 17, 2024
  • WordPress | Your site doesn’t include support for the “generateblocks/container” block GenerateBlocks Plugin February 11, 2024
  • Ubuntu Autoremove Command Debian Autoremove Command February 10, 2024
  • How To Mount Windows 11 Shares on Debian Linux December 7, 2023
  • Anonymous Browsing 101: A Deep Dive Into Residential Proxies November 20, 2023
  • How To Correctly Install Uninstall Linux Ubuntu Nvidia Drivers Fast October 31, 2023
  • Ethical Web Design: The Dos and Don’ts October 28, 2023
  • Understanding the Role of Security Operations Center October 25, 2023
  • The Positive Effects of AI Tools and Online Services on Students Successful Essay-Writing Skills October 3, 2023
  • Linux Wget Examples September 27, 2023

Categories

  • Android
  • Apple
  • Blogs
  • Debian
  • Fix
  • Gadgets
  • Game
  • Google
  • How To Ubuntu
  • Internet
  • Laptops
  • Linux
  • Linux Commands
  • Linux Game
  • Linux Mint
  • News
  • Operating Systems
  • Security
  • Technology
  • Themes
  • Tools
  • Tutorials
  • Ubuntu
  • ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • Windows 11
  • Wordpress
  • Search Jobs
  • Post a Job
  • Job Dashboard
  • Contact Us
  • About US
  • Cookie Policy
  • Terms and Conditions
  • Privacy Policy
  • Sitemap
  • Write For US

Tags

android apps centos ChatGPT command Commands Debian deepin Desktop docker Fedora fix game games Gaming gnome google kernel linux linux commands linux kernel Linux laptops Linux Mint Linux themes minecraft NVIDIA Python Raspberry Pi sysadmin themes ubuntu ubuntu 18.04 Ubuntu 18.04 LTS Ubuntu 20.04 ubuntu 20.04 lts Ubuntu 22.04 LTS Ubuntu games Ubuntu kernel ubuntu themes ubuntu tutorial VirtualBox Windows Windows 11 Wine WSL
itsubuntu.com is an Equal Opportunity Employer. For Advertisement, Jobs, Guest posts, and any other thoughts, email us at [email protected]
  • Senior Data Engineer (Python)

    • Newport News, VA (Remote)
    • Capital One Bank
    • Full Time
  • Software Engineer (Technical Leadership) – ML Specialist- Business AI Menlo Park, CA • Artifici[…]

    • Menlo Park, CA
    • Jobleads-US
    • Full Time
  • Azure Architect

    • Washington DC
    • AIS (Applied Information Sciences)
    • Full Time
  • Artificial Intelligence (AI) Specialist (San Francisco)

    • San Francisco, CA
    • Forhyre
    • Full Time
  • Commercial Director, AI & Optimization

    • Foster, CA
    • Gilead Sciences
    • Full Time
  • Digital Transformation Architect (Berkeley)

    • Berkeley, MO
    • BOEING
    • Part Time
  • Principal Architect – LINUX – Active Top Secret Required

    • Washington DC
    • AECOM
    • Full Time
  • Psychological Thriller- Co-writer

    • Remote
    • Mary Stone Publishing
    • Temporary

Copyright © 2025 Technology News Information & Jobs.

Powered by PressBook Grid Blogs theme