Cushioning The Main Memory

Asked by chintalvaady

Hi,
For some reasons i had not allocated swap space while installing ubuntu,but now i feel severe performance degradation.now is it possible for me to allocate swap space without reinstalling the O.S?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
W. Prins
Solved:
Last query:
Last reply:
Revision history for this message
W. Prins (wprins) said :
#1

Yes it is.

You can create a swap file on your filesystem and swap to that. How much memory have you got?

Revision history for this message
chintalvaady (cmraghavendran) said :
#2

well,My Main memory is 1GB and my hard disk is 80Gb...i use Ubuntu along wid windows as Dual boot.

Revision history for this message
W. Prins (wprins) said :
#3

OK, well for most things 1GB should be sufficient, but even so, here's how to create a new/extra swapfile:

1. Open a terminal (Applications->Accessories->Terminal)
2. Enter the following commands (or better yet, copy and paste them) one by one and press enter after each line:

sudo dd if=/dev/zero of=/swapfile bs=1K count=1024K
sudo mkswap /swapfile
sudo cp /etc/fstab /etc/fstab.backup
sudo echo "/swapfile none swap sw 0 0" >>/etc/fstab

3. Now you can either reboot, or enter the following command to activate the new swapspace without rebooting:
sudo swapon

The space should automatically be used/mounted on boot.

Revision history for this message
Best W. Prins (wprins) said :
#4

Forgot to say, the above will create a 1GB swapfile. Adjust the "count" value accordingly if you want a bigger or smaller swapfile. E.g. count = 512K will create a half gigabyte swapfile,a nd 2048K will create 2GB swapfile. Personally I wouldn't recommend any higher than 1GB to start with, and probably even 512MB will be fine.

Revision history for this message
chintalvaady (cmraghavendran) said :
#5

Thanks ByteJuggler, that solved my question.