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.

344 questions
57
votes
7 answers

What is swap memory?

I am using RAM for storing some of my database tables and the others are stored in hard disk. Today I came to know that my processes are using swap memory. Now what is swap memory and how can I detect that which process is using swap memory and how…
developer
3
votes
5 answers

Swap space getting used

I am having a system with 8GB of RAM and running mysql on it ,top command shows Mem: 8124416k total, 8110004k used, 14412k free, 21292k buffers Swap: 8388600k total, 1712132k used, 6676468k free, 2058600k cached vmstat 1 gives this…
Pankaj Joshi
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
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
1
vote
1 answer

What happens when the swap folder on your harddrive is full?

So this is an "what if" question. It may not happen that often, but I am just curious what happens if it would exactly happen. So in short a computer needs space somewhere to store different thinks before or after an calculation. So you have the…
user277526
1
vote
1 answer

Get rid of \040(deleted) swap

By mistake one of our admin on a production machine, deleted the swap file from the system. Without swapping it off. Now we are getting this. /swapfile3\040(deleted) file 1048568 1048568 -2 /swapfile1\040(deleted) …
tollboy
  • 76
  • 1
  • 8
0
votes
1 answer

Increase Swap file size that already exists (EC 2 linux)

I created swap file doing this: sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=4096 sudo /sbin/mkswap /var/swap.1 sudo chmod 600 /var/swap.1 sudo /sbin/swapon /var/swap.1 I would like to increase to 16GB I tried running this command sudo…
0
votes
1 answer

swapoff failed: Cannot allocate memory

Server's Output shows the following: # free -h total used free shared buffers cached Mem: 7.7G 7.6G 123M 156K 1.8M 248M -/+ buffers/cache: 7.3G 373M Swap: …
0
votes
1 answer

Swap usage in top's output

On a Suse linux machine, I have these swap stats from the top utility: Swap: 2096472k total, 1230612k used, 865860k free, 1792880k cached What does the last number (1792880k cached) mean, and why is it sometimes higher than the total swap…
0
votes
1 answer

How to trigger swap space usage on linux?

Is there a linux command or process I can run to trigger or force it to use swap at a high rate, e.g. exhausting 50% of swap space? I tried copying files but only see memory usage going up and down.
newbie
  • 3
-1
votes
1 answer

Manually trigger swappiness?

I am playing around with ZFS on Proxmox and have noticed that swappiness never seems to kick in. The swappiness value is currently set to 50 but never swaps unless I reach 100% RAM usage acting as if swappiness is set to 0. How can I manually force…
Toodarday
  • 235
-4
votes
1 answer

How to control the memory usage of a swap partiotion?

Thats pretty much the quesiton: how can I control the memory usage of each swap partiotion, say /etc/sa5?
alfish
  • 3,147