Wednesday, October 21, 2020
Home Linux What is a Linux Swap Partition? Everything you need to know

What is a Linux Swap Partition? Everything you need to know

Most Linux installations recommend including a swap partition in it. This may seem strange to Windows users who are used to running the entire operating system in one partition.

What does the swap partition do, Do you even need it, and how big should it be? These are all important questions that, with the right answers, can seriously improve system performance.

What the Linux Swap partition does

Partitions on Ubuntu Linux

The swap partition acts as an overload condition for your RAM. If the RAM is completely full, all other applications will run the swap partition instead of RAM.

This may sound like an easy way to increase the amount of memory available to your computer without getting more RAM yourself, but this is not the case. RAM is ideal hardware for memory because it is very fast, unlike hard drives, which are relatively little slower.

Hard disk drive performance may have reduced the problem at their greatly improved speeds

How do semiconductor stations work?
In this article, you will learn exactly what SSDs are, how SSDs actually work and work, why SSDs are so useful, and what is the biggest downside to SSDs.
Read more

, but even they do not match the RAM. This is also true newer NVMe SSDs

What is an M.2 SSD? Pros, cons and how to install it
Do you want your operating system to run faster? The answer is to use an M.2 SSD. Here’s what you need to know.
Read more

. In either case, you don’t want to cause extra wear and tear on your solid-state drive.

A close analogy to the exchange partition is Windows page file

Troubleshoot low RAM or memory leaks in Windows
Do you have 4GB or more of RAM and still feel your computer is slow? You may suffer from a memory leak or shortage. We show you how to troubleshoot all Windows programs (10) …
Read more

, although there are many technical differences between the two.

The Linux swap partition is not limited to overflow storage space. It can help your computer in other ways.


A swap partition can also help move some items from memory to your hard drive so that others have more space for more important items. This means that items that are rarely touched would move to the swap section.

The amount of threshold considered rare depends on the configurable “interchangeability” (yes, it is a term actually used). Higher interchangeability means that data is more likely to be transferred to the exchange partition. Lower turnover means that data is less likely to be transferred to the exchange partition.


The swap partition is used to target the contents of memory whenever you tell the system to hibernate. This means that without a swap partition, hibernation in Linux is impossible.

Using the Hibernation feature has become quite rare, so this may not be important to you.

Need a swap partition?

Create a swap partition for Ubuntu Linux

Does this mean that an exchange partition is necessary? Not at all! A Linux system can work great without a swap partition. We have already discussed the benefits of the exchange section. Why might you not want to get one?

When Swap partitions don’t help

Swap partitions have their low sides. They take up space on your hard drive that does not resize dynamically when not in use. Heavy replacement can also increase main station wear. In some cases, swap partitions don’t even help improve performance. Here is an example that a removable partition can actually be worse than without it.

Let’s say you’ve installed Linux on an old netbook with only 2GB of RAM and a 5400rpm hard drive. With just 2GB of memory, you can imagine filling up pretty quickly with a few open browser tabs. The swap section lets you keep them all open when the memory becomes full

How much RAM do you really need?
How much computer memory do you need? This allows you to check the amount of RAM installed and how much RAM your computer needs.
Read more


But then a bottleneck occurs due to the hard drive speed of 5400 rpm. Because the hard drive is so slow and the system constantly wants to use the swap partition, the online book becomes very slow. The machine is slow enough to be idle unless you close anything to free up memory.

The set interchangeability does not guarantee that everyone in the swap partition will move back when space becomes free in RAM. Instead, a lot can be left in the swap partition, causing the netbook to remain slow. So you have to leave the computer to restart to start from a clean strip, which takes a while because the system has to remove everything from the replacement partition before shutting down.

What happens when you don’t have an exchange

If you decide to give up the exchange part, know the risks. When your computer needs more RAM than is available, the interface may lock. You may be forced to shut down your computer and lose all the data you are working on.

In such cases, you may want to have a swap partition around you, even if it is used only once. This depends on whether you are often running out of storage space. Do you find that you have 4GB less storage space available because you own that amount to change?

Linux-exchange recommendations

Here are some suggestions on when you want to get a replacement partition and how big it will be.

  • If you want to be able to hibernate your computer, then you should have a swap partition. The size of this partition should be the size of the installed memory and an additional 10-25% to make room for all items that have already been moved to the swap partition.
  • I just want small increase in performance (and you have at least a 7200 rpm hard drive)? Then you can add a swap partition if you want. This size can be anything, but I wouldn’t make it bigger than what you would do if you created a swap partition to hibernate.
  • If you sometimes use heavy applications For those who require extra RAM, a swap partition can be a peace of mind. In this case, you do not need to change the partition to be the same size as your RAM.
  • If you have a 5400 rpm hard drive, then you may not want to create a swap partition simply because a bottleneck can make your computer worse. But if you absolutely want to change the option, you can still create a partition with the same resizing instructions above. Just remember to change the interchangeability value to something much lower.

Changing Swappiness

Ubuntu Linux swap file

Like many aspects of the Linux desktop, the changeability of your computer is stored in a text file. To find this file, go to / Proc / sys / vm.

When you open the file, you will see a single number indicating your current change. You can edit this file with any text editor of your choice, as long as you have administrator rights.

To do this with Ubuntu and Fedora’s default GNOME text editor, try:

sudo gedit /proc/sys/vm/swappiness

There is also a command line option that works regardless of the text editor installed. Just type:

sudo sysctl vm.swappiness=20

You can enter any number between 0 and 100. The value indicates when you want Linux to begin actively moving processes from memory to the swap partition. So, for example, a value of 20 means that processes will shift when memory usage reaches 80%; the default switch value in Ubuntu 60 means that processes are moved when memory usage reaches 40%.

You can verify that the change was successful by reopening that text file. Not surprisingly, the terminal offers a faster way to check your turnover. Just type this command:

cat /proc/sys/vm/swappiness

Does your computer feel faster?

Replacement partitions can make a big difference in system performance – sometimes for the better and sometimes for the worse. Now that you know what an exchange partition is, hopefully you will be better able to make the decision that is right for your situation.

But before reallocating a partition, know that memory management has more than the amount of RAM you have and the size of the Linux swap partition. Take a moment to learn how Linux manages RAM

Is Linux eating up your RAM? How to manage your memory
Why is Linux suddenly running slow? This allows you to check RAM usage and speed things up again on your Linux computer or laptop.
Read more


Patriotic Hackers is an online tech and life hacks website. You can get here all kinds of content on Simplified Technology and Crafts. So you can catch us on Social Media Platforms to stay updated with us.


Please enter your comment!
Please enter your name here

Most Popular

Facebook starts merging Instagram and Messenger conversations

In early 2019, Facebook hinted at the matter plans to combine Instagram, Messenger and WhatsApp ...

Telegram initiates encrypted video calls one by one

Having operated as a secure application for text messaging and voice-only calls for several years, Telegram has finally added video calling to the...

You can now vote for Doodle in the Google 2020 contest

A few months ago, Google asked for comments on the annual K-12 competition to create Doodle, which will appear on the search engine’s...

Samsung is revealing which devices will receive the 3 major updates

One of the biggest problems anyone faces when choosing an Android phone is the number of updates their device gets. Will they get...

Recent Comments