#!/bin/bash # fallocate -l 4G /swap4file chmod 600 /swap4file mkswap /swap4file swapon /swap4file echo "/swap4file swap swap defaults 0 0" | tee -a /etc/fstab mount -a systemctl daemon-reload