Change swap file to swap partition – can this be done easily?

I found many posts how to change a swap partition to a file e.g.: Swap partition to Swap file. Due to some hibernate issues with LUbuntu I’d like to change my swap file to a partition. Can this be done or does it require a fresh install?

In case of yes: which steps do I have to do?

Thank you!

Asked By: ssssstut

||

To create a swap (or any) partition on a disk, none of the disk’s partitions can be mounted. Boot from a Live Cd, or your installation medium in "Try Ubuntu" mode.

Run gparted, make sure (in the upper right corner of gparted‘s screen) you’re manipulating the correct disk.

Use gparted to move/resize partitions to create available space as big as you want your swap to be.

Create a partition in the available space, format it as ‘swap’.

Boot back into your normal system.

Use blkid to find the UUID, read man fstab to see how to add swap to /etc/fstab.

Then swapon your new partition,

swapoff and rm your swapfile.

Answered By: waltinator
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.