Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| linux:linux-tutorials:swap [2023/07/30 12:12] – removed - external edit (Unknown date) 127.0.0.1 | linux:linux-tutorials:swap [2025/01/21 18:25] (current) – [Disable SWAP permanently] Zyzonix | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== SWAP / Swappiness ===== | ||
| + | Swappiness defines how fast processes, more accurate their consumed RAM, is sourced out to a disk. This is **only** required and recommended when there' | ||
| + | To view the current swappiness: | ||
| + | <code bash>cat / | ||
| + | |||
| + | To change the swappiness permanently, | ||
| + | <code bash> | ||
| + | The variable '' | ||
| + | |||
| + | //Sourced from [[https:// | ||
| + | |||
| + | ==== Add SWAP ==== | ||
| + | **Create SWAP file:** | ||
| + | <code bash> | ||
| + | → Change 4G to the size of the swap space. | ||
| + | |||
| + | **Change permissions and format file:** | ||
| + | <code bash> | ||
| + | <code bash> | ||
| + | |||
| + | **Enable SWAP and verify:** | ||
| + | <code bash> | ||
| + | <code bash> | ||
| + | |||
| + | **Make swap permanent by adding the following line to ''/ | ||
| + | <code bash>/ | ||
| + | |||
| + | To change the swappiness look at the upper paragraph. | ||
| + | |||
| + | //Sourced from [[https:// | ||
| + | |||
| + | ==== Disable SWAP permanently ==== | ||
| + | |||
| + | To disable the SWAP on Debian and some other Linux Distributions just comment out the following line in ''/ | ||
| + | <code bash>/ | ||
| + | ==== Increase SWAP-Storage (e.g. for Raspberry Pi) ==== | ||
| + | Raspberry Pis are powerful, but sometimes the amount of RAM is too low, besides RAM-compression swapping can be a helpful solution. | ||
| + | |||
| + | Change/ | ||
| + | |||
| + | Firstly turn off swap (moves everything from swap to the RAM): | ||
| + | <code bash> | ||
| + | Then edit the SWAP size in (size in MBytes): | ||
| + | <code bash> | ||
| + | Set size to new size of swap-ram and initialize new swap file: | ||
| + | <code bash> | ||
| + | Should produce something like this: | ||
| + | '' | ||
| + | Finally turn the swap back on, there' | ||
| + | <code bash> | ||
| + | |||
| + | If getting '' | ||
| + | |||
| + | //Initially sourced from [[https:// | ||