0

Currently I have laptop with 16GB of RAM and 512GB SSD. I always use "full encrypted disk" option in installation creator which automatically create 16GB swap partition. Now I want to buy laptop with 32GB of RAM and I guess creator will try to make 32GB swap partition. Do I really need such big partition for occasional hibernation? I mean, does it really dump whole 32GB into swap or only real used memory which often will be much much less? Can I reduce swap partition size after installation? I have also vm.swappiness=1 instead of default 60

I'm reading that ubuntu 18.04 has option for swap file instead of partition so maybe I should wait for KDE Neon LTS based on 18.04 (current release which I'm using, is still on 16.04)

Dibo
  • 143

2 Answers2

0

The answer depends on what exactly you want to gain from having swap?

  • Improve performance in general case - then swap will not help. Even 16Gb of memory is more than enough to run any Linux with any typical workload. You swap will not be used at all.
  • Improve performance when working with extra large files with application that is not designed to handle them - again, swap on a typical disk will not help. It is too slow to allow working on data from swap, even with SSD. Special extra-fast storage devices are used in this case.
  • Allow for hybernation - if you want hybernation to work, your swap must be larger than the memory, no matter if memory is 16Gb or 512Gb.
  • Do kernel debugging - some of development tasks require swap, but I can not tell you the details.

Do not mix PC sleep and PC hybernation. Sleep needs no swap, is fast to start, but drains battery a little. Hybernation requires huge swap, is slow to go into and start from, but you can disconnect your battery and put you notebook on the shelf for a year in the meantime. What happens when you close the lid depends on settings, but going straight to hybernation every time is not a good idea.

0

Heres is almost the same question which may help you: I have 16GB RAM. Do I need 32GB swap?

But I can recommend you if you plan to use the hibernation to set your SWAP with the size of the RAM + 4GB or 20% of the RAM in case of almost full RAM and start to hibernate. Else set the SWAP to be 20% of the RAM.

Stefan
  • 399