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.

340 questions
1
vote
2 answers

Maximum swap file size

I'm doing some file processing that seems to require an enormous swap file: even 20Gb isn't enough. What's the theoretical maximum? Running swapon on a 1Tb file resulted in: swapon: /mnt/big/swap.swap: swapon failed: Invalid argument The system in…
Steve Bennett
  • 5,539
  • 12
  • 45
  • 57
1
vote
3 answers

I/O rate and CPU Eating up Server making terribly slow site

My server (Ubuntu 10.04 Lucid LAMP Stack) on linode (1024MB ram, 40 GB storage, 400 GB Transfer) is loading terribly slow. My site (WordPress) is relatively small (1.5 Gigs of mysql) and gets around 2k page view a day. I've seen guys running a site…
andrewk
  • 163
  • 8
1
vote
1 answer

Centos server not using SWAP properly and getting OOM

Recently I've been having some serious memory issues with my server. Just the other day, my server became completely unresponsive, and oom-killer started killing services at random (httpd, php, etc). I couldn't even SSH into my server, but I was…
xil3
  • 93
  • 1
  • 9
1
vote
2 answers

swap partition alignment: is there any benefit?

On some of my Linux servers, the swap partition is misaligned. I understand how partition alignment affects performance on mounted file systems with 4k block sizes, but I am unsure if the same considerations apply to swap. Does it even have a "block…
Rob
  • 13
  • 2
1
vote
2 answers

How to make Swap work? CENTOS 5.7

I've got a Centos 5.7 running Magento with nginx. I also got there 10GB of Swap. But the os never use it. How can i make it work?
1
vote
2 answers

Swap on Ubuntu and CentOS

I have two questions, which is both related to a swap partition or file. Is it possible to install either Ubuntu or CentOS without a swap configured, without tinkering? Live CDs like Ubuntu, is there any swap involved? I was thinking that there…
nand
  • 113
  • 3
1
vote
2 answers

Kill or revive a process based on system memory usage

Consider a system with limited memory, like a smallish VPS. Suppose there are a handful of processes that need to stay alive, and one process "P" that would be nice to have around, but is not strictly necessary. What I'd like do is keep P around…
Pistos
  • 2,863
  • 5
  • 21
  • 21
1
vote
1 answer

Reasonable memory limit alarm for 2GB machine running RHEL5 OS

We have a bunch of servers with the below configuration: Dual Core single processor 2GHz with 1 MB Cache. Swap is enabled with 1GB limit Memory - 2GB OS - RHEL5.3 64bit One of our alarms is configured to wake us up when Free memory goes below 256MB…
Ram
  • 25
  • 1
  • 4
1
vote
2 answers

memory leak? RHEL 5.5. RSS show ok, almost no free memory left, swap used heavily

i encounter a very instresting problem, and it seems that some physical may disapper quietly. i am very puzzled, so if anyone could give some help, I would be very appreciated. here is my top show: sort by memory usage Cpu(s): 0.8%us, 1.0%sy, …
ric
  • 11
  • 3
1
vote
4 answers

linux redhat 5.4 - swap while memory is still available

This server is swapping using 100% (15G swap disk) while it still has 30G free, I've been looking arround but can't figure why this is happening, my understanding was not to use swap if memory is still available. # cat /proc/meminfo MemTotal: …
user420329
1
vote
1 answer

Problem with setting up partitions - encrypted swap partition won't mount

Here's the layout I have; I'm using Software RAID10, LVM, and Encryption: LVM VG vg0, LV main - 2.0 TB Linux device-mapper (linear) #1 2.0 TB K crypto (vg0-main_crypt) Encrypted volume (vg0-main_crypt) - 2.0TB Linux…
user29600
  • 399
  • 5
  • 16
  • 29
1
vote
4 answers

Server super slow, RAM & Swap 100% used, ClamAV problem?

My Ubuntu 10.04 server is down since this morning. When I restart it, I can use it for a couple of minutes then the RAM and Swap get full, and SSH doesn't answer. It seems ClamAV is part of the problem. How can I stop it? clamd stop didn't work. And…
Nabab
  • 189
  • 1
  • 3
  • 12
1
vote
1 answer

What do the output values of dstat command mean when monitoring IO?

I am monitoring the IO and SWAP usage of a process in my backup server. I executed dstat -rs 5 and this was an example output: --io/total- ----swap--- read writ| used free 92.0 57.3 |3228k 514M 289 104 |3468k 514M 270 202 |3472k 514M …
elitalon
  • 209
  • 5
  • 15
1
vote
4 answers

Should Swap be used like this?

I have a server with Dual Nehalem Quad Core Xeon 5520 and 12GB DDR3 RAM. The server's average memory usage is only around 10-15%, yet the Swap used shows 10%+. Is this normal, or could something be wrong that is causing this. I was under the…
James Simpson
  • 1,601
  • 2
  • 14
  • 30
1
vote
1 answer

Where is the ESX Swap file in ESX 4.1i installed on SD cards?

Where is the ESX swap file located? I have installed ESXi 4.1 on a pair of mirrored SD coards, which came with the Dell server. ESXi runs really quickly, but with no local disks apart from the SD cards, where is the ESX swap file located, as I am…
user69411
  • 11
  • 1