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