1

Ubuntu is using swap files instead of swap partitions (as of Ubuntu 17.04) , except systems upgrading from 16.04 will retain their swap partitions and reuse them instead of swap files, as discussed in this answer. But, if I am upgrading and decide to use a swap file instead, can I place it in the old swap partition?

I realize this will limit the size of the swap file, but this way I can still make use of that drive space. If I can do this, would I have to format the partition to the same file-system type as Ubuntu? And would I have to keep it permanently mounted?

1 Answer 1

0

You can format the partition in "EXT4" and use it as normal partition, and then create a swap file there like in :

https://support.rackspace.com/how-to/create-a-linux-swap-file/

However, you have to mount this new partition at startup by adding it to the fstab file because a partition created after installing ubuntu will not be automatically mounted unless you add it to the fstab partition, so in summary you will mount the new partition then you will mount the swap file into the new partition, which is a very bad idea.

Why don't you just collapse this partition with any other partition and create the swap file into the root partition for example!

2
  • 1
    By suggesting to "collapse this partition" do you mean delete it and resize another partition? If so, I don't like to do that after operating systems are installed, just in case pointers and file directions get affected.
    – jordy
    Jun 22, 2018 at 10:57
  • I think it's safe to merge partitions, personally I've done this countless times and to be safe, when it comes to partition manipulation I always done it from a bootable device (where all partitions are unmounted), never have problems. Jun 22, 2018 at 14:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .