Ubuntu: Need to give swap space as didn't give it while installation


I did not provide swap space while installing Ubuntu. How shall i give the swap space now? I've a multibooted system with win xp and ubuntu. please help


First you must to free up some space and make a swap partition using a program like GParted.

After you made a new swap partition, follow this answer: https://askubuntu.com/a/33700/147044.

To calculate the size of swap partition, use this answer: https://askubuntu.com/a/49138/147044.


This will create a swap file of 512MB, using space from /dev/sda5 since you're only using up about 8% of it.

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k sudo mkswap /swapfile

Finish up by activating the swap file:

sudo swapon /swapfile  

To make the swap permanent add it to the fstab file.

sudo gedit /etc/fstab  

Paste in the following line:

 /swapfile       none    swap    sw      0       0   

And finally set up the correct permissions on the swap file:

sudo chown root:root /swapfile   sudo chmod 0600 /swapfile  


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »