Storage

How to add a swap partition to my system

To add a new SWAP partition, you need an unused partition with its type set to Linux-SWAP. For example, suppose /dev/hdb3 is unused. Steps to create SWAP

  1. Create SWAP on partition /dev/hdb3. [root@ezylinux ~]# mkswap /dev/hdb3
  2. Enable SWAP [root@ezylinux ~]# swapon -a /dev/hdb3
  3. Add the mount point to /etc/fstab. /dev/hdb3 swap swap defaults 0 0
  4. Active swap [root@ezylinux ~]# mount -a

When finished, check with the free command to see the size of the swap you created.

[root@ezylinux ~]# free
             total       used       free     shared    buffers     cached
Mem:       8051368    7511512     539856          0     189072    2810760
-/+ buffers/cache:    4511680    3539688
Swap:      8191992          0    8191992
EOF.← Back to articles