Differences between revisions 1 and 2
Revision 1 as of 2017-12-07 08:04:18
Size: 338
Editor: PieterSmit
Comment:
Revision 2 as of 2022-02-24 22:22:22
Size: 401
Editor: PieterSmit
Comment:
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
sudo fallocate -l 8G /swapfile8G
sudo mkswap /swapfile8G
echo '/swapfile8G none swap sw 0 0' | sudo tee -a /etc/fstab
export swapspace="2G"
sudo fallocate -l ${swapspace} /swapfile${swapspace}
sudo mkswap /swapfile${swapspace}
echo '/swapfile${swapspace} none swap sw 0 0' | sudo tee -a /etc/fstab

Add a swapfile to a Linux box (Ubuntu

1. Paste into a terminal, it adds a 8G swapfile to the VM/Machine.

  • export swapspace="2G"
    sudo fallocate -l ${swapspace} /swapfile${swapspace}
    sudo mkswap /swapfile${swapspace}
    echo '/swapfile${swapspace} none swap sw 0 0' | sudo tee -a /etc/fstab
    sudo swapon -a 
    free -h
    cat /proc/sys/vm/swappiness

...

Linux/SwapFile (last edited 2022-03-03 04:55:03 by PieterSmit)