Skip to content

Instantly share code, notes, and snippets.

@engell
Last active December 25, 2015 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save engell/7058735 to your computer and use it in GitHub Desktop.
Save engell/7058735 to your computer and use it in GitHub Desktop.
The list of commands to create a swap-file in linux.
root(~)# fallocate -l 2G /home/engell/.swapfile
root(~)# chmod 600 /home/engell/.swapfile
root(~)# mkswap /home/engell/.swapfile
Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=8154dc45-fda4-4f29-b7a8-05f7c864f7a4
root(~)# swapon /home/engell/.swapfile
root(~)# free
total used free shared buffers cached
Mem: 1017740 1003196 14544 0 8388 691664
-/+ buffers/cache: 303144 714596
Swap: 2097148 0 2097148
root(~)# nano /etc/fstab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment