Add a swap file
Add a swap file to your Victus VPS to survive memory spikes and avoid the OOM killer when RAM is tight.
Swap is disk space the kernel uses as overflow when RAM fills up. On a smaller VPS plan a swap file is a cheap safety valve: it keeps the out-of-memory (OOM) killer from abruptly terminating your app during a brief memory spike. This is a file-based swap, so no repartitioning is required.
Disk is far slower than RAM, so a machine that swaps heavily and constantly will feel sluggish. Use swap to absorb spikes; if you swap all the time, upgrade the plan for more RAM.
Create a swap file
# Create a 2G swap file (adjust size as needed)
fallocate -l 2G /swapfile
# If fallocate is unavailable:
# dd if=/dev/zero of=/swapfile bs=1M count=2048
# Lock down permissions (required)
chmod 600 /swapfile
# Format and enable it
mkswap /swapfile
swapon /swapfile
# Confirm it is active
swapon --show
free -hMake it survive reboots
# Add to fstab so it re-enables on boot
echo '/swapfile none swap sw 0 0' >> /etc/fstabOnly append the swap line once. If you run the setup twice, check /etc/fstab and remove any duplicate /swapfile entry, or boot will error.
Tune how eagerly it swaps
# Lower swappiness = prefer RAM, only swap when really needed (good for servers)
sysctl vm.swappiness=10
# Persist it
echo 'vm.swappiness=10' >> /etc/sysctl.d/99-swappiness.confFor servers, 1x to 2x your RAM is a reasonable swap size (e.g. 2-4G on a 2G VPS). Make sure you have the free disk space first with df -h — and remember swap consumes disk that counts toward your plan.