Swap space is an area of the hard disk that serves as an overflow when the computer memory is full. The memory used by inactive applications is partially written out to disk to make room for other applications and for the disk cache for active files.

learn more… | top users | synonyms (1)

72
votes
7answers
17k views

Why use swap when there is more than enough RAM

Using swap space instead of RAM can drastically slow down a pc. So why, when I have more than enough RAM available, does my Linux system (Arch) use the swap? Checkout my conky output below: ...
43
votes
2answers
2k views

What NOT to put on an SSD?

I bought an SSD and I am going to set up my desktop system with a completely fresh Linux installation. SSDs are known to be fast, but they have a disadvantage: The number of writes (per block?) is ...
25
votes
12answers
2k views

How can I tweak my Linux desktop to be more responsive?

I have the experience that Linux works fine until the physical memory is exhausted. As soon as swap space is used the performance is severely degraded and the GUI becomes unresponsive. This problem ...
25
votes
7answers
1k views

Is swap an anachronism?

I've used unix for quite a while, and for the last couple years I've felt like swap is an anachronism, but I'd be curious what other folks think. My argument is roughly this (assuming no global ...
20
votes
3answers
6k views

Are there any side effects when two distros share a swap partition?

In order to save disk space, I want to have two OS installations share a single swap partition (a dual-boot). Is this a good idea?
19
votes
3answers
5k views

Why does Linux use a swap partition rather than a file?

It seems to me a swap file is more flexible.
18
votes
4answers
24k views

How to completely disable swap?

I am using Debian sid, hard drive formatted with ext4, running on linux 3.1 I remember on previous linux versions (maybe before 3.0), if I run out of memory, and swap is not enabled, programs will ...
14
votes
2answers
637 views

Linux: Total swap used = swap used by processes +?

So, I'm trying to do some investigation on where does swap use come from in a system with high swap usage: # free total used free shared buffers cached Mem: ...
13
votes
4answers
4k views

How to re-load all running applications from swap space into RAM?

If my desktop run out of memory and swaps a lot then I free or kill the application wasting my RAM. But, after that, all my desktop/applications have been swapped and are horribly slow, do you know a ...
13
votes
3answers
3k views

What does the vm.swappiness parameter really contol?

Per the kernel documentation: This control is used to define how aggressive the kernel will swap memory pages. Higher values will increase agressiveness, lower values decrease the amount of swap. ...
13
votes
2answers
3k views

Why is swappiness set to 60 by default?

I just read some stuff about swappiness on Linux. I don't understand why the default is set to 60. According to me this parameter should be set to 10 in order to reduce swap. Swap is on my hard ...
13
votes
1answer
2k views

per process swapiness for linux

/proc/sys/vm/swappiness is nice but i want a knob that's per process like /proc/$PID/oom_adj so that i can make certain processes less likely than others to have any of their pages swapped out unlike ...
12
votes
2answers
3k views

How can swapoff be that slow?

Somehow I happened to swap out 14 GB of memory. After having killed the culprit, I have tons of free memory again, so I thought I could bring in the important data again. So with 5 GB out of 32 GB ...
10
votes
6answers
1k views

Can Linux “run out of RAM”?

I saw several posts around the web of people apparently complaining about a hosted VPS unexpectedly killing processes because they used too much RAM. How is this possible? I thought all modern OS' ...
10
votes
1answer
507 views

What happens to data in swap when your computer hibernates?

When a computer goes into hibernation mode, it saves the contents of the RAM into the swap space so that it can resume exactly where it left off when it powers back on. So, what if you are currently ...
9
votes
2answers
7k views

How can I check if swap is active from the command line?

How can I check if swap is active, and which swap devices are set up, on the command line?
9
votes
3answers
706 views

What is the purpose of multiple swap files

During installation of most (if not all) distro's of linux, the hard drive is partitioned to include a swap partition by default. It is possible to change this behavior with swapon -p priority ...
8
votes
1answer
5k views

swapon: Operation not permitted

