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.
>mkswap /dev/sdb2
Then determine the UUID of the new swap space.
>blkid /dev/sdb2
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.
If you are so inclined, you can also get the UUID and filesystem label (if there is one) with the tune2fs command
tune2fs -l /dev/sda1
Filesystem volume name: <none>
Last mounted on: /boot
Filesystem UUID: 483c34a4-b3ec-4860-854f-b9e5b6a6efac
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
….truncated…
Oh and if you are running Fedora 15 and are wondering what the heck rootfs is (as I was), here is an explanation. More junk that I hope never gets into RHEL.
Oh and if you are really bored, and would like to know more about what a UUID is go here