DEV Community

Cover image for Ubuntu Expand Swap Space to 4 GB for coolify crash
Md Asaduzzaman
Md Asaduzzaman

Posted on

Ubuntu Expand Swap Space to 4 GB for coolify crash

Increasing Swap prevents the server from crashing when memory spikes during builds. Run these commands via SSH on your VPS:

# Turn off existing swap
sudo swapoff -a

# Allocate a 4GB swap file
sudo fallocate -l 4G /swapfile

# Set correct permissions
sudo chmod 600 /swapfile

# Format and activate swap
sudo mkswap /swapfile
sudo swapon /swapfile

# See status
sudo swapon --show

# Verify the new swap size
free -h
Enter fullscreen mode Exit fullscreen mode

Top comments (0)