I'm running this as root, obviously. I've created a file called /swap/sw1, by dumping 512 megs of /dev/zero into it. I then ran mkswap, which said: Setting up swapspace version 1, size = 524284 KiB ...
7
votes
1answer
6k views

How to test swap partition

I'm trying to diagnose some random segfaults on a headless server and one thing that seems curious is that they only seem to happen under memory pressure and my swap size will not go above 0. How can ...
7
votes
3answers
478 views

Why does it makes sense to cache swap?

It sounds quite counter-productive to me to cache pages that are swapped out. If you swap pages in, what is the advantage to first cache them in memory, only to have to than move them to the right ...
7
votes
1answer
969 views

Zswap, Zram, Zcache desktop usage scenarios

I've been trying to understand the difference in use cases for Zswap, Zram, and Zcache. Apologies in advance for the long/slightly sloppily worded question. I've done a bunch of googling, and I ...
7
votes
2answers
2k views

What is the appropriate value of vm.swappiness when using zram?

I'm using zram on my computer as a compressed RAM-backed swap. When the system needs to swap something out, swapping it to a zram-backed swap file is more or less equivalent to compressing that data ...
6
votes
1answer
249 views

what does “Read Swap Header failed: Success” mean?

I'm trying to install Arch Linux (from the 2014-04-01 snapshot). I've made a swap file and tried to swapon it, but I got an error(?) message I don't understand. I've executed fallocate -l 512M ...
6
votes
1answer
96 views

How can I tell how much my system is swapping?

Is there a good way to see how much my system (for example how frequently, how much swap space it is using each time/ on average) is using the swap space during various tasks?
6
votes
3answers
445 views

How can I open a file in VIM in readonly mode if it already has a swapfile?

When I use the command :e filename to open a file and this file is already opened by another vim instance, I get a prompt asking me if I want to open the file in read-only mode, edit anyway, recover, ...
6
votes
3answers
6k views

Swap usage too high?

I have a debian sid box, freshly installed about a month ago, with no desktop apps running at the moment. Any command I try to run (via ssh) makes the hard disk work very hard. The system worked ...
6
votes
1answer
866 views

How do I set up an encrypted swap file in Linux?

How do I set up an encrypted swap file (not partition) in Linux? Is it even possible? All the guides I've found talk about encrypted swap partitions, but I don't have a swap partition, and I'd ...
6
votes
1answer
2k views

Tmpfs only with RAM

How to be sure that a tmpfs filesystem can only deal with physical and it's not using a swap partition on disk ? Since i have a slow HDD and a fast RAM i would like, at least, giving higher priority ...
5
votes
2answers
5k views

Cleancache vs zram?

I have an old laptop here with only 512 MB of RAM. Since a few kernel releases, I am using zram to convert 256 MB of it to a compressed ramdisk which is then used as swap. This has proved to be very ...
5
votes
2answers
131 views

How can my HDD swap without a swap partition?

I have no swap partition on my disk because I prefer having the OOM reaper kill anything it wants quickly rather than having to wait 10 minutes for my swap partition to get filled + 5 other minutes to ...
5
votes
1answer
184 views

Can I accelerate swap by using multiple harddrives?

I still have two old ATA drives (one is only 8GB, one is somewhat defect) and I've been thinking about putting them into my PC and activating swap on them, too. What will be effect of this? Will my ...
5
votes
3answers
1k views

How can I tweak the kernel for total swap out?

I would like to deploy the following swapping policy: By default all pages in memory should also be in swap space. When a page in memory is changed (i.e. dirty), the page should be written out as ...
5
votes
2answers
637 views

Linux (3.4) SSD swap partition usage causes extreme latency - how to eliminate?

I'm running on 4G RAM with an extra 6G swap partition, SSD is a pretty decent SAMSUNG MZMPA128HMFU model. System responds very well to workloads when things stay in RAM, but as soon as things reach ...
5
votes
1answer
121 views

can initramfs be paged out to swap disk?

