How big should swap partition be?

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
HappyLinux
Level 4
Level 4
Posts: 266
Joined: Wed May 30, 2012 3:48 am
Location: Earth

How big should swap partition be?

Post by HappyLinux » Wed Apr 06, 2016 8:41 am

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?
Dual-Boot Mint 17 64bit with Win8.1 64bit Update 1 at least
Core i5-4430 3GHz Quad-Core
8GB RAM
GeForce GTX 650 2GB
OnBoard Audio

Laurent85
Level 16
Level 16
Posts: 6011
Joined: Tue May 26, 2015 10:11 am

Re: How big should swap partition be?

Post by Laurent85 » Wed Apr 06, 2016 9:06 am

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.
Image

Mute Ant
Level 14
Level 14
Posts: 5135
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

Re: How big should swap partition be?

Post by Mute Ant » Wed Apr 06, 2016 9:10 am

"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.
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named "manual".

User avatar
xenopeek
Level 24
Level 24
Posts: 24018
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: How big should swap partition be?

Post by xenopeek » Wed Apr 06, 2016 9:23 am

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.
Image

HappyLinux
Level 4
Level 4
Posts: 266
Joined: Wed May 30, 2012 3:48 am
Location: Earth

Re: How big should swap partition be?

Post by HappyLinux » Wed Apr 06, 2016 1:44 pm

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?
Dual-Boot Mint 17 64bit with Win8.1 64bit Update 1 at least
Core i5-4430 3GHz Quad-Core
8GB RAM
GeForce GTX 650 2GB
OnBoard Audio

Laurent85
Level 16
Level 16
Posts: 6011
Joined: Tue May 26, 2015 10:11 am

Re: How big should swap partition be?

Post by Laurent85 » Wed Apr 06, 2016 1:57 pm

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.
Last edited by Laurent85 on Wed Apr 06, 2016 2:06 pm, edited 1 time in total.
Image

User avatar
LinuxJim
Level 5
Level 5
Posts: 659
Joined: Tue Jan 26, 2016 8:01 pm
Location: Oregon, USA

Re: How big should swap partition be?

Post by LinuxJim » Wed Apr 06, 2016 2:05 pm

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.

User avatar
xenopeek
Level 24
Level 24
Posts: 24018
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: How big should swap partition be?

Post by xenopeek » Wed Apr 06, 2016 2:28 pm

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!
Image

User avatar
LinuxJim
Level 5
Level 5
Posts: 659
Joined: Tue Jan 26, 2016 8:01 pm
Location: Oregon, USA

Re: How big should swap partition be?

Post by LinuxJim » Wed Apr 06, 2016 3:15 pm

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.

HappyLinux
Level 4
Level 4
Posts: 266
Joined: Wed May 30, 2012 3:48 am
Location: Earth

Re: How big should swap partition be?

Post by HappyLinux » Thu Apr 07, 2016 4:45 am

I'll just create a 2GB swap to please both camps and help me feel comfortable.
Dual-Boot Mint 17 64bit with Win8.1 64bit Update 1 at least
Core i5-4430 3GHz Quad-Core
8GB RAM
GeForce GTX 650 2GB
OnBoard Audio

Post Reply

Return to “Installation & Boot”