0

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!

ssssstut
  • 667
  • 1
    You stop using swapfile and switch to swap partition, use both, or change from partition to swapfile. All you need to do is add a swap partition using available space OR shrink a partition to create space, create a swap partition, then tell your system to use it. No re-install is required – guiverc Mar 22 '24 at 09:14
  • 1
    Why ? Swap-file is much more flexible than swap-partition. – Soren A Mar 22 '24 at 09:17
  • Soren A: My intention is to make hibernate working on my LUbuntu tablet. Spent some time and I saw a guide that involved swap-partition so I thought it might be mandatory for hibernate.

    ...much more flexible than swap-partition...

    Thanks for your input! Looks like this might work too: https://askubuntu.com/questions/6769/hibernate-and-resume-from-a-swap-file

    – ssssstut Mar 23 '24 at 08:14

1 Answers1

1

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.

waltinator
  • 36,399