I am using initramfs to boot Centos via PXE. The initramfs used memory is listed within the "cached" value in /proc/meminfo or via free. Since I need to calculate performance data, I need to know ...
5
votes
2answers
2k views

How to set up properly zram and swap

I'm configuring & compiling new 3.0 kernel. One of the goodies I planned to use for some time (by patching) that was merged into 3.0 is zram. Is it possible to set both hdd swap and zram swap so ...
5
votes
3answers
3k views

Where to put swap space, at beginning or end and other swap questions

Where do I put my swap? Debian installation gives 2 choices: (1) at the end or (2) at the beginning of the disk space. What is optimal? What is the optimal amount of swap given my computer has ...
4
votes
6answers
5k views

What is the use/meaning of 'swap area' while linux installation?

When i installed ubuntu in my x86 machine, I had to configure some memory as 'swap area'. What is the use of this memory and what is the importance of this memory in linux file systems? How can I ...
4
votes
6answers
1k views

What about no swap?

I have a netbook with a very slow (especially on writes) SSD, would it be a good idea to go without swap? The way I see it is that code and unmodified pages will still be swapped (re-read) but I won't ...
4
votes
1answer
1k views

How to configure swap space after system instalation?

I've installed Debian Wheezy and after installation completed, I realized that I forgot to set the swap memory. So now, how can I configure the swap space?
4
votes
2answers
212 views

Copying large file causes excessive swap

On a mid-class CentOS 6.4/64 server with 32 GB RAM, 3 TB free disk space, operating as KVM hypervisor, I start copying a 200 GB file to a destination in the same local filesystem. In fact, this file ...
4
votes
2answers
971 views

Linux running slow with 0 swap left

Our Linux server is responding very slowly. top doesn't show any excessive CPU usage. I noticed that even though there's about 5GB of free memory, the system is using all of swap with no free swap ...
4
votes
1answer
112 views

Spike in swap utilisation without high swap rate

Every Saturday, for reasons unknown to me, one of my servers experiences a spike in swap utilisation. It's not necessarily a problem as there is plenty of free memory available, but I'd still like to ...
3
votes
4answers
3k views

How to reduce size of swap after a system is already installed?

I'm running Debian Squeeze 6.0.5. Does the use of swap memory make my computer run slower? If so, how can I reduce the size of the swap memory after the system is already installed?
3
votes
2answers
59 views

Tool to force use FILE instead of RAM

I'm wondering why there is no such tool like ram2swap, similar to cpulimit in parts. E.g. There is program daemon.bin. Let's create temporary swap file ( 1 Gb ): % dd if=/dev/zero of=tmp.swap ...
3
votes
2answers
370 views

Does the order of partitions matter much?

I've just ran a test install of Arch on a separate computer, and now I'm ready to do the real thing on my main one. However, since the guide didn't explicitly recommend it, I did not install with a ...
3
votes
2answers
225 views

Where is the virtual memory stored on hard drive?

If a process wants to access a memory address that is not in physical memory, the OS outsources a page frame from physical memory to the hard drive for later use. Where on the hard drive is this data ...
3
votes
2answers
395 views

Memory management, bias to swapping

I was having 768 MB RAM. In a general day MySQL was using 100-180 mb of RAM and MySQL was swapping 80-120 mb. I was having 50-60 mb free RAM. So I thought I should upgrade. Then I upgraded my RAM ...
3
votes
1answer
1k views

What command can be used to force release everything in swap partition back to memory?

What command can be used to force release everything in swap partition back to memory ? Presume that I have enough memory.
3
votes
1answer
818 views

Command for swap info in HPUX itanium and HPUX PARISC?

I need to get commands for swap information in HPUX (both Itanium and PARISC) somebody please help.
3
votes
2answers
782 views

Is it possible to trigger OOM-killer on forced swapping?

Is it possible to have the system preemptively swap out inactive pages (vm.swappiness), but invoke the oom-killer when the system runs out of RAM (as opposed to running out of memory) and is forced to ...