Views:
17,401β
Votes: 2β
Tags:
16.04
partitioning
ram
swap
disk-usage
Link:
π See Original Answer on Ask Ubuntu β§ π
URL:
https://askubuntu.com/q/1020960
Title:
Can you have too much swap?
ID:
/2018/04/01/Can-you-have-too-much-swap_
Created:
April 1, 2018
Edited: April 8, 2018
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
How much SWAP does hibernation really need?
Itβs a misconception that you need RAM x 2 for SWAP size when you use hibernation. The swap size needs to be the size of used RAM not Installed RAM. Generally swap size needs to be 2/5th of installed RAM. To find out the bare-minimum amount of RAM needed for use:
$ cat /sys/power/image_size
3153907712
On this 8 GB RAM machine 3 GB minimum is needed to hibernate.
You can tweak the values in image_size
for a smaller swap size with risk of failure. You can tweak it for a larger swap size and possibly speeding up the hibernation speed.
Reference: https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate
16 MB RAM in 1995, different rules for 16 GB RAM in 2018
In the days when you had 16 MB Ram, x 2 for 32 MB swap on your 720 MB hard drive made sense. A little RAM and HDD history in this 1995 Washington Post article.
23 years later some technical articles from that 1995 (although I didnβt find any) might be found to mislead new users. I did however find a 2007 article recommending SWAP = RAM x 2.
Back in 1995 32 MB Swap out of 760 MB HDD was 4% of HDD. Indeed the swap partition may have been used a lot in 1995. Today in 2018, 16 GB RAM x 2 for 32 GB SWAP on your 256 GB SSD doesnβt make the same sense as it is taking 13% of SSD. Today my 8 GB SWAP partition isnβt being used at all unless I force it to fill it up when testing OOM-Killer: Google Chrome will take up my memory to the point where it causes my computer to freeze to a near halt. What can I do to prevent this?.