How to Create Swap Partition in Linux

20 Jul

To Create Swap Partition in Linux please follow the below step

Step1. To show swap partition

#swapon -s

Create swap partition using FDISK Command.

# fdisk /dev/hdb

  • Then press p to print partition.
  • Then press n to make new partition.
  • Then press l to make logical drive and press enter.
  • Then give the size for the partition.
  • Here press t the give ID for swap(82).
  • Press w there to save the setting’s.

Step2. Format swap partition

# mk swap -v1 /dev/hdb9

Step3. To enable new swap partition

# swapon /dev/hdb9

Step4. To enable swap partition on permanent basis.

# vi /etc/fstab

give the swap partition entry in this file .

/dev/hdb9 swap swap defaults 00

then save it by pressing :wq

Leave a comment