Solution 1:

No

At first glance you cannot have too much swap because you can see swap as a way to increase RAM. Actually it doesn't increase RAM, it just pretends to: If you have 8 GB of real RAM and a swap space of, say, 24 GB configured, then your programs can allocate and use up to 8+24=32 GB of memory which sounds good at first.

But

If you run applications that either have memory leaks or aren't really made for running with 8 GB of memory (think of video editing, for example), then these applications will start to use that swap space, and swap is slow. The more swap space is actively in use by these applications, the more the system is busy with just moving memory around to and from the disk. This will drastically slow down the overall system's responsiveness and lead to a bad user experience.

Eventually -- when swap space is exhausted -- some applications will face an out-of-memory situation and be killed by the kernel's OOM_Killer.

From wiki:

The typical OOM case in modern computers happens when the operating system is unable to create any more virtual memory, because all of its potential backing devices have been filled.

Conclusion

Hence, one drawback of having too much swap space is: the more you have, the later this OOM situation occurs and the longer you will have to suffer from a lagging and unresponsive system.

Another apparent downside of course is wasting disk space but that might not be so important nowadays.

Solution 2:

There’s no direct drawback to large swap space. With the way it is managed by the kernel an increase of the amount of swap space above what is sufficient has no or a negligible impact on performance.

The only downside of “too much” swap space is that you can’t use that space for storage.

Solution 3:

You won't feel any other downsides other than less space on your disk, I think that nowadays the conception of 2x the amount of ram is outdated in the majority of systems. I usually recommend to use the same size of your ram for swap memory in laptops though in order to give you the opportunity to hibernate your pc without losing any data due to the volatile nature of RAM.

The only cases where I would consider using more than 1x the size of RAM for the swap partition is when you think you are going to upgrade your RAM size in a short time. Or if you plan to use a system where you will store in a sort of cache the amount of memory used by programs not used at the very same moment.

Hope my point was clear enough, and I repeat I don't think you will experience any problem for having too much swap memory.

Have a nice day!

Solution 4:

What is SWAP:

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.

Swap should equal 2x physical RAM.


Advantages:

Provides overflow space when your memory fills up completely Can move rarely-needed items away from your high-speed memory Allows you to hibernate

Disadvantages:

Takes up space on your hard drive as SWAP partitions do not resize dynamically Can increase wear and tear to your hard drive Does not necessarily improve performance (see below)


When SWAP Partitions "Don’t Help" as in "not worthy comparing to extra storage" :

If your Harddrive has only 5400 RPM and you have little RAM lets say > 2GB. Why ? Because the system constantly wanted to access the SWAP partition, it will eventually become very slow. Even though you now have space in the memory, everything in the SWAP partition need to be moved back over. Because the system will go slow, allot stays in the SWAP partition. This can only be fixed with a reboot. Which will take a while anyway because the system need to remove everything from the SWAP partition before shutting down.


**Conclussion: **

If you would like to be able to hibernate your computer, then you should have a SWAP partition. The size of this partition should be the size of your installed memory, plus an additional 10-25% to leave room for any items that were already moved over into the SWAP partition.

If you just want a small performance boost (and you have at least a 7200rpm hard drive), then you can add a SWAP partition if you want, but it’s not needed unless you have less than 4GB of installed memory. The size of this can be whatever you’d like. However I recommend 2x the RAM as a pinpoint. IF you have enoug storage space.

If you have a 5400rpm hard drive, then you shouldn’t create a SWAP partition simply because the bottleneck will make your computer worse off. However, if you absolutely want to have SWAP, then you can still create a partition using the same sizing guidelines outlined above – but change the swappiness value to something much lower.



My OPINION:

However in any case if you use Ubuntu as your Main OS for daily use I recommend 2x the size of the RAM. Because you don't install Ubuntu just because you have a old computer. But because you want to use the system as your Main OS.

Rather buy some extra hardware if needed instead of adjusting the system partitions to keep it running. If you buy a game you also make sure your system is "up to date" instead of adjusting the settings to make it "Playable".

You can better have some extra space, SWAP, speed, power instead of having too short or need to resize everything later on. Because you need SWAP or space, bought RAM? Or need to buy ram fast because one memory slot or stick broke.

Solution 5:

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