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