fallocate -l 4G /swapfile # if no fallocate on your system, use the following # dd if=/dev/zero of=/swapfile bs=1024 count=1048576 chmod 600 /swapfile # use "force" to use the entire "device" mkswap -f /swapfile # save, then modify fstab cp -a /etc/fstab /etc/fstab.save echo '/swapfile swap swap defaults 0 0' >> /etc/fstab # turn on swap for everything in fstab swapon -a # display the result swapon --show