Swap space is an area of the hard disk that serves as an overflow when the computer memory is full. The memory used by inactive applications is partially written out to disk to make room for other applications and for the disk cache for active files.
62
votes
7answers
9k views
Why use swap when there is more than enough RAM
Using swap space instead of RAM can drastically slow down a pc.
So why, when I have more than enough RAM available, does my Linux system (Arch) use the swap?
Checkout my conky output below:
...
24
votes
12answers
2k views
How can I tweak my Linux desktop to be more responsive?
I have the experience that Linux works fine until the physical memory is exhausted. As soon as swap space is used the performance is severely degraded and the GUI becomes unresponsive.
This problem ...
20
votes
7answers
851 views
Is swap an anachronism?
I've used unix for quite a while, and for the last couple years I've felt like swap is an anachronism, but I'd be curious what other folks think.
My argument is roughly this (assuming no global ...
17
votes
3answers
3k views
Why does Linux use a swap partition rather than a file?
It seems to me a swap file is more flexible.
13
votes
3answers
3k views
Are there any side effects when two distros share a swap partition?
In order to save disk space, I want to have two OS installations share a single swap partition (a dual-boot). Is this a good idea?
11
votes
2answers
1k views
How can swapoff be that slow?
Somehow I happened to swap out 14 GB of memory. After having killed the culprit, I have tons of free memory again, so I thought I could bring in the important data again. So with 5 GB out of 32 GB ...
10
votes
4answers
12k views
How to completely disable swap?
I am using Debian sid, hard drive formatted with ext4, running on linux 3.1
I remember on previous linux versions (maybe before 3.0), if I run out of memory, and swap is not enabled, programs will ...
10
votes
1answer
978 views
per process swapiness for linux
/proc/sys/vm/swappiness is nice but i want a knob that's per process like /proc/$PID/oom_adj so that i can make certain processes less likely than others to have any of their pages swapped out unlike ...
9
votes
1answer
396 views
What happens to data in swap when your computer hibernates?
When a computer goes into hibernation mode, it saves the contents of the RAM into the swap space so that it can resume exactly where it left off when it powers back on.
So, what if you are currently ...
8
votes
4answers
3k views
how to “unswap” my desktop
If my desktop run out of memory and swaps a lot then I free or kill the application wasting my RAM. But, after that, all my desktop/applications have been swapped and are horribly slow, do you know a ...
7
votes
3answers
391 views
Why does it makes sense to cache swap?
It sounds quite counter-productive to me to cache pages that are swapped out. If you swap pages in, what is the advantage to first cache them in memory, only to have to than move them to the right ...
7
votes
1answer
928 views
What does the vm.swappiness parameter really contol?
Per the kernel documentation:
This control is used to define how aggressive the kernel will swap
memory pages. Higher values will increase agressiveness, lower values
decrease the amount of swap.
...
6
votes
1answer
4k views
How to test swap partition
I'm trying to diagnose some random segfaults on a headless server and one thing that seems curious is that they only seem to happen under memory pressure and my swap size will not go above 0.
How can ...
6
votes
3answers
138 views
How can I open a file in VIM in readonly mode if it already has a swapfile?
When I use the command :e filename to open a file and this file is already opened by another vim instance, I get a prompt asking me if I want to open the file in read-only mode, edit anyway, recover, ...
6
votes
1answer
274 views
How do I set up an encrypted swap file in Linux?
How do I set up an encrypted swap file (not partition) in Linux? Is it even possible? All the guides I've found talk about encrypted swap partitions, but I don't have a swap partition, and I'd ...
5
votes
2answers
2k views
How can I check if swap is active from the command line?
How can I check if swap is active, and which swap devices are set up, on the command line?
5
votes
1answer
134 views
Can I accelerate swap by using multiple harddrives?
I still have two old ATA drives (one is only 8GB, one is somewhat defect) and I've been thinking about putting them into my PC and activating swap on them, too. What will be effect of this? Will my ...
5
votes
1answer
4k views
swapon: Operation not permitted
I'm running this as root, obviously.
I've created a file called /swap/sw1, by dumping 512 megs of /dev/zero into it. I then ran mkswap, which said:
Setting up swapspace version 1, size = 524284 KiB
...
5
votes
3answers
865 views
How can I tweak the kernel for total swap out?
I would like to deploy the following swapping policy:
By default all pages in memory should also be in swap space.
When a page in memory is changed (i.e. dirty), the page should be written out as ...
5
votes
2answers
1k views
How to set up properly zram and swap
I'm configuring & compiling new 3.0 kernel. One of the goodies I planned to use for some time (by patching) that was merged into 3.0 is zram.
Is it possible to set both hdd swap and zram swap so ...
5
votes
2answers
884 views
What is the appropriate value of vm.swappiness when using zram?
I'm using zram on my computer as a compressed RAM-backed swap. When the system needs to swap something out, swapping it to a zram-backed swap file is more or less equivalent to compressing that data ...
4
votes
5answers
3k views
What is the use/meaning of 'swap area' while linux installation?
When i installed ubuntu in my x86 machine, I had to configure some memory as 'swap area'.
What is the use of this memory and what is the importance of this memory in linux file systems?
How can I ...
4
votes
6answers
468 views
What about no swap?
I have a netbook with a very slow (especially on writes) SSD, would it be a good idea to go without swap? The way I see it is that code and unmodified pages will still be swapped (re-read) but I won't ...
4
votes
2answers
4k views
Cleancache vs zram?
I have an old laptop here with only 512 MB of RAM. Since a few kernel releases, I am using zram to convert 256 MB of it to a compressed ramdisk which is then used as swap. This has proved to be very ...
4
votes
3answers
1k views
Swap usage too high?
I have a debian sid box, freshly installed about a month ago, with no desktop apps running at the moment.
Any command I try to run (via ssh) makes the hard disk work very hard. The system worked ...
4
votes
2answers
310 views
Linux (3.4) SSD swap partition usage causes extreme latency - how to eliminate?
I'm running on 4G RAM with an extra 6G swap partition, SSD is a pretty decent SAMSUNG MZMPA128HMFU model. System responds very well to workloads when things stay in RAM, but as soon as things reach ...
4
votes
1answer
270 views
How to configure swap space after system instalation?
I've installed Debian Wheezy and after installation completed, I realized that I forgot to set the swap memory. So now, how can I configure the swap space?
4
votes
2answers
488 views
Linux running slow with 0 swap left
Our Linux server is responding very slowly. top doesn't show any excessive CPU usage. I noticed that even though there's about 5GB of free memory, the system is using all of swap with no free swap ...
4
votes
1answer
763 views
Tmpfs only with RAM
How to be sure that a tmpfs filesystem can only deal with physical and it's not using a swap partition on disk ?
Since i have a slow HDD and a fast RAM i would like, at least, giving higher priority ...
4
votes
3answers
1k views
Where to put swap space, at beginning or end and other swap questions
Where do I put my swap? Debian installation gives 2 choices: (1) at the end or (2) at the beginning of the disk space. What is optimal?
What is the optimal amount of swap given my computer has ...
3
votes
1answer
334 views
What command can be used to force release everything in swap partition back to memory?
What command can be used to force release everything in swap partition back to memory ?
Presume that I have enough memory.
3
votes
2answers
173 views
Memory management, bias to swapping
I was having 768 MB RAM. In a general day MySQL was using 100-180 mb of RAM and MySQL was swapping 80-120 mb. I was having 50-60 mb free RAM.
So I thought I should upgrade. Then I upgraded my RAM ...
3
votes
1answer
432 views
Command for swap info in HPUX itanium and HPUX PARISC?
I need to get commands for swap information in HPUX (both Itanium and PARISC) somebody please help. Thanks
3
votes
1answer
573 views
Solaris swap allocation with mlocked shared memory
I'm having a hard time understanding how Solaris 10 x86 swap allocations work in the
presence of mlocked share memory.
I wrote a small program that:
Gets a 1G SHM segment (shmget)
Attaches it to ...
3
votes
2answers
313 views
Java process, swap (/proc Solaris10) memory highly utilized
How can I analyze high swap memory utilization of Solaris 10 for Java processes?
3
votes
1answer
238 views
How to stop waking all attached drives on reboot / deactivating swap?
A fresh install of Debian 6.0.6 for a system has 13 SATA drives attached. 12 refurbished WD-10EARS drives are yet unpartitioned. 1 WD1500BLFS drive is configured for OS and swap. Swap partition is ...
2
votes
4answers
749 views
How to reduce size of swap after a system is already installed?
I'm running Debian Squeeze 6.0.5. Does the use of swap memory make my computer run slower? If so, how can I reduce the size of the swap memory after the system is already installed?
2
votes
1answer
208 views
Can't add swap file on solaris
I'm trying to add a swap file on Solaris 10. I have already created a 2GB file swap.file. Then, I add a swap file with the command:
swap -a /swap.file
which shows an error:
/swap.file: size is ...
2
votes
1answer
372 views
KVM and swap problem
So I have a problem, I'm managing a server and the swap partition is way too small at the moment. The machine runs KVM with about 24 VM's on it. The problem is that some of them are rather inactive so ...
2
votes
2answers
99 views
Where is the virtual memory stored on hard drive?
If a process wants to access a memory address that is not in physical memory, the OS outsources a page frame from physical memory to the hard drive for later use. Where on the hard drive is this data ...
2
votes
3answers
1k views
How is paging managed in the absence of swapping?
How is paging managed in the absence of swapping. If that is the case, how will a page fault be managed?
What I meant is, if there is no availability for swapping, then how is Paging managed. I ...
2
votes
2answers
245 views
Does swap need to be on a contiguous LVM logical volume
I am setting up a machine to run a number of virtual machines. I am using a single HDD with a boot partition and an LVM partition. I read on the Arch wiki that logcial volumes which will be used for ...
2
votes
1answer
617 views
Why my partitions don't show the right capacity on a 4096 byte physical block hard drive?
After reading a lot about why newer 4096 byte physical block hard drives should be partitioned taking care of alignment (Linux on 4KB-sector disks: Practical advice, What is partition alignment and ...
2
votes
2answers
342 views
Does mkswap check that a partition is a swap partition before formatting it?
I checked the man page for mkswap and was left confused whether mkswap tests whether a partition is of type 82 before formatting it.
Background: I am using Ubuntu 11.04, and I had just set up my swap ...
2
votes
1answer
367 views
Dual-booting Windows 7 and Mint 14 with “something else” option
I would like to do a dual boot of Windows 7 and Mint 14 on my Acer netbook which already has Windows 7 Pro 64-bit installed on an 1 TB hard drive.
I have already shrunk the Windows 7 partition to ...
2
votes
1answer
462 views
Is it possible to trigger OOM-killer on forced swapping?
Is it possible to have the system preemptively swap out inactive pages (vm.swappiness), but invoke the oom-killer when the system runs out of RAM (as opposed to running out of memory) and is forced to ...
2
votes
1answer
293 views
What are the advantages of swap on a raid-1 (mirror) device?
What are the advantages of swap on a raid-1 (mirror) device?
(in a server environment running linux)
I mean, you can just use multiple disk devices in linux for swap. And with swap devices that have ...
2
votes
1answer
191 views
How to reuse Physical memory in the absence of swapping?
How can I reuse physical memory in the absence of swapping?
2
votes
2answers
219 views
How do I configure systemd to activate an encrypted swap file?
My previous question produced the commands to add an encrypted swap file:
# One-time setup:
fallocate -l 4G /root/swapfile.crypt
chmod 600 /root/swapfile.crypt
# On every boot:
loop=$(losetup -f)
...
2
votes
1answer
394 views
tmpfs and vm.swappiness
I have started tuning a bit Linux VM performance on my system (yes. I know that vm.swappiness=0 will kill kittens but I found 30-40 as much better for me as it improved my latency - probably at cost ...