Questions tagged [swap]

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.

From the Ubuntu Swap Faq:

Swap space is the area on a hard disk which is part of the Virtual Memory of your machine, which is a combination of accessible physical memory (RAM) and the swap space. Swap space temporarily holds memory pages that are inactive. Swap space is used when your system decides that it needs physical memory for active processes and there is insufficient unused physical memory available. If the system happens to need more memory resources or space, inactive pages in physical memory are then moved to the swap space therefore freeing up that physical memory for other uses. Note that the access time for swap is slower therefore do not consider it to be a complete replacement for the physical memory. Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.
682 questions
187
votes
4 answers

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?
ptrcao
  • 5,455
  • 11
  • 36
  • 44
173
votes
9 answers

Why use swap when there is more than enough free space in 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: Also, could this be the cause of speed and…
Stefan
  • 24,830
  • 40
  • 98
  • 126
122
votes
3 answers

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 drives so it us much slower than my memory. Why did…
Hugo
  • 2,419
  • 7
  • 27
  • 32
103
votes
4 answers

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 used and 14 GB of swap space used, I ran swapoff…
maaartinus
  • 4,979
  • 7
  • 30
  • 29
100
votes
13 answers

Do I need swap space if I have more than enough amount of RAM?

From what I understand, the purpose of a swap partition in Linux is to free up some "not as frequently accessed" information from RAM and move it to a specific partition on your harddrive (at the cost of making it slower to read from or write to),…
IQAndreas
  • 10,145
  • 21
  • 59
  • 79
75
votes
6 answers

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 limited. So I am thinking about which data should be…
user41961
  • 753
  • 1
  • 5
  • 5
74
votes
6 answers

How to safely turn off swap permanently and reclaim the space? (on Debian Jessie)

I installed Debian Jessie with default partitioning on my SSD drive. My current disk partitioning looks like this: As I have 16GB of RAM, I assume I don't need swap. But since I have other disk drives I may create a swapfile for example, on one of…
Vlastimil Burián
  • 27,586
  • 56
  • 179
  • 309
71
votes
3 answers

I can't enable Swap space on CentOS 7

So I'm following a tutorial to install OTRS which is Open source Ticket Request System. So in order to install, it requires: 4GB of Swap space. Here's the command I used: [root@ip-10-0-7-41 ~]# df -h Filesystem Size Used Avail Use% Mounted…
The One
  • 4,662
  • 11
  • 29
  • 35
59
votes
3 answers

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?
tshepang
  • 64,472
  • 86
  • 223
  • 290
54
votes
6 answers

How do I use swap space for emergencies only?

I have a Debian (Buster) laptop with 8 GB RAM and 16GB swap. I'm running a very long running task. This means my laptop has been left on for the past six days while it churns through. While doing this I periodically need to use my laptop as a…
Philip Couling
  • 17,591
  • 5
  • 42
  • 82
48
votes
2 answers

Docker -- WARNING: No swap limit support

I'm running Docker(1.9.1) on Ubuntu 16.04. When I run docker info the last line of the output says WARNING: No swap limit support. INFO[0781] GET /v1.21/info Containers: 0 Images: 0 Server Version: 1.9.1 Storage Driver:…
Stephen C
  • 825
  • 2
  • 8
  • 17
47
votes
14 answers

What specifically can swap do that RAM can't?

What specifically can Linux do when it has swap that it can't without swap? For this question I want to focus on the difference between for example, a Linux PC with 32 GB RAM and no swap vs. a near identical Linux PC with 16 GB RAM with 16 GB swap.…
Philip Couling
  • 17,591
  • 5
  • 42
  • 82
46
votes
10 answers

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 ulimit or twiddling of OOM settings): There is little…
synthesizerpatel
  • 842
  • 8
  • 13
38
votes
3 answers

What does the vm.swappiness parameter really control?

Per the kernel documentation: This control is used to define how aggressive the kernel will swap memory pages. Higher values will increase aggressiveness, lower values decrease the amount of swap. However this is kind of vague. I'm trying to…
phemmer
  • 70,657
  • 19
  • 188
  • 223
36
votes
5 answers

Making Linux read swap back into memory

The Linux kernel swaps out most pages from memory when I run an application that uses most of the 16GB of physical memory. After the application finishes, every action (typing commands, switching workspaces, opening a new web page, etc.) takes very…
drrossum
  • 472
  • 4
  • 9
1
2 3
45 46