Adding overflow memory.
WHEN TO ADD IT
When a machine has little memory and occasional spikes.
WHEN NOT TO
As a substitute for enough memory under sustained load.
WHY
Sustained swapping is slower than the problem it hides.
WHAT THE TWO FORMS ARE
A dedicated partition A file on an existing file system
WHAT A FILE PROVIDES
Flexibility, resizable without repartitioning.
WHAT THE STEPS ARE
Create a file of the intended size Restrict its permissions to the owner only Format it as swap Enable it Add it to the file system table so it survives a reboot
WHY PERMISSIONS MATTER
Swap contains memory contents, which may include credentials.
WHAT TO SET THEM TO
Readable and writable by root only.
HOW TO CONFIRM IT IS ACTIVE
The swap listing, or the memory summary.
WHAT SIZE TO CHOOSE
Enough to absorb a spike, not so much that a leaking process runs for hours degrading everything.
WHAT TO CHECK AFTERWARDS
That the entry in the file system table is correct.
WHY THAT SPECIFICALLY
An error there can prevent the machine booting.
HOW TO TEST WITHOUT REBOOTING
Disable and re-enable everything from the table.
WHAT TO MONITOR
Swap activity rather than swap usage.