I just purchased a root server from a web hosting provider, where I installed Ubuntu 18.04 LTS.
My server has an HDD of 320 GB SAS and 8 GB of RAM, and would host a Twitter-like web application. What size would you suggest for a swap file? Would a swap file as big as the amount of RAM be too much? A more than one year old article from Digital Ocean says that "Generally, an amount equal to or double the amount of RAM on your system is a good starting point. Another good rule of thumb is that anything over 4G of swap is probably unnecessary if you are just using it as a RAM fallback". Of course, 16 GB seem too much. What is your opinion?

  • 2
    Happily, changing the size of your swapfile after install is pretty easy, so this is not a world-shaking decision for you. Go with what makes you comfortable, and adjust later if needed.
    – user535733
    Jan 6, 2020 at 15:25

1 Answer 1


The authoritative recommendation from Red Hat suggests 8GB of swap file for 8GB of RAM, which is pretty much netter than my opinion.

However, although you did not mention, if you are using Hibernation in Ubuntu, a swap partition equal to the amount of RAM is needed (op cit.).

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