Skip to content

Instantly share code, notes, and snippets.

@v1shwa
Created December 19, 2016 08:09
Show Gist options
  • Save v1shwa/1bddf8ceb848adf7053be48f6aac2a1d to your computer and use it in GitHub Desktop.
Save v1shwa/1bddf8ceb848adf7053be48f6aac2a1d to your computer and use it in GitHub Desktop.
Quick temporary swap
#!/bin/bash
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Verification
sudo swapon -s
@v1shwa
Copy link
Author

v1shwa commented Dec 30, 2016

Usage:

curl -sSL https://git.io/v1daO | bash

@v1shwa
Copy link
Author

v1shwa commented Jul 18, 2017

If there is a problem with fallocate:

sudo dd if=/dev/zero of=/swapfile count=4096 bs=1MiB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment