9

Ubuntu 17.04 doesn't have a swap partition, and I commented wondering,

If I just upgraded an older system that installed with a swap partition to 17.04, should I delete my old swap partition?

I have three SSD laptops with swap partitions, which had Ubuntu 16.10 on them a few days ago. Now, all are running version 17.04, but none have a /swapfile even after a few reboots.

  1. Should I keep the old swap partition, or delete it?
  2. Is the swap partition preventing /swapfile from being created, or would I end up with no swap at all?
cat
  • 1,672
  • 5
    I think 17.04 really just changed the default behavior of the installer to add a swapfile instead of a swap partition - both pre-17.04 and post-17.04 versions support both swap partitions and files, the only difference is the installer. As far as moving, the only real advantage of a swap file over a swap partition is that a swap file is much easier to resize - if you are happy with your current swap size, there's not much reason to change. – daboross Apr 30 '17 at 03:06
  • 1
    @DaboRoss you could add that as an answer, it's exactly right. You shouldn't delete your old swap partition :) – Zanna Apr 30 '17 at 04:09
  • 1
    @DaboRoss Please make that an answer so I can accept it! – cat Apr 30 '17 at 12:12
  • Ah sorry, alright - I didn't think I had enough like links/research to do one, but I can do that xD – daboross May 04 '17 at 04:38
  • 1
    It seems that the installer automatically uses a swap-partition if one exists already instead of creating a swap-file. – mook765 May 04 '17 at 06:38

1 Answers1

2

Ubuntu 17.04 changed the default behavior of the installer from creating a swap partition to creating a swap file. (see the release notes).

With this noted, both Ubuntu pre-17.04 and post-17.04 support both a swap partition and a swap file.

As for whether you should switch or not, I'd look at a question specific to that for details. Summed up here for clarity though:

The main advantage of a swap file over a swap partition is that resizing a swap file is many times easier. Resizing a swap partition requires adjusting the partition layout, probably booting from a live disk if you want to do any real adjustment, and a lot of time to move your data around. The swap file is just a few commands, and can be done live.

In short, if you are happy with your current size of swap partition, there is no reason to change. It'll take just as much effort turning a swap partition into a swap file as it would resizing a swap partition, only difference being future resizes will be much easier.

daboross
  • 2,153