Ubuntu – Removed swap when editing fstab file-not sure

filesystemswapuuid

I wanted to remove the warning when starting Ubuntu (Continue to wait, press S to skip or M for manual recovery). I did it! But what I did not want to do was removing my swap partition. I am not sure if I have really removed it, I only removed the line in /etc/fstab file. This solved my problem with warning, but on the other side, I've lost my swap partition.

Is there any way to recover the swap partition (I think I did not remove it, only unmounted?) ? Or at least getting the old one's UUID? I do not understand file systems in Linux with Home folders and so completely.

Thanks for the answers.

Best Answer

From what I'm reading, I don't think that you have removed the swap partition. Getting the swap partition's UUID is easy by typing in a terminal: blkid. One of the lines should contain the word swap. That line should look something like this:

/dev/sda5: UUID="e911d747-0add-49dc-a37d-7b6b16656c2f" TYPE="swap" 

Now, edit /etc/fstab by typing in the terminal: sudo gedit /etc/fstab. Add a line saying:

UUID=swap's-uuid-number none swap sw 0 0

So, in my case, it should be:

UUID=e911d747-0add-49dc-a37d-7b6b16656c2f none swap sw 0 0

Save the file, reboot. You should have your swap partition mounted automatically again.

If blkid doesn't show a swap partition, you should create a new one. I'd advice you to do that via the tool gparted. Install it via sudo apt-get install gparted or via the Software Center, then run it. In gparted, select an unused area, then click on the new partition button (it looks like a document with a green plus sing on it), and make sure you format it as linux-swap or swap, can't really remember what it's called again. A good swap partition should be 2 times the size of your RAM. So if you've got 2GB of RAM, make sure that your swap partition's size is 4GB. When you've done that, blkid should show have a line containing swap. Continue using the instructions above.