Read more

Create swap space on Linux

Thomas Eisenbarth
July 11, 2013Software engineer at makandra GmbH

Create a 1 GB file to swap to (we have sufficient space on / on this machine. Use a different partition if necessary)

sudo dd if=/dev/zero of=/var/swapfile bs=1M count=1024
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

If you prefer 2GB swap, chose count=2048, 4GB: count=4096

Change permissions of swap file:

sudo chmod 0600 /var/swapfile

Set up swap file and enable it:

sudo mkswap /var/swapfile
sudo swapon /var/swapfile

You should see your swap space now:

thomas@machine:~$ free -m
              total       used       free     shared    buffers     cached
Mem:          7700       7655         45          0         75       1237
-/+ buffers/cache:       6342       1357
Swap:         2047          0       2047

If you want to make the changes permanent add those lines to /etc/fstab

/var/swapfile  none  swap  sw  0 0
Posted by Thomas Eisenbarth to makandra Operations (2013-07-11 18:03)