Setting up a second swap partition for Linux [2]

In the first post of this series several years ago, I wrote on how to add a second swap partition to increase the size of the swap space, by adding a second swap entry to the fstab file. This is very much the simplest way of increasing the swap space by using multiple disks, if the cheapest way to get the extra storage is to add another device alongside an existing one. However this has some drawbacks; the biggest issue is that hibernation will not work. This is because a specific partition has to be listed in the boot manager kernel parameters for the system to resume from, but Linux cannot be configured to store the hibernation file in a specific partition; it appears it is stored in the first available space within the swap space, so resume will fail if the hibernation data isn’t found.

It turns out however there is another option available for setting up swap that enables it to be put into a single partition that is spread across multiple physical disks (such as SSDs); this is the Logical Volume Manager (lvm), which is designed for this particular purpose and can also offer RAID functionality as an alternative to mdadm, although the latter is rather simpler to set up and configure. However, I was not able to make lvm work on my setup and so I had to revert to the previous configuration after breaking the lvm volume. This is the use of one physical device for swap and a second one for Gimp’s own swap. This means for this system I will need to buy a single larger SSD when the opportunity allows, and none of my systems will be configured with two SSDs for swap in future.