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
2
votes
3 answers

Diagnosing Solaris 8 server memory and swap space usage

Essentially, my question is related to memory allocation for Solaris virtual machines. I am running a couple of old Sun ONE 6 Java web servers on two Solaris 8 virtual machines. I see that there's a reasonable amount of swap space being used, but…
2
votes
4 answers

Creating swap files faster

I'm using Amazon EC2 and wish to be able to quickly generate large swapfiles (~10+GB) on instance startup. Unfortunately, I/O speed on my instances (c1.xlarge) is slow enough (20 MB/s) that this operation takes 10+ minutes, which is unacceptable…
UsAaR33
  • 1,096
  • 3
  • 11
  • 20
2
votes
2 answers

How much swap space for a 32GB ubuntu virtualization server?

I looked at many other questions on here regarding swap space, but none that I found really addressed my particular situation. I have an Ubuntu 9.10 64-bit server with 32GB of RAM running as a KVM host system. I'm using LVM on top of RAID1. The…
Tauren
  • 739
  • 4
  • 14
  • 24
2
votes
1 answer

How to Root volume partition without losing the data

We have this scenario : I to increase the disk space of one of our VM, Disk details : root@Test-01:~# blkid /dev/vda2: UUID="0eae0eb4-92ed-45ec-aa99-6d606f17e70a" TYPE="swap" PARTUUID="06cf22a2-02" /dev/vda1:…
sam23
  • 49
  • 1
  • 5
2
votes
1 answer

How to inspect why my service process be killed by Linux?

I have a vital service running a Ubuntu(20.04.1) server. Recently it is always killed by OS. At first I guess that probably is resulted by the OOM(out of memory) operation of OS, so I modified the systemd service unit file(my_app.service) of my app,…
Leon
  • 169
  • 9
2
votes
1 answer

Restricting swap usage for a systemd service in Ubuntu 18.04

I am trying to restrict the swap usage of a process using MemorySwapMax as mentioned in the doc with Ubuntu 18.04. Environment ubuntu@vrni-platform:/usr/lib/systemd/system$ uname -a Linux vrni-platform 4.15.0-143-generic #147-Ubuntu SMP Wed Apr 14…
tuk
  • 333
  • 5
  • 18
2
votes
1 answer

Do I need a SWAP partition?

I am going to remake a server with Ubuntu 20.04 It will have 6 GB of RAM, a 20 GB SSD for the operating system, and a 100 GB SSD for data. Should we make a SWAP partition ? If so, how many GB are needed ? Thank you
Mathieu
  • 45
  • 2
  • 8
1
vote
0 answers

How to investigate which docker container is causing swap to my system?

In a Debian 9 Stretch with docker 19.03.1 I'm using 6 containers and I observe swapping of 125Mo while memory usage never exceed 10% of total. ( usually around 500Mo / 16Go ). for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{…
idiocrate
  • 23
  • 5
1
vote
2 answers

Java crash due to native memory allocation map failure, despite n

A Java 11 application is crashing in a manner that from my understanding is impossible with the settings I have. The application in question runs on Amazon Linux 2, utilizing Java 11. The server is a cloud EC2 with 4 GB of ram. The server has no…
Michael Long
  • 21
  • 1
  • 3
1
vote
2 answers

FreeBSD swap usage with mysql

For the past few months, on a few different servers with similar FreeBSD versions and specs, I've been experiencing high swap usage with MySQL while seemingly having plenty of free RAM. FreeBSD 11.2-RELEASE-p8 (Also was happening in p2) …
Duncan Fairley
  • 63
  • 1
  • 1
  • 10
1
vote
1 answer

Increasing swap space and removing previous swap space on ubuntu?

I have a virtual machine (hosted online) with 2Gb swap space. free -m total used free shared buffers cached Mem: 1995 438 1557 37 22 190 -/+ buffers/cache: 225 …
Sasha Grievus
  • 223
  • 2
  • 11
1
vote
0 answers

Why is my kernel choosing disk swap over 24G of inactive RAM?

Output below is meminfo from a Proxmox hypervisor. I noticed today that swap usage was 90%. I logged into the box and checked and and it seems there is actually 24G of inactive RAM. A couple minutes later, I noticed swap usage was at 99%. Why does…
Server Fault
  • 3,714
  • 12
  • 54
  • 89
1
vote
3 answers

Missing mdam RAID1 array during scan

I have built a new server (Ubuntu 18.04.1) with 4 HDD. My plan is to use RAID1 overall and came up with this layout after investigation: sda, sdb four primary partitions (all as fd) with sda1/sdb1 as /boot, sda2/sdb2 as /, sda3/sdb3 as /var and…
IgorLopez
  • 39
  • 1
  • 4
1
vote
1 answer

Proxmox doesn't recongnize increased swap space

So I tried to increase the swap LV from 8GB to 16GB, but Proxmox web panel doesn't seem to see the change. The LVM increased the space, but Proxmox haven't changed it's panel. Originally lvdisplay gave this result: --- Logical volume --- LV Path …
JoakimE
  • 138
  • 1
  • 7
1
vote
2 answers

rsyslogd uses 435M of swap memory right after restart

I have Centos 7 # cat /etc/centos-release CentOS Linux release 7.3.1611 (Core) fresh rsyslogd # rsyslogd -version rsyslogd 8.36.0, compiled with: enough free memory # free total used free …