How to Increase Swap area in ubuntu | UbuntuCafe

How to Increase Swap area in ubuntu

How much swap space is currently used by the system? 

open terminal and type " free -k "

it will shown the result as the follows

$ free -k

                   total         used           free         shared    buffers     cached
Mem:       1017296     714408     302888          0         37188     325428
-/+ buffers/cache:     351792     665504
Swap:      2985976          0    2985976



Try " Swapon -s " , is same as the following.
$ swapon -s

Filename                Type            Size                Used    Priority
/dev/sda7             partition       2985976             0           -1





Use a Hard Drive Partition for Additional Swap Space

If you have an additional hard disk, (or space available in an existing disk), create a partition using fdisk command. Let us assume that this partition is called /dev/sdc1
Now setup this newly created partition as swap area using the mkswap command.


$ mkswap /dev/sdc1
 
Then enable the swap partition for usage using swapon command as shown below.

$ swapon /dev/sdc1

Then edit the /etc/fstab file

$ sudo gedit /etc/fstab 

Add the following line to that file and save it and close it.

/dev/sdc1                                  swap            swap      default          0        0


Now verify whether the newly created swap area is available for your use.

Type swapon -s in terminal and make sure that newly created swap space has in it.

Enjoy..!!!!!

1 comments:

Looking at my fstab, I already have a root partition at "/" and a swap partition mounted at "none". My swap partition is about a Gig, I want to take some space from my root partition and add it to my swap partition. How is this achieved?

Reply

Post a Comment