How to create swap partition

How to create swap partition.

========================================================================================================
1> create partition using normal method fdisk OR cfdisk
________________________________________________________________________________________________________
2> change partition type to swap (82)
#cfdisk /dev/sda
-select free space and create partition.
-type tab change 82 ( swap)
-write
-quit

#partx -a /dev/sda
________________________________________________________________________________________________________
3> format partition as swap
#mkswap /dev/sda 9

Note : if this command give error then reboot the server.
________________________________________________________________________________________________________
4> copy UUID of that partion.
#blkid /dev/sda9
________________________________________________________________________________________________________
5> make entry in /etc/fstab

#vim /etc/fstab
UUID=”      ”     swap/none   swap  defaults    0 0
:wq
________________________________________________________________________________________________________
6> mount -a

========================================================================================================

You can verify new swap size using

#free -m

OR

#swapon -s

Note : if not show new size run command “#swapon -a “.

========================================================================================================

Posted in partitions

Leave a Reply