echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Category: VPS Management
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Make the swapfile persistent across reboots by adding it to /etc/fstab
Without this, the swapfile is inactive after each reboot. Add this line to /etc/fstab to automatically activate swap on startup.