Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


admin_grundlagen:swap

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
admin_grundlagen:swap [2018/02/06 15:19]
ingo_wichmann [zswap]
admin_grundlagen:swap [2022/03/14 10:45] (aktuell)
ingo_wichmann [Zusätzlichen Swap-Speicher in einer Datei anlegen]
Zeile 1: Zeile 1:
-====== Zusätzlichen Swap-Speicher in einer Datei anlegen ​======+===== Wie groß sollte Swap sein? ===== 
 +  * [[https://​help.ubuntu.com/​community/​SwapFaq|Ubuntu'​s Antwort]] 
 +  * [[https://​www.suse.com/​de-de/​support/​kb/​doc/?​id=7010157|SUSE'​s Antwort]] 
 +===== Brauche ich Swap? ===== 
 +  * http://​www.thomashertweck.de/​linuxram.html 
 +  * https://​chrisdown.name/​2018/​01/​02/​in-defence-of-swap.html - Sehr ausführlich warum Swap meist sinnvoll ist.  
 +  * https://​www.linux.com/​news/​all-about-linux-swap-space 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. 
 +  * https://​www.kernel.org/​doc/​gorman/​html/​understand/​understand014.html The casual reader may think that with a sufficient amount of memory, swap is unnecessary. But this brings us to the second reason. A significant number of the pages referenced by a process early in its life may only be used for initialisation and then never used again. It is better to swap out those pages and create more disk buffers than leave them resident and unused. 
 + 
 +===== Zusätzlichen Swap-Speicher in einer Datei anlegen =====
 Datei mit 500 MByte Größe anlegen: Datei mit 500 MByte Größe anlegen:
-  ​dd if=/​dev/​zero of=/var/tmp/swap bs=1M count=500+  ​fallocate -l 500M /swap
 Datei als swap formatieren:​ Datei als swap formatieren:​
-  mkswap ​/var/tmp/swap+  mkswap /swap
 Swap Datei einbinden: Swap Datei einbinden:
-  swapon ​/var/tmp/swap+  swapon /swap
 Überprüfen:​ Überprüfen:​
   free -m   free -m
   swapon -s   swapon -s
  
-====== ​zswap ======+===== Swap leeren ​===== 
 +Prüfen, ob genug RAM verfügbar ist: 
 +  free -h 
 + 
 +Swap leeren: 
 +  swapoff -a 
 +  swapon -a 
 + 
 +===== zswap =====
 Einschalten zur Laufzeit (z.B. mit einem Systemd Unit File): ​ Einschalten zur Laufzeit (z.B. mit einem Systemd Unit File): ​
   echo 1 > /​sys/​module/​zswap/​parameters/​enabled   echo 1 > /​sys/​module/​zswap/​parameters/​enabled
Zeile 20: Zeile 37:
   for i in /​sys/​kernel/​debug/​zswap/​*;​ do echo -n "$i: "; cat $i; done   for i in /​sys/​kernel/​debug/​zswap/​*;​ do echo -n "$i: "; cat $i; done
  
-====== Dokumentation ====== +
-  * http://​www.thomashertweck.de/​linuxram.html +
-  * https://​chrisdown.name/​2018/​01/​02/​in-defence-of-swap.html - Sehr ausführlich warum Swap meist sinnvoll ist.  +
-  * https://​www.linux.com/​news/​all-about-linux-swap-space 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. +
-  * https://​www.kernel.org/​doc/​gorman/​html/​understand/​understand014.html The casual reader1 may think that with a sufficient amount of memory, swap is unnecessary but this brings us to the second reason. A significant number of the pages referenced by a process early in its life may only be used for initialisation and then never used again. It is better to swap out those pages and create more disk buffers than leave them resident and unused.+
admin_grundlagen/swap.1517930386.txt.gz · Zuletzt geändert: 2018/02/06 15:19 von ingo_wichmann