I'm installing Ubuntu on a Samsung evo 850 SSD drive. System has 4GB memory but no other harddrive. Should I use thedefault partition table or install without swap and make a swap file after installation? Or does it even make a difference whether it’s a partition or a file?
Asked
Active
Viewed 4,957 times
5
1 Answers
10
For new installations of Ubuntu 17.04 and later a swap file is created by default instead of a swap partition. The first LTS release to use a swap file by default is Ubuntu 18.04. It's a logical new feature because of the emergence of SSDs. Creating a swap partition on an SSD will cause life-decreasing wear.*

karel
- 114,770
-
For users concerned about SSD wear, another thing worth considering is to reduce swappiness to 0 or perhaps to 5. Although the jury is still out on that... – joeytwiddle Dec 19 '18 at 03:12
-
4No-one has said it entirely clearly yet - Does a swap file wear out an SSD less than a swap partition? E.g. due to the SSD being able to shuffle around the specific blocks being worn out by writing more - i.e. SSD wear manager has the whole free space on the system partition to use in case of a swap file versus a very limited amount of space in case of a swap partition. – Carolus Feb 12 '20 at 11:07
-
1So in 2020, on Ubuntu 17+, there's no reason for me to bother touching the Swap file, because the OS will handle everything for me? – Eliezer Berlin Dec 01 '20 at 10:51
-
2@EliezerBerlin For new installations of Ubuntu 17.04+ and all release upgrades that are upgraded from the same, the swap file is created automatically (including by default by the Ubuntu installer) without any additional user intervention being necessary. – karel Dec 01 '20 at 10:55
-
Carolus' question is still pending. Would a swap file cause less wear than a swap partition? I'm not sure about how the difference in partitioning in SSD vs. HDD works, I only know they are somehow different and that SSD works at a more logical level. So I'm expecting this to make no difference (but if so why would they implement the feature in Ubuntu TBW?) but I'm no SSD expert. And since we're at it, if you have the option to put either one in a HDD in order to reduce wear, then would that be advisable? – Piovezan Jan 10 '21 at 14:37
-
SSD has a much longer lifespan than HDD because it is a Solid State Drive with no moving parts whereas HDD has a spinning disk that is subject to mechanical wear. swap space in Ubuntu is configurable with respect to type, size, location, etc. My own swap file in Ubuntu 20.04 is still the default settings that the Ubuntu installer gave it which is a 1.5GB swap file and it's located on the SSD where I have Ubuntu installed. – karel Jan 10 '21 at 14:40
-
@karel That is irrelevant to the question. SSD has a limitation on the number of writes which HDD doesn't have not frequent memory swapping on SSD much probably impacts on that. – Piovezan Jan 10 '21 at 14:44
-
Depending on the model of SSD the expected maximum writes for an SSD can be a large number of writes. – karel Jan 10 '21 at 14:45
-
@karen That is my question. How much swapping would be too much for an SSD? A 16 GB RAM system put on daily hibernation would write at least 16 GB to it every day, not to mention the frequent swapping while working which depends on how many applications you keep open and how you put your system's memory to use. As a rule of thumb the more memory you have the less often you swap but that still depends on how your applications and OS use the memory. – Piovezan Jan 10 '21 at 14:58
-
1You've got it exactly right. It all depends on what you intend to use swap space to do. My computer has lots of RAM and I don't ever hibernate it, so it doesn't need much swap space. btw a swap file in Ubuntu can be configured to be dynamically resized in order to save disk space. – karel Jan 10 '21 at 15:01
https://askubuntu.com/questions/184217/why-most-people-recommend-to-reduce-swappiness-to-10-20/184221#184221 – oldfred Oct 09 '18 at 13:15