Which is better, a /swapfile or a dedicated partition? Disk space and installed memory are not an issue.

I currently have a dual-boot system with Windows 11 and Linux Mint Cinnamon 21.1, both in English. I am now adding two more Linux OSes: a French Linux Mint 21.1 and Kubuntu 22.04 in English.

With the installation of three Linux OS's, do I need a swap for each, or will the installation detect an existing file or partition?


1 Answer 1


If you're careful, there's no practical difference between a swap partition and a swap file, except:

  • swap partitions are harder to resize than swap files.
  • It's possible to create a non-contiguous (invalid) swap file. swap partitions are contiguous by specification.

Once you've created a swap partition, any Linux should be able to use it. Windows probably not.

For a swap file to be useable by multiple Linuxes, the swap file will have to reside on a filesystem that gets mounted early by each Linux. Synchronization between mount and swapon is hard.

  • Since you have lots of memory, SWAP is optional - I don't bother with one. However, if you have a laptop which hibernates, you will need to provide a swap option. Jun 24, 2023 at 1:17
  • And if you want to use hibernation you will not be able to share swap partitions
    – PonJar
    Jun 24, 2023 at 9:07
  • The three OS are Debian based. They are two different language copies of Linux Mint Cinnamon 21.1, and one English Kubuntu 22.04. They share a single 2TB data drive. My approach is overcautious because of my early use of Linux starting over a decade ago. Because of this, I consecutively installed three Linux OS where each OS had a 2gb partition listed by UUID in fstab, I noticed later that the two added OS used the first installed swap partition instead of their own. Then, later I started to use a /swapfile in the first but did not declare it in the other fstab.
    – ineuw
    Jun 26, 2023 at 5:34

You must log in to answer this question.

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