Why is the default swap size equal to RAM?

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
User avatar
Anton32828
Level 1
Level 1
Posts: 13
Joined: Sun Jun 07, 2020 1:36 am
Location: Orlando, FL

Why is the default swap size equal to RAM?

Post by Anton32828 »

For many years, the advice for installing Linux was to create a swap partition that was 2x the size of your RAM. I never fully understood this, but I did it because the gurus said to do it.

I’ve done two Linux Mint installations in the last week on old laptops that I’m re-purposing. I did another on a little network mini-pc. In all cases the automated installer program creates swap partitions equal to RAM (6 gigs on one laptop, 8 gigs each on the other machines).

Why has Linux Mint moved to this new partition philosophy? Can anyone comment?

Thank in advance!
LMDE, because I agree with Clem on Ubuntu snaps. I get a kick out of running Linux on minimalist hardware.
User avatar
Minty_64
Level 2
Level 2
Posts: 82
Joined: Mon Jun 30, 2014 3:18 am

Re: Why is the default swap size equal to RAM?

Post by Minty_64 »

as far as I know the rule of thumb was to make the swap size equal to the amount of ram you have as when your computer goes to sleep it puts all the information on the ram to the hard drive while this is not the only use for swap spaces that's my limited understanding of such.
User avatar
smurphos
Level 17
Level 17
Posts: 7332
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: Why is the default swap size equal to RAM?

Post by smurphos »

Anton32828 wrote:
Wed Jun 17, 2020 10:16 pm
I’ve done two Linux Mint installations in the last week on old laptops that I’m re-purposing.
Which version of Mint - the default behaviour for versions after 19.x is to create small swap file - no swap partition at all. Having a swap file or partition equal or greater to RAM is all about hibernation. Hibernation is disabled by default in Mint 19.x and later.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
Anton32828
Level 1
Level 1
Posts: 13
Joined: Sun Jun 07, 2020 1:36 am
Location: Orlando, FL

Re: Why is the default swap size equal to RAM?

Post by Anton32828 »

smurphos wrote:
Thu Jun 18, 2020 1:44 am
Which version of Mint - the default behaviour for versions after 19.x is to create small swap file - no swap partition at all. Having a swap file or partition equal or greater to RAM is all about hibernation. Hibernation is disabled by default in Mint 19.x and later.
Sorry, my mistake. I was playing around with two different distros and got confused.

Mint 19.3 Cinnamon did not install any swap.
LMDE 4 installed swap equal to RAM.

I assume the difference in behavior is due to the underlying Ubuntu or Debian installation utility.

As for the size of swap, the “1x RAM” rule makes sense for hibernation in an era of large and relatively inexpensive RAM. We can assume that disk space is not often used for “page fault” memory cache. I distinctly remember older SUSE and early Ubuntu installations recommending 2xRAM for swap, which makes sense if we consider a use case where the system has a big chunk of memory paged to disk, and needs to sleep without ending the current process: for example, in scientific programming of a math model on a machine with limited RAM.

This assumes that page files go to swap, which may not be correct.

Thanks all!
LMDE, because I agree with Clem on Ubuntu snaps. I get a kick out of running Linux on minimalist hardware.
Post Reply

Return to “Installation & Boot”