Created
December 2, 2017 07:11
-
-
Save venuktan/74844cfea9f120088aa3d3ef5652c600 to your computer and use it in GitHub Desktop.
increase swap size
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
1. Create empty file: | |
This file will contain virtual memory contents so make file big enough for your needs. This one will create 1Gb file which means +1Gb swap space for your system: | |
dd if=/dev/zero of=/media/fasthdd/swapfile.img bs=1024 count=1M | |
If you want to make 3Gb file then change count value to count=3M. See man dd for more information. | |
2. Bake swap file: | |
Following command is going to make "swap filesystem" inside your fresh swap file. | |
mkswap /media/fasthdd/swapfile.img | |
3. Bring up on boot: | |
To make sure that your new swap space is activated while booting up computer you should add it to filesystem configuration file /etc/fstab. Add it to end of file, this is recommended because other filesystems (at least one that contains swap file) must be mounted in read-write mode before we can access any files. | |
# Add this line to /etc/fstab | |
/media/fasthdd/swapfile.img swap swap sw 0 0 | |
4. Activate: | |
You can either reboot your computer or activate new swap file by hand with following command: | |
swapon /media/fasthdd/swapfile.img |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment