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
0
votes
0 answers

Should I compile Node.js from source on an Amazon Lightsail smallest instance?

I'm using the cheapest Amazon Lightsail instance to set up an Nginx + Node.js server. I have compiled Nginx successfully already, however it's taking too long to compile Node.js. Is this is even a good practice to compile Node.js from source? Should…
gregn3
  • 101
  • 1
0
votes
3 answers

AWS ubuntu image has no swap with kernel 5.x

Just built a new AMI recently, based on the latest 18.04. Did also an apt upgrade when provisioning it, in order to have the latest packages as well. Problem is that this new AMI has no swapfile in it, checked via swapon --show. It uses…
0
votes
1 answer

VPS's memory consumption

I have a VPS with ubuntu 18.04.4 with 2gb and 512mb swap. Working regularly with 600-800mb and 100mb swap and all is well. 2 weeks ago I updated the WAR (tomcat) and the memory jumped to 1.2gb and 400-500mb swap. At first I thought it's normal…
Amos
  • 141
  • 6
0
votes
2 answers

Ubuntu swap and RAM

I have an Ubuntu 18.04 which mostly runs tomcat. The memory consumption is between 800mb-1gb and I have 2gb total. The swap is 512mb and the used swap is 480mb. I set clamav to run at 3am and it consumes around 800mb when it runs. It looks as if…
Amos
  • 237
  • 1
  • 4
  • 10
0
votes
3 answers

how to prevent swap usage when all my php-fpm running in swap

i have 32gb ram running on redhat. I am using this server dedicated to querying a list in the database and processing them using php from cron. # free -m total used free shared buff/cache available Mem: …
shorif2000
  • 357
  • 1
  • 7
  • 26
0
votes
2 answers

Temporarily turning off swap on a production database?

If I need to turn off swap on a linux server mysql database so I can increase the size of the swap, what would happen to the database? The database is using all 8GB of swap. What would be the best way to increase the database swap to 16GB? It has…
CzipO2
  • 127
  • 1
  • 1
  • 4
-1
votes
2 answers

Will any running process be killed if I free the swap memory from my Ubuntu server?

The question (title of this question) came into my thought for the below reason. If anyone gives a solution of that reason then I don't need to free the swap memory. The Reason: After installation of Jenkins it is running well. But using some…
Shamim
  • 101
  • 4
-1
votes
1 answer

Linux refusing mapped image file created with dd as swap device

Getting the error "WRITE ERROR ON SWAP DEVICE" on boot but all works fine when I change the line: truncate -s $swapsize $flPtDev by cp /swap.img $flPtDev The complete script is the following: cd /home/myuser/ mkdir ./.myfolder cd ./.myfolder …
Mark
  • 71
  • 1
  • 6
-1
votes
1 answer

Volatile Linux with a huge tmpfs and swap partition

I want to deploy Linux on user computers in a way state is never preserved between boots (except state saved explicitly by users on external removable devices). System image will be stored on a read-only removable media and possibly network. All my…
-1
votes
1 answer

Linux - Use disk as RAM

I have a VM and in it a process that consumes a lot of memory (~200GB). Some sort of in-memory DB. I need to run it on a standard laptop and I cannot recompile it or see the code. I've added 256GB of swap space with pri=32767 in /etc/fstab and…
assafmo
  • 139
  • 3
-1
votes
1 answer

Linux swap file not being used

One of my database server running mysql/debian is out of memory. I added a swap file but as far as I know it's not used by the system. I can confirm that the swap is enabled when I execute the free -h command: total used …
-1
votes
2 answers

Install Windows Server 2012 on separate disk or in RAID 5?

I have a RAID controller with 4 1TB disks and first I put them all in a RAID 5 array, partitioned 1TB for OS and 2TB for data. Then I noticed that the raid array was never idle. It was constantly writing 24/7 and I figured it must be the swap…
-1
votes
1 answer

Is there a way to make /tmp mounted as tmpfs to use only swap?

I have a swap of 64 GB SSD. So is there a way to make /tmp mounted as tmpfs to use swap alone and not use RAM?
nitins
  • 2,527
  • 15
  • 42
  • 65
-1
votes
2 answers

How to control the swap drive (X:\drive) usage?

I am not really a network administrator but my company has LAN which has around 1500 computers. The offices are located in various geographical locations. The problem we face is that the use of swap drive. People tend to use swap drive for storing…
Hemant
  • 229
  • 1
  • 3
  • 12
-1
votes
2 answers

Server with high consumption of physical memory; swap is not being used

Please, I need a help. I have a Linux that has the following scenario of RAM memory consumption: root@cpro15623 [~]# free -m total used free shared buffers cached Mem: 3881 3216 665 …
1 2 3
22
23