Ubuntu – Safe to create a swap partition using GParted


I went through this forum post, and found out that it is possible to install a swap partition after installation of the OS. I just wanted a guide as to how I should do it so as to have it done safely and neatly. Do I first free up space equal to 4000MB (my RAM size) from my Windows 8 installation drive and simply format the new free space to a linux-swap? How exactly do I then bind it to /etc/fstab? Do I use the terminal and run: sudo update-initramfs -u first, and then update the UUID using the commands shown in that thread? Also, can I include the previously "unallocated" and "unknown" partitions on my disk in the swap partition? Please help.

enter image description here

Best Answer

You probably want to look at this question: Creating a Dedicated swap hard drive

You won't have to use a partition for swap, a swap file is totally fine, no performance penalty at all. See the abovementioned question, use fallocate or dd to create a swap file and swapon to use it. To make it survive reboots, add it to /etc/fstab.

Related Question