How to Enable swap partition in Linux

enable swap partition
#!/bin/bash

mkdir /mnt/swap/

dd if=/dev/zero of=/mnt/swap/swapfile bs=1024 count=4194304

mkswap /mnt/swap/swapfile

## if need take bkp of fstab
##cp -pfr /etc/fstab.org /etc/fstab

sleep 5

swapon -a

##check any swap is already there.if it is remove
##swapoff /dev/sda3

##add to rc.local,take bkp
##cp -pfr /etc/rc.local.org /etc/rc.local

Vim /etc/fstab
********************

/mnt/swap/swapfile swap  swap    defaults 0 0

Advertisements

Posted on February 23, 2014, in LInux Based. Bookmark the permalink. Leave a comment.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: