Swap space on a Linux box is an area on disk that is used to hold inactive memory pages. This occurs when the system needs more memory then is currently available, so it swaps these inactive memory pages to disk.
To create additional swap space on the fly you are either going to need a spare disk or free partition on a disk that you can use.
First, using fdisk, you will need to make sure that the partition type for the disk (or partition) is set to 82.
Then setup the swap area using mkswap. In this example I am using /dev/sdb2, but your setup is bound to be different.
Then determine the UUID of the new swap space.
Then add an entry to the /etc/fstab, so that the swap space is mounted at boottime. The show in the example below is the output of the blkid command above.
Anyone who has added and removed multiple disks from a RedHat server knows very well that your disks may not always enumerate exactly the same way after a reboot. You then have to resort to mounting up your filesystems to a temporary mount point to see exactly whats in them, and were they really need to be mounted.
Want to know if UUIDS are being used on your linux box, well just cat /etc/fstab, and if you see somthing similar to what’s below, then you are using UUIDS, instead of traditional disk device names.