Linux swap space.
When RAM fills up, swap is the disk-backed safety net. Watch RAM and swap bars fill, see the difference between a swap file and a swap partition, and learn the one tunable (swappiness) that decides how eagerly the kernel uses it.
Linux swap space animated tutorial. What swap is, swap files vs swap partitions, mkswap and swapon, persistent activation via /etc/fstab, and the vm.swappiness tunable. RHCSA EX200 ready.Swap is the disk-backed safety net when RAM fills up. Watch RAM and swap bars fill, see the file vs partition variants, and tune swappiness.
- Β·Comfortable with df / mount / fstab basics
- Β·Know what a block device (e.g. /dev/sdb1) is
- Β·Helpful: kernel-parameters lesson (sysctl)
Add swap either as a file or partition, persist it in fstab, and tune vm.swappiness for the workload.
pace: 8 minutes
What swap is for
Swap is disk space the kernel can use as overflow RAM. When physical memory fills, the kernel pages cold (rarely-accessed) memory out to swap, freeing RAM for hot pages. It's not a substitute for more RAM β disk is orders of magnitude slower β but it prevents the dreaded OOM killer from shooting your processes the moment RAM is full.
$free -h$swapon --show$cat /proc/swapsSwap is a safety net, not extra RAM. Heavy swapping always means "buy more RAM or fix the workload" β but having SOME swap is almost always better than running with none, because the kernel uses it to evict truly cold pages and free RAM for what matters. Tune swappiness for the workload; persist via fstab; never forget to chmod 600 a swap file.
$free -h$swapon --show$cat /proc/swaps$mkswap /path$swapon /path$swapoff /path$swapon -a / swapoff -a$fallocate -l 2G /swapfile$chmod 600 /swapfile$blkid /dev/sdb1$UUID=... none swap defaults 0 0$sysctl vm.swappiness$sysctl -w vm.swappiness=10$/etc/sysctl.d/99-swappiness.conf$vmstat 1$OOM killerYour server is swapping heavily and getting slow. Adding RAM isn't possible right now. What single tunable might reduce paging?
You created a swap file at /swapfile and ran swapon. It works now, but disappears after reboot. Why?
Why chmod 600 on a swap file?
Difference between a swap partition and a swap file?
These aren't graded β they're just for active recall, which is what actually makes the lesson stick.
Kernel parameters & tuned
vm.swappiness is one of hundreds of sysctl tunables. Learn the runtime-vs-persistent pattern and how tuned bundles them.
keep going β these pair well with what you just learned.
SELinux contexts
Why Apache can't read your file. Watch the policy engine decide β and learn the workflow for fixing denials. RHCSA-ready.
Linux boot process
From power button to login prompt. Every stage in the chain β UEFI, GRUB, kernel, initramfs, systemd β with the rescue moves that save you. RHCSA-ready.
LVM stacking
Layer-by-layer build of an LVM stack: disks β PVs β VG β LVs β filesystem. Then extend live and snapshot. RHCSA-ready.