When installing Ubuntu 18.04+ (and other modern distros), do I still need to create a SWAP partition?
Asked
Active
Viewed 7,283 times
3
-
Hello and welcome to Ask Ubuntu! Your question, as is, it's too broad, as the answer can really be only it depends. Can you [edit] your question and add some more info about what kind of system are you installing? Is is a desktop PC? A notebook? A cluster of servers for virtualization? ... – Daniele Santi Feb 13 '19 at 14:14
-
Recommendations about swap files/partitions will be all over the place... but the bottom line is... EVERY system needs a swapfile or swap partition. Later versions of Ubuntu default to a swapfile when doing a clean install. Upgrades will use an existing swap partition, if it exists. If you plan on hibernation, then you MUST have swap, no if ands or buts. – heynnema Feb 13 '19 at 15:46
-
I gave this a lot of thought and did some testing awhile back. You might find this interesting. – Elder Geek Feb 13 '19 at 18:17
-
@ElderGeek I read your swap testing summary. Loading up all of the apps that you can is not a good test of memory or swap usage. Take Chrome/Firefox as an example... sitting there doing nothing, takes few resources... but start using either, and the resources disappear quickly. Also, the "free memory" number kinda means nothing, 'cause any unused memory is used as file/disk cache/buffer, and that's returned to memory as needed. If you hibernate, you need swap. If you run out of real memory, and your system hangs/crashes, you need swap. EVERY system needs a /swapfile or a swap partition. – heynnema Feb 14 '19 at 01:09
-
@heynnema With all due respect, "If you hibernate, you need swap." (true) Does NOT equate to "EVERY system needs a /swapfile or a swap partition." (false) As I stated clearly in the answer I referenced This is a use case scenario. – Elder Geek Feb 14 '19 at 20:55
2 Answers
2
No, Ubuntu supports a swap-file instead. And if you have enough memory - compared to what your applications need, and don't need suspend - you can run all without one.

Soren A
- 6,799
-
Recent Ubuntu versions will create/use a /swapfile only for new installs. If it's an upgrade, and it finds an existing swap partition, it'll use it. Please see my detailed comment to ElderGeek, above. EVERY system needs a /swapfile or a swap partition. – heynnema Feb 14 '19 at 01:12
0
I would recommend yes, even if it's not mandatory.
When you hibernate the system, data present in the RAM is stored into the SWAP partition.
Also, depending on your system's amount of RAM, the SWAP partition can be used as an "extension" of the RAM.

FloT
- 2,326