2

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.

karel
  • 122,292
  • 133
  • 301
  • 332
chriss
  • 132

4 Answers4

1

With Lubuntu 18.04, 2Gb and the zram „swap“ option (which is not actually a swap), I still avoid swapping to an actual SSD. Even in GIMP.

I also keep /tmp, /run and /var/log on ramdrives (tmpfs), and have ext2 (noatime, nodiratime) instead of ext4 in order to avoid constant journal updates.

But I can say I encounter the out-of-memory problems from time to time. Rarely, but they're happen.

This is my fstab:

UUID=blablabla   /         ext2    errors=remount-ro,noatime,nodiratime 0       1
#/swapfile       none      swap    sw                                   0       0
tmpfs            /tmp      tmpfs   rw,size=128m                         0       0
tmpfs            /run      tmpfs   rw                                   0       0
tmpfs            /var/log  tmpfs   rw,size=32m                          0       0
zx485
  • 2,865
NickDoom
  • 269
  • 2
  • 12
1
  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

sudodus
  • 47,684
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.

jones0610
  • 2,514
0

You've asked several questions.

Trim: You definitely want to have this enabled and operational. Trim support has been in Ubuntu for a while but depending on the SSD Manufacturer, it may or may not be enabled on your machine. This is simple to accomplish and there are a few very good answers on this site that address how to do it.

As a learning tool, installing Ubuntu on your old gear is a worthy project. However with only 2 GB RAM you will likely find the laptop(s) to be unacceptably pokey. Especially using Gimp which uses a lot of CPU and graphics power to render images.

Creating a swap partition on the SSD will provide better performance than doing so on a HDD. And with only 2 GB of RAM, you can expect a fair amount of swapping which, in itself, will adversely effect performance.

Your comment about RAM being "max'd out" implies that there is more on this laptop than just a sole instance of Lubuntu. Milking every possible cycle out of your equipment is a noble undertaking but if you are talking about a Hypervisor or other software / OS, you may be pushing this poor old laptop a bit too hard.

jones0610
  • 2,514