Open main menu

Changes

232 bytes added ,  10:40, 24 October 2017
link to RH blog
Swap memory is a file-system based temporary storage for memory to allow a system to shuffle between different tasks that would otherwise consume all available physical memory (RAM). Cloud providers like [[AWS]]<ref>https://serverfault.com/questions/218750/why-dont-ec2-ubuntu-images-have-swap</ref> and [[Digital Ocean]]<ref>https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04</ref> do not setup swap on their default images. So, it's up to you to enable swap. RedHat provides an overview of swap at https://www.redhat.com/en/blog/do-we-really-need-swap-modern-systems
<source lang="bash">
# dd if=/dev/zero of=/swapfile bs=1G count=2
# fallocate is faster than dd because it doesn't actually write 2GB of zeroes
# however, if you get an error (e.g. CentOS) when you get to 'swapon', then you'll need to physically create a file using dd
fallocate -l 2G /swapfile
# set permissions so that nobody but root can read/write
</source>
[[Category:System Administration]] [[Category:Cloud]]
4,558

edits