I installed Ubuntu on a 130 ssd and by default it only allocated one GB of swap space. I know swap space should be at least the size of your RAM so I would like to increase it. Instead of resizing I would like to make a new partition on my 1tb drive. I am wondering if this will hurt the performance of the swap space a lot or just a little because the additional space is on a hard drive and not SSD. Or if having multiple locations is a bad idea.

  • 1
    how much memory do you have?
    – rtaft
    May 26, 2018 at 14:42

1 Answer 1


In general this highly depends on your use case. E.g. if you do not make use of hibernate to disk (which uses swap to hibernate) you do not need that much amount of swap space and 1GB might be sufficient.

To come back to your question. If you are swapping a lot e.g. because you run low on memory all the time and you have one swap partition on a SSD and the other on a HDD, this will impact performance as the HDD will be the bottleneck in this scenario.
If you just want to add some more swap space for some corner cases to prevent the out-of-memory killer, you could add the swap space on your SSD with a higher priority compared to the swap partition on your HDD. That would result in that the swap on the SSD would get filled first, when the swap area on the SSD is exhausted the swap space on the HDD would be used additionally.

From man 2 swapon.

Swap pages are allocated from areas in priority order, highest priority first. For areas with different priorities, a higher-priority area is exhausted before using a lower-priority area. If two or more areas have the same priority, and it is the highest priority available, pages are allocated on a round-robin basis between them.

From man swapon:

priority is a value between -1 and 32767. Higher numbers indicate higher priority. See swapon(2) for a full description of swap priorities. Add pri=value to the option field of /etc/fstab for use with swapon -a. When no priority is defined, it defaults to -1.

To change the default priority of your swap partitions you would have to add/alter your /etc/fstab.

/dev/<swap-ssd> swap swap defaults,pri=1000     0 0
/dev/<swap-hdd> swap swap defaults              0 0
  • 6
    also, if you have 2 swap partitions of the same priority on different disks, kernel will stripe swapping to them. It is like raid0, with the performance boost.
    – xealits
    May 1, 2021 at 1:01
  • @xealits Cool, thank you for sharing that. Nov 8, 2021 at 18:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .