There are two ways to create a swap in Linux.
Use disk partition
Make a partition first
1 | fdisk /dev/sda1 |
1 | mkswap /dev/sda1 |
1 | swapon /dev/sda1 |
1 | blkid |
1 | vi /etc/fstab |
1 | mount -a |
Use a file
1 | dd if=/dev/zero of=/tmp/swap bs=1M count=128 |
1 | vi /etc/fstab |