Data Disk - Use Data Disk as SWAP

This tutorial helps you create swap in data disk.

We will make disk structure to:

/dev/vda – os disk
— /dev/vda1 – /boot
— /dev/vda2 – LVM (/ included)
/dev/vdb – data disk
— /dev/vdb1 – …
— /dev/vdb2 – …
— /dev/vdb3 – SWAP
/dev/vdc – initialization file

We will use /dev/vdb3 as SWAP. If you don’t know how to create partition, please refer to:

1. Create Partition and Mount it to /home

2. Create Partition and Merge it with OS Disk

Warning: it will cause /dev/vdb3 lost, please make sure there is no data in /dev/vdb3.

1. Create SWAP

mkswap /dev/vdb3

2. Edit fstab

echo "/dev/vdb3 none swap defaults 0 0" >> /etc/fstab

3. Mount SWAP

swapon -a

Check SWAP status with free

free -m

In this tutorial, output will be:
total used free shared buffers cached
Mem: 994 361 632 0 11 297
-/+ buffers/cache: 53 940
Swap: 2047 0 2047

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to install OS via ISO on KVM VPS

When you ordered a KVM VPS from us, you will have access to our KVM control panel. The buttons...

How to use Data Disk

StarryDNS offers KVM VPS with disk structure as follows: /dev/vda – os disk — /dev/vda1 – /boot...

Data Disk - Create New Partition and Mount to /home

This tutorial will help you create new partition on data disk and mount it to /home in our KVM...

Data Disk - Create New Partition and Merge to /

This tutorial is about how to create partition on data disk and merge it with OS disk to extend...

How to Configure IPv6

This tutorial is about how to configure IPv6 address in major operating systems. Step 0. Obtain...