Create Swap for a Linux VPS

After your VPS has been created and is up and running and you do NOT see swap using top

Run the following commands to create your swap:

swapoff /dev/vda2
mkswap /dev/vda2
swapon /dev/vda2
Verify your swap is now working with:
#top

You should now see swap:

top - 09:29:50 up 1 min,  1 user,  load average: 0.03, 0.02, 0.00
Tasks:  71 total,   1 running,  70 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.3%sy,  0.0%ni, 99.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    501988k total,   130728k used,   371260k free,     5856k buffers
Swap:   524284k total,        0k used,   524284k free,    40780k cached

  • 71 Users Found This Useful
Was this answer helpful?