14

I am new to Linux and want to install ubuntu on a computer that has 32GB of RAM. I've read a lot about the recommended size of swap for people with much smaller RAM capacity, but nothing for my size. Can anyone help me? Thank you, I really appreciate your time!

Thanks for all the input. I think I have a better understanding of this issue regarding swap. Some of the answers to my question said it depended also on other specifications as well. I have 32GB of RAM as stated above, a 1TB SSD(main drive), and a 2TB regular hard drive, and an i7 CPU. I only do every day tasks, no server or rendering. At this point I think I will refrain from using hibernation.

linuxnewbe
  • 143
  • 1
  • 1
  • 6

4 Answers4

12

If you want hibernation to work, it has to save everything in RAM to swap space so that it can be restored when the computer is turned on again, so you'd need at least 32 GB of swap space.

If you don't care about hibernation, unless you plan to use more than 32 GB on a regular basis, a small amount like 4 GB or 8 GB would be fine for now. Swap space can be resized later.

Olathe
  • 4,310
  • 2
  • 19
  • 24
11

Quoting from Centos,

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.

If you're using Ubuntu as your primary OS and have 32GB, you need little to no swap space if you use Ubuntu for normal day-to-day tasks and not big rendering, server running, etc.

The reason why you've read about using swap space for lower levels of RAM is because in that case, swap space is used to fill in for the lack of RAM that they have. In your case with 32GB, and assuming that you're not using Ubuntu for really resource-heavy tasks, I would recommend 4 GB to 8 GB.

TheOdd
  • 3,012
7

The answer depends on the usage of your computer and the size of the hard disk:

  1. Usage: it should be at minimum the size of the RAM, if you use hibernation.
  2. Disk size: this is the How much you can afford from hard disk without annoying yourself with "out of storage space". In your case, I guess that you having a 1TB as Hard Disk size. So, a 32BG swap is not that big deal.

To resume:

  • if you use hibernation: 1*RAM<= swap size <= 2*RAM (32GB..64GB)
  • if not: SQRT(RAM) <= swap size <= 2*RAM (6GB..64GB)

For more information check : https://help.ubuntu.com/community/SwapFaq#How_much_swap_do_I_need.3F

5

If you want to use suspend-to-disk, you need 34GB swap. If not, you not need swap space.