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
Tutorial To Add Swap Space On Ubuntu 20.04

Tutorial To Add Swap Space On Ubuntu 20.04

Posted on May 13, 2020May 14, 2020 By admin No Comments on Tutorial To Add Swap Space On Ubuntu 20.04

How to Add Swap Space on Ubuntu 20.04

We need Swap Space in Linux. When our RAM is full, Swap space does the role of the smooth operation of our system. It takes inactive pages from the RAM.

In this article, we are going to discuss the methods of adding swap space on Ubuntu 20.04 LTS.

Tutorial To Add Swap Space On Ubuntu 20.04

This tutorial explains how to add a swap file on Ubuntu 20.04 LTS.

Note: If your system constantly runs out of memory, you should add more RAM, not the Swap Space.

At first, we need to create a swap file.

sudo fallocate -l 2G /swapfile

Use the following command if you don’t have fallocate utility in your Ubuntu 20.04 LTS to create Swap space.

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

Swappiness Value Setting In Ubuntu 20.04 LTS

Swappiness is a method that defines how often your Linux system will use the swap space.  On Ubuntu, the default swappiness value is set to 60. 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:  How To Install aaPanel On Ubuntu 22.04 LTS | cPanel Alternative

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 Ubuntu 20.04 LTS.

sudo swapoff -v /swapfile

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

remove the actual swapfile file with the following command:

sudo rm /swapfile

How To Define Swap Space In Ubuntu 20.04

 

  • 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

 

Ubuntu 20.04 Tags:best linux tutorial, linux tutorial, Swap Space, ubuntu 20.04 lts

Post navigation

Previous Post: Best NES Emulators For Ubuntu 20.04 LTS: Play Old NES Games
Next Post: Wow Unity Is Back With Ubuntu Unity Remix 20.04 LTS Focal Fossa

Related Posts

Install Microsoft Edge Browser on Ubuntu 20.04 Install Microsoft Edge Browser on Ubuntu 20.04 Ubuntu 20.04
Install Nginx On Ubuntu 20.04 LTS Install Nginx On Ubuntu 20.04 LTS Linux
Install Virtual Box On Ubuntu 20.04 LTS | VirtualBox 6.1.10 Released with Kernel 5.7 Support Install VirtualBox On Ubuntu 20.04 LTS | VirtualBox 6.1.10 Released with Kernel 5.7 Support Ubuntu 20.04
How To Install Composer On Ubuntu 20.04 LTS How To Install Composer On Ubuntu 20.04 LTS How To Ubuntu
How To Remove Software In Ubuntu 22.04 LTS [ All Ubuntu Version] How To Remove Software In Ubuntu 22.04 LTS [ All Ubuntu Version] Ubuntu
How to Fix “Username is not in the sudoers file. This incident will be reported” in Ubuntu How to Fix “Username is not in the sudoers file. This incident will be reported” in Ubuntu Tutorials

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]
  • Writer/Journalist Internship

    • Wakefield, MA
    • The Borgen Project
    • Internship
  • Business Analyst/Technical Writer

    • New York, NY
    • Lime Trading
    • Full Time
  • Science and Communications Writer/Editor

    • Boston, MA
    • Dana-Farber Cancer Institute
    • Full Time
  • Business Analyst-Technical Writer

    • Dallas, TX
    • Intellisoft Technologies
    • Full Time
  • Procedure Writer

    • Atlanta, GA
    • Synergis
    • Full Time
  • Technical Writer

    • Santa Clara, CA
    • Net2Source Inc.
    • Full Time
  • Senior Data Scientist, Core Product

    • Palo Alto, CA (Remote)
    • Data Masked
    • Full Time
  • Architectural Specifications Writer

    • Oakland, CA
    • Venture Personnel
    • Full Time

Copyright © 2025 Technology News Information & Jobs.

Powered by PressBook Grid Blogs theme