Questions tagged [swap-space]

Is a disk partition or file used to temporarily store the inactive contents of memory (RAM).

Storing inactive bits of memory to disk frees up memory resources for higher priority tasks.

While swap space can improve performance in most systems this is not likely to be the case with regards to the Pi, because of the slow response times (compared to RAM) of the SD Card or an external hard drive. In addition enabling swap on an SD Card could lead to premature failure of the SD Card.

Common questions

How do I create a swap partition?

36 questions
139
votes
5 answers

How to set up swap space?

Raspberry Pi has only 256 MB of RAM, so I would like to use swap space (either on SD card or attached USB storage). How do I set it up?
user13
21
votes
2 answers

How to permanently disable swap on Raspbian Stretch Lite

I'm at my wit's end; it seems there's no way to tell Raspbian Stretch Lite to permanently disable swap space. Now, it's a bit of an edge case, wanting to keep swap turned off (in this case it's for a Kubernetes cluster, so kubectl doesn't complain…
geerlingguy
  • 1,676
  • 2
  • 16
  • 22
13
votes
1 answer

Is it safe to remove the xserver?

I do not use a digital monitor and no TV either with my Raspberry Pi. I would like to remove unnecessary packages to save disk space and memory consumption. I would like to preserve the possibility of forwarding X to an SSH client. Is it safe to…
Bengt
  • 2,427
  • 3
  • 22
  • 26
6
votes
2 answers

Why has Raspbian enabled swap by default if that is bad?

I always read that swap on a Pi should be disabled because enabling it lowers SD card lifetime and is very slow anyways (no performance gain with swap). So I disabled it. But is there a good reason why Raspbian has enabled swap by default anyways?
Foo Bar
  • 453
  • 3
  • 18
5
votes
1 answer

More Memory on Raspberry Pi

So I was wondering if there was any way to allow more ram to a program on a Raspberry Pi 3. I have a process which takes 76,7% of the memory (it's a tomcat server) and need another one like this to run, so my Raspberry can't handle it right now. Is…
Jack
  • 165
  • 1
  • 1
  • 4
5
votes
1 answer

What problem does dphys-swapfile solve?

I have a RaspberryPi 3B rev 1.2. It has 1 GB of RAM. When I run my C++ compiler at -j 2 or above I catch intermittent Out Of Memory (OOM) kills. Sometimes the compiler is killed, other times other programs are killed. Raspbian Buster comes with…
jww
  • 153
  • 1
  • 1
  • 8
4
votes
1 answer

What's your experience in improving memory management (Swap on NVMe/SSD, zram, zswap)?

I've got an NVMe SSD attached (via USB 3 port) to my Raspberry Pi and wonder what's the best (and still relatively easy) way to configure it for memory demanding applications (like Geth), assuming Raspberry Pi OS Lite or maybe also Ubuntu (Server)…
msa
  • 141
  • 2
3
votes
2 answers

Why I can't copy my Linux image to another SD card?

I have 2 SD cards (8 GB) I wrote my Wheezy image into one SD card (using Win32DiskImager) and I expanded the the disk space of the image on that card. then I used (Win32DiskImager) to read the Image and save it on my PC. Now I'm trying to write this…
Mahmoud Zalt
  • 227
  • 1
  • 4
  • 9
3
votes
1 answer

How to compile project on Raspberry Pi, even when g++'s virtual memory exhausted despide big SWAP?

I want to build Iroha hyperledger on Raspberry Pi 3. So I've downloaded code and all dependencies and compiler gcc-8.2 (downloaded precompiled from here), then configured without tests: cmake -DTESTING=OFF -LA ../ but when I run make: it is…
baziorek
  • 141
  • 3
3
votes
2 answers

How do I setup swap on Raspbmc?

I have an external hard drive that has a 1GB swap partition. To use this, I log into my raspbmc via ssh and sudo swapon /dev/sda2 Is there a way to automate this? I would like to check for the serial number of the disk and swapon if it is…
Lord Loh.
  • 657
  • 11
  • 26
3
votes
1 answer

Wifi stopped working after installing bluetooth drivers

Yesterday I had my WiFi adapter working. I took the Raspi home and installed drivers and manager for my Bluetooth adapter. Now, today, WiFi will not work. lsusb returns the device, but it will not show in WiFi config. Why is this and how do I fix…
2
votes
1 answer

Swapfile on another machine

I have read in many places that increasing your swap file size, or making a big swap partition; can boost the memory of your system as temporary files can go there instead of in RAM. However, on Raspberry Pis, it is advised against creating a swap…
2
votes
2 answers

Swap Memory Usage

After running the command top on Raspbian, I get the following result: KiB Mem : 948956 total, 249788 free, 549408 used, 149760 buff/cache KiB Swap: 102396 total, 3836 free, 98560 used. 309492 avail Mem Why is my device…
2
votes
0 answers

Traditional swap file rather than dphys-swapfile?

I have a RPI-3 with the ARMv8 Broadcom SoC. I needed to create a swap file because I was running out of memory on occasion. I used a traditional swap file in a separate partition because the dphys-swapfile project goals did not align with my needs…
user50099
2
votes
1 answer

/var/swap file abnormally large

I ran this command because my Raspberry Pi's SD card is full: sudo find /var -type f -a -printf '%s %p\n'| sort -nr | head -10 The output: 104857600 /var/swap 46641296…
Yllier123
  • 155
  • 1
  • 8
1
2 3