Software & Apps Linux 79 79 people found this article helpful Do You Need A Swap Partition? Will setting up swap space on your hard drive help your computer? By Gary Newell Writer Gary Newell was a freelance contributor, application developer, and software tester with 20+ years in IT, working on Linux, UNIX, and Windows. our editorial process Gary Newell Updated March 30, 2020 Linux Switching from Windows Tweet Share Email A question that is commonly asked when installing Linux is, "Do I need a swap partition?" In computing terms, when you first use a computer, most of the memory is available. The only memory used is from the processes required by the operating system. Every time you load an application, a new process starts, and an amount of memory is set aside for the application. Every time you load a new application, less memory is available to run that program. Eventually, the computer gets to a point where there isn't enough memory to run that application. This is when a swap partition in Linux comes into play. What Does Linux Do When There Isn't Enough Memory Left? It kills processes. This isn't something you want to happen. While there is a scoring mechanism for choosing which processes to kill, that decision is up to the operating system. Westend61 / Getty Images Linux only kills processes when virtual memory runs out. Virtual memory is the amount of physical RAM plus any disk space set aside for paging purposes (swap). Think of a swap partition as overflow space. When the main memory is full, the overflow space can be used for additional memory. There's a downside to using a swap partition. Generally, the swap partition is further away from the regular memory, and data must move further, which is time-consuming. You can create a swap partition that is used by Linux to store idle processes when the physical RAM is low. The swap partition is disk space set aside on a hard drive. It is quicker to access RAM than files stored on a hard drive. If you find that you constantly run out of memory and your hard drive is whirring, it is likely that your computer is excessively using swap space. How Badly Do You Need a Swap Partition? If you have a computer with a small amount of memory, a swap partition is highly recommended. As a test, we set up a virtual machine with 1 gigabyte of RAM and no swap partition and installed Peppermint Linux, which uses the LXDE desktop, and overall, it has a low memory footprint. Peppermint Linux comes with Chromium pre-installed, and every time you open a Chromium tab, a decent amount of memory is used. We opened a tab and navigated to linux.lifewire.com and then opened a second tab and did the same. We kept repeating this process until, eventually, the memory ran out. Then, Chromium displayed a message stating that the tab stopped working and was probably due to a lack of memory. Then, we set up a new virtual machine with 1 gigabyte of RAM and an 8-gigabyte swap partition. We were able to open multiple tabs, and although the physical RAM had run low, the swap space started to be used, and we were able to continue opening tabs. Matthew Field / www.photography.mattfield.com If you have a machine with 1 gigabyte of RAM, you're more likely to require a swap partition than if you have a machine with 16 gigabytes of RAM. It is highly likely that you will never use the swap space on a machine with 8 gigabytes of RAM or more unless you do serious number crunching or video editing. It is, however, always recommended to have a swap partition. Disk space is cheap. Set some of it aside as an overdraft for when your computer runs low on memory. If your computer is always low on memory and you are constantly using swap space, consider upgrading the memory on your computer. If you installed Linux and didn't set up a swap partition, create a swap file that basically achieves the same goal. Can I Set Aside Space on My SSD for Swap Space? You can set aside space on an SSD for swap space, and in theory, it will be quicker to access that partition than on a traditional hard drive. SSDs have a limited lifespan and can only handle a certain number of reads and writes. To put things into perspective, that number is high, and an SSD will probably outlast the life of a computer. Andrii Atanov / Getty Images Swap space is supposed to be an overflow buffer and not used consistently. If you constantly use the swap partition, consider upgrading the memory.