Page 1 of 1

How big should swap partition be?

Posted: Wed Apr 06, 2016 8:41 am
by HappyLinux
I'll be building my new computer this weekend. A dual-boot between Windows 10 and Ubuntu 15.10. Ubuntu is only temporary until Mint 18 comes out.

When I come to install Linux on this system, how big should I make the swap partition?

The Hard drive is 1TB in size.
The physical memory is 16GB.

In my current system which has 8GB of physical memory, I set the swap to equal it at 8GB.

I don't use sleep or hibernate in dual-boot setups, whether in Windows or Linux. If it's a single operating system running on a computer, then yes.

How big do you think I should set it as?

Re: How big should swap partition be?

Posted: Wed Apr 06, 2016 9:06 am
by Laurent85
Sleep mode doesn't use swap. If you don't plan to use hibernation a few gig should suffice, say 2 gig. You may also change the swappiness to 10.

If using hibernation set swap size to ram size + 1 GB.

Re: How big should swap partition be?

Posted: Wed Apr 06, 2016 9:10 am
by Mute Ant
"I don't use sleep or hibernate" Nothing then. If 16GiB genuinely needs to swap you can add a swap-file such as Windows uses, but I doubt you will ever need it.

Re: How big should swap partition be?

Posted: Wed Apr 06, 2016 9:23 am
by xenopeek
The Ubuntu Swap FAQ gives some info on what swap would be used for and how much you'd need: https://help.ubuntu.com/community/SwapF ... ed_swap.3F. In your case, 4 GB swap would suffice.

Personally with 16 GB RAM and not using hibernate, I've installed with no swap at all. I've not seen any issue and regularly run very big programs (most of the day I have 4 to 6 virtual machines running, a few web browsers, a few media players, some LibreOffice applications and general text editors and terminals). I'm not convinced swap would do anything for me.

Re: How big should swap partition be?

Posted: Wed Apr 06, 2016 1:44 pm
by HappyLinux
When I was starting out with Linux, I was told to always setup a swap partition otherwise it would cause problem when running Linux.

If you're all basically saying that because I will have 16GB of memory, I either don't need a swap partition, or a small one at 2GB.

Shall I just create a swap partition of 2GB as a precaution?

Re: How big should swap partition be?

Posted: Wed Apr 06, 2016 1:57 pm
by Laurent85
No. As Mute Ant said you can later on create a swap file if needed. I personally have no swap set on a 8GB ram laptop running Cinnamon for months without issue. But as a general rule it is still recommended to configure a swap. I would then recommend to customize the swappiness to a law value.

Re: How big should swap partition be?

Posted: Wed Apr 06, 2016 2:05 pm
by LinuxJim
HappyLinux wrote:When I was starting out with Linux, I was told to always setup a swap partition otherwise it would cause problem when running Linux.
It will cause problems - if you run out of memory. The general consensus is that you are unlikely to run out of memory with 16GB.

Performance will be a little better without a swap file, but you do risk a crash & burn if you fill up the entire 16GB of RAM.

An 8-16GB swap file on a 1TB drive is almost invisible - and you can tune the performance with the swappiness parameter.

Re: How big should swap partition be?

Posted: Wed Apr 06, 2016 2:28 pm
by xenopeek
I ran Linux for years on 2 GB RAM with no swap. No problems that I can recall. One would suspect there is something like a swap maffia; you better set up some swap, who knows what could happen if you didn't!

Re: How big should swap partition be?

Posted: Wed Apr 06, 2016 3:15 pm
by LinuxJim
xenopeek wrote:I ran Linux for years on 2 GB RAM with no swap. No problems that I can recall. One would suspect there is something like a swap maffia; you better set up some swap, who knows what could happen if you didn't!
Nah, it's not that bad. ;)

If you don't push the limits, it's a non-issue.

Re: How big should swap partition be?

Posted: Thu Apr 07, 2016 4:45 am
by HappyLinux
I'll just create a 2GB swap to please both camps and help me feel comfortable.