Type following command to create 512MB swap file (1024 * 512MB = 524288 block size): sudo fallocate -l 4G /swapfile1 sudo chmod 600 /swapfile1 c) Set up a Linux swap area: # sudo mkswap /swapfile1 d) Activate /swapfile1 swap space immediately: # sudo swapon /swapfile1 e) To activate /swapfile1 after Linux system reboot, add entry to /etc/fstab file. Open this file using text editor such as vi: #sudo vi /etc/fstab Append following line: /swapfile1 none swap defaults 0 0 f) activate swap #sudo swapon /swapfile1 or to check /etc/fstab entry: #swapon -a g) How do I verify swap is activated or not? Simply use free command: $ free -m ------------ This does not work when root file system is on a "unionfs" eg: root@vpn:/# mkswap /swapfile1 Setting up swapspace version 1, size = 536866 kB no label, UUID=792c61bb-0425-4441-a7c9-1f103b84c296 root@vpn:/# swapon /swapfile1 swapon: /swapfile1: Invalid argument root@vpn:/# mount unionfs on / type unionfs (rw)