How to create SWAP in Linux or Increase SWAP space in Linux

Here we are going to create a SWAP of 8GB in size.

Run commands on your linux host in below sequence.

dd if=/dev/zero of=/swapfile bs=1024 count=8388608&

chmod 0600 /swapfile

mkswap /swapfile -f

swapon /swapfile

Add below entry in /etc/fstab file and save the file.

/swapfile     swap     swap     defaults     0     0

Run command free -h to check available SWAP space.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s