How To View & Disable Swap Memory in CentOS
The swap feature in operating systems such as CentOS is an essential component that allows for the efficient utilization of system resources. Swap is essentially a space that can be represented by a file or partition on the hard disk, which is used to store temporary files and data when the RAM memory is fully utilized. This feature enables the system to operate smoothly and prevents it from crashing due to insufficient memory.
However, with the advent of solid-state drives and the availability of larger RAM capacities, the need for swap space has diminished. In fact, disabling the swap partition in CentOS can actually optimize the system's resources and improve its performance.
By disabling the swap partition, the system can utilize its RAM memory to its fullest potential without relying on the hard disk space. This results in faster data access and processing times, thereby improving overall system performance. Additionally, disabling swap can also reduce wear and tear on the hard disk, which can prolong its lifespan.
It is important to note that disabling swap is not recommended for systems with less than 8 GB of RAM or those that frequently use memory-intensive applications such as video editing software or virtual machines. In such cases, swap space can still be useful in preventing system crashes and improving overall stability.
See Amount of Swap Memory in CentOS
First of all we must verify what amount of swap memory is defined for the equipment, this is possible to verify using the following command:
In this example we can see that although we have 1.8 GB available for swap memory, the use is in 0 bytes, so there is an indication that physical memory is more than enough for the tasks carried out in CentOS.
Now, to identify the path where swap is located, we must execute the blkid command :
We can observe the line TYPE = “swap” to define and identify the swap partition. Now, we will run the lsblk command and we will see the following:
There we can determine that the swap partition is hosted on sda2. Once we identify the partition where swap is, we proceed to execute the following command to disable swap in CentOS 7:
We run the free -h command again to verify that swap has been disabled correctly:
Permanently Disable Swap Memory in CentOS 7
If the objective is to permanently disable the swap partition in the system, we must access the file / etc / fstab using the desired editor:
Once there, we should comment on the swap line by prefixing the # sign like this:
We save the changes using the following key combination Ctrl + O and exit the editor using Ctrl + X.
Then we can restart the operating system, or use the mount -a command to apply the changes.
After this we can execute the following commands to verify that swap has been permanently disabled:
free -h blkid lsblk
This way we have disabled swap in CentOS.
It might be interesting
How to Kill a Process On Any Linux Distribution
If you are a new Linux user of any distribution, you probably don’t know how to use one of the essential commands, which is the one that helps us to terminate running processes.
Mount Linux Partitions Ext4, Ext3, Ext2 in Windows 8, 10, 11
If you're a tech enthusiast, you may have come across the challenge of accessing Linux partitions in Windows 10. This can be a common issue for those who use dual boot devices or those who tinker with Raspberry Pi memory cards. Unfortunately, Windows only allows working with partitions in Fat32, NTFS or exFAT format, which can make it difficult to access other file systems such as Ext2, Ext3, Ext4 or even ReiserFS.
Google Voice, explained
The new Google Voice blog explains clearly all you have to know about Google voice and how you can develop new ways of communications through its additional features.
6 Best Tools To Manage Linux Partitions
One of the most essential building blocks in any computer system is the hard drive. It serves as a crucial storage component, hosting numerous applications and programs including the operating system itself. Managing multiple hard drives can be challenging, thus requiring helpful tools to ease the process.