Add Swap Space in Ubuntu

Many vendors provide no default swap partition in their images. If you use Ubuntu, here’s a quick way to add swap space, which is useful when you may run out of allocated physical memory.

$ swapon -s
$ sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k
$ sudo mkswap /swapfile
$ sudo swapon /swapfile
$ swapon -s
$ sudo vi /etc/fstab # add the line below
   LABEL=SWAP /swapfile none swap sw 0 0

About rp8

Specialized in building sophisticated systems for trading & risks in commodity, exotics, commodity index & structured products. Specially interested in using open source stacks and cloud computing to build new generation of services and apps. Enjoy mountain biking & photography. github
This entry was posted in Ubuntu and tagged , . Bookmark the permalink.