What is SWAP SPACE
A SWAP space is an area of a disk which can be used for memory management subsystem. Swap space are used to supplement the system RAM by holding inactive pages of memory.
How to create a swap space:
To create a swap space, needs to do three things:
- Create partition.
- Set the type of the partition as82 Linux Swap.
- Format the type signature on the device.
How to create SWAP space
Create a 500 MiB SPAP space:
- Create a 500 MiB partition on/dev/vdbon Linux swap.
# fdisk /dev/vdb
- Print the table, and then create a new partition that is 500 MiB in size.
# +700M (Enter size we want to create SWAP Space)
- Set new created partition to typeLinux swap.
- Save the partition table changes.
- Run thepartprobeto make the kernel aware of the partition table change.
- Initiate the newly created partition as swap space.
# mkswap /dev/vdb1
- Enable newly created swap space.
7.1 To See created swap space is enable use following command.
7.2 Enable created space as a SWAP space.
# swapon /dev/vdb1
7.3 Verify that the newly created swap space is available.
- Configure new swap space so that it is enable at boot.
8.1 Determine UUID of the new swap partition on the first disk.
# blkid /dev/vdb1
8.2 Add an entry to /etc/fstab
# vim /etc/fstab
Paste here UUID swap swap defaults 0 0
8.3 Test enabling the swap space using the entry.
# swapon –a
8.4 Verify that the new swap space was enabled.