Multiple SWAP partitionsPosted: 2020-12-05
Whenever I do an install, I always create a swap partition. But how about, if I have several hard disk and I am not sure which one would be best? Or if I do not want to waste too much space of a single hard disk? Or just because.
I came across this howto, explaining that having multiple SWAP partitions are, indeed, possible. There’s also info in the excellent Arch Linux wiki. In my case, I have two physical hard disks with swap partitions on
sda4 (4 GB) and
sdb2 (5 GB). I added them to
/etc/fstab as follows:
/dev/sda4 swap swap defaults 0 0 /dev/sdb2 swap swap defaults 0 0
Now, when I run htop, the computer reports that it has 9 GB of swap. As explained in the first link, it is possible to assign priority by
pri= option, but I left it as it is. In this way, they will be written as kind of a RAID. Seems that the
sw option mentioned there is kinda redundant.