How to make a swap partition

Posted on In QA

How to make a swap partition on Linux?

First, make a new partition (or reuse an existing one if you like).

I suggest using cfdisk to create it: https://www.systutorials.com/docs/linux/man/8-cfdisk/

Then, turn the new partition (say, /dev/sdc1) to a swap

# mkswap /dev/sdc1

Lastly, turn it on

# swapon /dev/sdc1

You can check whether its status by

# swapon -s

You can also added it to /etc/fstab to enable it automatically each time Linux start by adding a line

/dev/sdc1    swap     swap    defaults    0 0

Leave a Reply

Your email address will not be published. Required fields are marked *