New Lubuntu install - 2GB RAM, 32GB SSD

I'm planning on installing Lubuntu (16.04 LTS 64-bit) on 2-3 older laptops with similar specs. They're all 2GB RAM (and are max'd out), and I'll use a 32GB SSD as the only drive. I have the same Lubuntu distro on one already which works great, but it's on a 256GB "spinny" drive. That drive has a 2GB swap partition.

My question is on swap partition and swap file, when moving to this SSD. I do not need hibernation. The computers won't see heavy use, and I'm not much concerned with SSD "wear" or lifetime. I'm most concerned with getting the best "user speed" on old machines with modest CPU's. Most usage is not very memory intensive, altho we'll occasionally open some big stuff in GIMP etc, which could max out the 2GB RAM.

After a bunch of searching + reading, it seems I'm best served by NOT using a swap partition, so my questions are:

  1. Does it seem best to go with no swap partition?

  2. If no swap partition- do I need to do anything to create a swap file, or will the normal Lubuntu install do it?

  3. I've read a lot about TRIM, noatime, + a couple other "tweaks" to make Ubuntu 'play nice' with SSDs -- however, a lot of the threads I found were years old, 2 or 3 or 7 or more years. Some threads say that recent Ubuntu distro's have things like trim + noatime built in, and take care of them automatically, so don't need the tweaks.


Solution 1:

Swap files versus swap partitions:

Swap partitions can be used by two or more Linux installations on the same PC (e.g. dual boot).

Swap partitions are better in case the disk gets full. Swap files are subject to fragmentation. Swap partitions are not.

Swap files can be better if you need to change the size of the swap capacity since it is easier to resize the swap file than it is to resize the swap partition.

Operationally, swap files will work as well as swap partitions if they are created on non-full disks to avoid fragmentation.

Generally speaking, modern Linux systems typically employ swap partitions since high capacity storage devices are quite inexpensive.

Solution 2:

  1. In 16.04.x LTS I would create a swap partition 1 GB or 2 GB, 'just in case' to avoid crashes in the few cases when the RAM is not enough. Edit: Set the swappiness value so it only swaps at the last second, as suggested by @AndroidDev (for example 10 instead of default 60) according to this link: How do I configure swappiness? | Ask Ubuntu

  2. The newest version of Lubuntu will create a swap file instead of a swap partition by default. But it is a short-life version, and I would recommend the LTS version. You can create a swapfile instead of a swap partition, if you wish, but I would not do it.

  3. I think TRIM is used automatically, when the drive is connected via SATA or eSATA, but maybe not via USB (unless built-in in the SSD itself).

    I am rather sure that you have to configure noatime yourself, but it is easy. You can also consider turning off journaling (which has both advantages and disadvantages). See this link: Final system tweaks / Installation / UEFI-and-BIOS | Ubuntu Community Help Wiki