Linux: How to extend swap space

Quick How To Guide

Display swap usage summary

# swapon -s

Show how many space swap needs in megabytes

# free -m

Create new swap disk.

# fdisk /dev/sdb

Format new disk to swap format

# mkswap /dev/sdb1

Add new part of swap

# swapon /dev/sdb1

Verify if there is more space in swap space

# free -m

Append next line to file /etc/fstab.

/dev/sdb2 swap swap defaults 0 0 

If you need old swap use

# swapoff /dev/sda6