How to make a swap partition

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:

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 *