Linux Swap Errors — Swappiness, Swap Full, and Memory Pressure
Warningsystem
Overview
Fix Linux swap issues including swap space full, high swappiness causing excessive swapping, creating emergency swap files, and monitoring memory pressure.
Key Details
- Swap provides overflow space when physical RAM is exhausted
- vm.swappiness (0-100) controls how aggressively the kernel uses swap (default: 60)
- A system with no swap can OOM-kill processes without warning when RAM is full
- SSDs handle swap much better than HDDs — swap on HDD causes severe performance degradation
- Memory pressure can be monitored via /proc/pressure/memory on modern kernels
Common Causes
- Insufficient RAM causing heavy swap usage and performance degradation
- No swap space configured, causing OOM kills when RAM is full
- Swap partition full with no additional swap available
- High swappiness value causing unnecessary swapping despite available RAM
- Memory leak in application slowly consuming all RAM and swap
Steps
- 1Check swap usage: free -h and swapon --show
- 2Create swap file: sudo fallocate -l 4G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile
- 3Make permanent: add '/swapfile none swap sw 0 0' to /etc/fstab
- 4Adjust swappiness: sudo sysctl vm.swappiness=10 (persistent: add to /etc/sysctl.conf)
- 5Monitor pressure: cat /proc/pressure/memory (shows some/full pressure metrics)
Tags
linuxswapmemoryswappinessoom
More in System
windows-C000021A-status-system-process-terminatedWindows Error 0xC000021A — STATUS SYSTEM PROCESS TERMINATED
Criticalwindows-C0000225-boot-configuration-errorWindows Error 0xC0000225 — Boot Configuration Error
Criticalwindows-C000000F-boot-selection-failedWindows Error 0xC000000F — Boot Selection Failed
Criticalwindows-80004005-unspecified-errorWindows Error 0x80004005 — Unspecified Error
Warningwindows-80070570-file-or-directory-corruptedWindows Error 0x80070570 — File or Directory Corrupted
Errorwindows-system-0xc0000185Windows Error 0xC0000185 — Boot Device Inaccessible
CriticalFrequently Asked Questions
Desktop: 10-30 (minimize swap for responsiveness). Server: 60 (default, balance between RAM and swap). Database server: 1-10 (keep data in RAM).