How to easily increase and free swap memory in Ubuntu Linux?

Increase and free swap memory in Ubuntu Linux

The first thing you will learn is increase swap memory space. For those who do not know what this memory is, should know that it is basically virtual memory space, it uses the space included in the storage drive unlike the real one.

When the latter is finished or reaches its limit, the computer copies some of the content into virtual memory, so that it can continue to function normally (this process is performed by all operating systems, since it is possible to configure and increase virtual memory in Windows if you want to too).




To increase and free swap memory in Ubuntu Linux there are many methods, but the simplest (when it comes to increasing it) is to add a file di swap, to do this you need to do the following:

How to easily increase and free swap memory in Ubuntu Linux?

First determine the size of the new swap file to be created. Choose the one you want and then multiply it by 1024, for example if the block size is 64MB it would be 65536.

At a Shell command prompt as root, enter the command dd if = / dev / zero of = / swapfile bs = 1024 count = 65536 where count will be the size of the swap block.

Then configure the swap file with the following command mkswap / swapfile, once done you have to use another command which would be swapon / swapfile, the latter is used to activate the file at that moment but not automatically when the computer starts.

If you want it to be activated on startup, change / etc / fstab in so that it can include / swapfile swap swap default 0 0. This will make the new swap file you entered (this is the most recommended).




Free up space

With the above it is already clear the first part of how to increase and free swap memory in Ubuntu Linux, the second part of logic is learning to free up space.

This can also be done with commands from a terminal, it will also allow you to see how much memory is being used before cleaning it.

To do the latter you have to go to the terminal and enter the following command: cat / proc / swaps, which will return a message with the size of the memory and the space that is in use, as well as indicating where the partition is located.

Once you've read everything, run the command: swapoff -a && swapon –a, this will cause the space in use to drop to 0, ie the swap memory will have been cleaned.


With this you already know what is needed to increase and free up Swap memory in Ubuntu Linux. We recommend that you ask for help if you are not an expert in this type of topic, as any mistake can be costly for your team (beyond that there are many other more complicated methods).


How to easily increase and free swap memory in Ubuntu Linux?


 

In conclusion, it should be noted how nice it is to use an operating system like Linux, which gives you the freedom via commands to change the parts you want on your PC. For example, you can update the Ubuntu system to the latest version from the terminal and even repair broken or poorly installed packages, so knowing this should be your next step.

add a comment of How to easily increase and free swap memory in Ubuntu Linux?
Comment sent successfully! We will review it in the next few hours.