Last active
September 22, 2018 06:30
-
-
Save an-ivannikov/8411378fa4f770515983f35ef275b89b to your computer and use it in GitHub Desktop.
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
# How To Create A Swap File In Linux | |
> https://digitizor.com/create-swap-file-ubuntu-linux/ | |
$ cd / | |
$ sudo dd if=/dev/zero of=swapfile bs=1M count=3000 | |
To set it as 1GB, change the count value (3000 in the example above) to 1000, 1500 for 1.5GB etc. | |
Now change the file created to a swap file with the command below. | |
$ sudo mkswap swapfile | |
Turn on the swap file with the command, | |
$ sudo swapon swapfile | |
To ensure that the swap file is turned on automatically at system startup, open fstab. | |
$ sudo nano etc/fstab | |
And add the line given below. Save and close. | |
/swapfile none swap sw 0 0 | |
That is it. You can check if the system is using the swap file you created with the command | |
$ cat /proc/meminfo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment