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
1
vote
2 answers

High swap usage on CentOS server with plenty of spare RAM

We have a fleet of web hosting servers all running the exact same software & hardware with similar load. One of our server gets very high load that leads to it locking up for brief periods of time. The main difference for this server seems to be…
Kyle Vail
  • 13
  • 1
  • 5
1
vote
0 answers

OOM killer kills process though page cache is never evicted

Our servers in production sometimes under load runs into the following issue (Linux 4.10): Application handling the load (webserver) is running at high load. A new job starts (e.g. cron). This requires a clone() system call, which fails to allocate…
Confused
  • 11
  • 1
1
vote
1 answer

dd using all memory and swap

I have a dedicated Centos 6.9 linux server with a company that crashed due to hardware failure and has been restored with the old HDD's on a usb caddy. I am trying to move lvm partitions over to the new internal hard disks. I have created a new…
williame
  • 13
  • 3
1
vote
1 answer

RAID-10 for swap: Optimal chunk size

I would claim that if I had a RAID-10 array which is used as swap device only, a chunk size of 4K would be perfect as it matches the page size. Am I right?
user3693367
  • 155
  • 8
1
vote
1 answer

swapon & hibernate on power key

I have a laptop & I run Arch Linux. My laptop has a spinning hard drive rather than an SSD, so I hate swap. However, I need one to hibernate, and I want my laptop to hibernate every time power key is pressed or battery runs low. My idea now is to…
1
vote
2 answers

docker container + java application -> swap used -> why?

There is docker container with java application inside. docker inspect dbc237493367 | grep -P '((Memory)|(Pid))' "Pid": 16283, "PidMode": "", "Memory": 10737418240, "KernelMemory": 0, "MemoryReservation": 0, "MemorySwap": -1, "MemorySwappiness":…
Oleg Golovanov
  • 193
  • 3
  • 6
1
vote
4 answers

Ansible throws an “ ERROR! A worker was found in a dead state ” error

When I run a playbook that simply copies a directory from one place to another, ansible throws ERROR! A worker was found in a dead state Error. After some googling, it looks like this is caused by the oom-killer killing the ansible process (but…
Sudh33ra
  • 179
  • 1
  • 2
  • 7
1
vote
1 answer

Database files and the system swap space on the same disk?

Why is it problematic to configure the database files and the system swap space on the same disk? What can happen?
1
vote
1 answer

Can swapped memory be read directly by java?

When the kernel swaps stuff to disk, can this data be subsequently read by the process directly from swap? or it must absolutely be put back into physical ram (thus generating si so activity in vmstat) I have a java process that seems to have alot…
Bob
  • 51
  • 1
  • 5
1
vote
1 answer

Swap partitions between /home and /var

I have a server with 2TB (Raid, 2x2TB), and this partition schema / => /dev/md2 - 20GB /home => /dev/md3 - 1.8TB This is a ISPConfig server, so we need many space in /var and almost nothing into /home, so i think that the best way to do this is put…
1
vote
3 answers

why after swap increasing and swapoff and swapon , swap total return to the previous value

in my Linux redhat machine ( version 5.x ) I perform the following steps in order to increase the swap from 6G to 8G lvcreate -n swap -L 2g /dev/rootvg mkswap /dev/mapper/rootvg-swap1 swapon /dev/mapper/rootvg-swap1 after steps swap increased…
King David
  • 549
  • 6
  • 20
1
vote
2 answers

How to remove SWAP partition, and add back to root partition in cli

I am on Ubuntu 14.04 server with only ssh access into the machine in question. Someone else setup this machine, and they added a ridiculous swap space...a little more than half of the SSD. Here's the current setup. sdb 119.2G disk …
trueCamelType
  • 1,086
  • 5
  • 20
  • 42
1
vote
2 answers

Linux swapping blocks system (freeze)

I have a problem with my Debian Servers. We run 4 different server which all have Intel CPUs and 128GB of RAM. Two of them run Wheezy, two of them run Jessie. We run a Java software on those systems which is heavily using memory and could eat up all…
mr.simonski
  • 247
  • 4
  • 13
1
vote
1 answer

Swap partition not mounted on boot

I'm having issues with a fresh SLES12 install and swap not mounting. It's a DL360 G6 server with P410 and 2x 146GB drives in RAID1. The single /dev/sda has MBR with sda1 for swap and sda2 for ext4 root partition. systemd 210-95.1 Basically i'm not…
vobelic
  • 193
  • 1
  • 5
  • 17
1
vote
2 answers

Implications of increasing physical ram of VM

I have a Centos7 VM running under VMware and I'm considering increasing virtual memory in the Centos VM. Currently my VM has 8GB of virtual memory, 6GB of swap and using 0 swap right now. I am considering increasing the VM's virtual memory from 8GB…
Liviu
  • 113
  • 3