1

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

2 Answers2

1

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

Source:DigitalOcean

Mitch
  • 109,787
0

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.

Radu Rădeanu
  • 174,089
  • 51
  • 332
  • 407