Last active
August 9, 2023 02:33
-
-
Save omartrigui/fe6a9db3e4473e6844b27a98277141a7 to your computer and use it in GitHub Desktop.
Create 4G swap file in Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dd if=/dev/zero of=/swapfile bs=1024 count=$((1024 * 1024 * 4)) | |
chown root:root /swapfile | |
chmod 0600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
echo "/swapfile none swap sw 0 0" >> /etc/fstab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment