Questions tagged [swap]

Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory(RAM) and the swap space is the amount of virtual memory available. Linux has two forms of swap space: the swap partition and the swap file.

From linux.com All about swap space:

Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory and the swap space is the amount of virtual memory available.

Swapping is necessary for two important reasons. First, when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately. Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache. However, swapping does have a downside. Compared to memory, disks are very slow.

Linux has two forms of swap space: the swap partition and the swap file. The swap partition is an independent section of the hard disk used solely for swapping; no other files can reside there. The swap file is a special file in the filesystem that resides amongst your system and data files.

Swap space size should be either similar to system RAM or double it's size.

342 questions
3
votes
3 answers

top reports swap at 100%, free memory available

On RedHat 5 servers, we see top reporting swap has 0k free. vmstat shows the same amount of swap used, but no paging. We kill our only app, and top still reports 100% of swap used. If we reboot, swap goes to 0k used. Any comments: am I…
cvsdave
  • 141
  • 5
3
votes
1 answer

Windows Server: Prevent process swapping/paging

Is there a possibility to prevent swapping for a single process? This process is an in-memory-database and should not be moved to virtual ram. all other processes should still be swap-able. I need something like the "lock pages in memory" option…
3
votes
1 answer

How does the Windows /3gb switch relate to physical RAM?

I have a 32-bit Windows server with 4 GB of RAM. From reading various articles on the web, I reached the understanding that enabling the /3GB switch in boot.ini would mean that of my 4 GB of RAM, 3 could be allocated to user mode memory. Without…
Brian Beckett
  • 509
  • 1
  • 4
  • 12
3
votes
2 answers

swap on dev + but get mount dev + how to swap dev anyway?

when I do the: mkswap /dev/sda3 mkswap: error: /dev/sda3 is mounted; will not make swapspace. how to perfrom mkswap anyway , David
David
  • 463
  • 2
  • 6
  • 12
3
votes
4 answers

Running swap on RAID10 or RAID5?

In follow-up to this previous question (and it's excellent answer), I am curious to know if running swap on a RAID5 might not be better than on a RAID10. My thinking is that you might lose a bit on the performance because it wouldn't be purely…
warren
  • 18,369
  • 23
  • 84
  • 135
3
votes
4 answers

What size relative to amount of memory should the page file be (in Windows Server 2008)?

I have heard the old advice for Windows NT 4 which, if memory serves, was a rule of thumb "memory size plus 12 MB" (so that a complete dump could be written to disk). Does anybody have any recommendations for Windows Server 2003 and 2008? (Also,…
3
votes
4 answers

Server uses 100% swap after fresh mysql installation

I set up a new server with 220G RAM and Ubuntu 22.04.1 LTS. After installing MySQL I changed the mysql config to: innodb_buffer_pool_size = 170G innodb_buffer_pool_instances = 64 innodb_buffer_pool_chunk_size = 134217728 innodb_log_file_size =…
Zystrix
  • 31
  • 2
3
votes
2 answers

How to permanently remove /dev/zram0 as swap in Armbian

My Armbian Bullseye system insists on setting up swap space on /dev/zram0. I don't want it to, as I have created a swap partition that I would prefer to use. But I can't find how to permanently remove the swap space /dev/zram0. It can be removed…
mbrampton
  • 311
  • 4
  • 12
3
votes
5 answers

Newbie ask Swap Value: How much Swap do I have?

When looking vmstat, this is what I got: procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 0 2872 0 0 0 0 …
Cintaku
2
votes
0 answers

measuring total swap with SNMP when swap is larger than 4TB

We have a system with more than 4TB of swap space. I want to measure it's memory with SNMP (because I'm using MRTG to graph it). SNMP is reporting negative numbers for memTotalSwap. I suspect that this is because it's being reported with a 32-bit…
vy32
  • 2,088
  • 2
  • 17
  • 21
2
votes
1 answer

Remove swap completely or set swappiness to 0?

In managing a server with 512GB of RAM I encountered a process that keeps consuming swap until it hits 100% of the swap space then stops consuming more (6GB of swap) but keeps working fine (albeit, when a request enters the process, it takes a long…
Gizmo
  • 289
  • 2
  • 11
2
votes
1 answer

AWS EC2 Amazon Linux is using swap even if it shouldn't

I have a few ECS servers running various apps. After a few mysterious outages I noticed that the instance is swapping hard and it consumes its IO Burst Balance rendering the instance useless. The facts: the machines are t2 and t3 instances with 2GB…
scream314
  • 23
  • 4
2
votes
5 answers

Solaris Unix systems swapping & blocked processes

Some users are complaining of poor performance on a brand new server. The only running on this machine is Oracle 10.2. At first glance everything looks ok: load is minimal, nothing in logs. The only thing i can find is that vmstat is complaining of…
user1855
  • 51
  • 1
  • 3
2
votes
2 answers

Is swap file required for a Postgres database running on AWS EC2 instance with 122 GB memory?

What is the downside for running a Postgres database without a swap file? This database resides on an AWS EC2 machine with 122 GB memory.
J.M.
  • 21
  • 2
2
votes
1 answer

Make Ubuntu Server use less swap and more actual RAM

I have a server with 128 GB of RAM and a 100 GB hard drive in it. It seems to use pretty much swap instead of using actual RAM when rsyncing disks. I found other questions on Stack Overflow with similar problems, but none had a real solution. This…
Amon Bune
  • 63
  • 1
  • 6