Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN] Swap partition - do I need it for SSD installation  (Read 2962 times)

Offline jsluk

  • User
  • Posts: 6
[EN] Swap partition - do I need it for SSD installation
« on: 2023/09/18, 16:22:28 »
Hi all,
Just got my Siduction installed and I am very impressed with what you all  have done.  I would like your opinion on swap partition because I did not install one and everything seems to be working fine for now.  I have 16 GB of DDR3 ram.  Should I modify my install and add swap?  Thanks.

Offline edlin

  • User
  • Posts: 548
Re: Swap partition - do I need it for SSD installation
« Reply #1 on: 2023/09/18, 16:36:36 »
It depends on how much RAM you have and what you want to do.
I have 32 GB of RAM installed and that is more than enough for everyday use. My swap partition will therefore probably never be used.
However, if I want to use Hibernate (suspend to disk), I need a swap partition that is slightly larger than the RAM; alternatively, I could also use a swap file - but it doesn't bring me any advantages. I would recommend creating a swap partition in any case. You can also do this afterwards. Just observe (e.g. with htop) how much RAM your system uses. If you want to use hibernate, then definitely create a swap partition.

edlin

Der Kluge lernt aus allem und von jedem,
der Normale aus seinen Erfahrungen
und der Dumme weiß alles besser.

Sokrates

Offline PhillyBass

  • User
  • Posts: 7
    • Flint Weller
Re: Swap partition - do I need it for SSD installation
« Reply #2 on: 2023/09/18, 16:55:15 »
It is a good idea to have some swap allocated, no matter how much physical RAM you have. RedHat recommends a swap size of least 20% of the RAM size https://www.redhat.com/en/blog/do-we-really-need-swap-modern-systems
I have had at least a few experiences where my Linux system ran out of physical RAM and didn't have a swap file.  When these events occurred, the system would not allow me close applications to free up space and I had to issue the kernel REISUB shutdown process.

Offline jsluk

  • User
  • Posts: 6
Re: Swap partition - do I need it for SSD installation
« Reply #3 on: 2023/09/18, 19:51:50 »
PhillyBass & edlin
Thank you so much for the reply.  I will follow your recommendation of adding a swap partition.  I did looked at HTOP and due to my usage, I consumed about 3 Gigs of the 16 that I have in RAM.  Swap reported 0K because I do not have swap.  Best regards.

Offline jsluk

  • User
  • Posts: 6
Re: Swap partition - do I need it for SSD installation
« Reply #4 on: 2023/09/23, 16:30:43 »
It is a good idea to have some swap allocated, no matter how much physical RAM you have. RedHat recommends a swap size of least 20% of the RAM size

Sorry, I have been away from my desktop.  I did a little research and others suggested that for SSD's, I should not use a swap partition.
Something about good for hard drive disks but not good for SSD.  I don't know enough about this issue.  Others recommend swap file for SSD's.  What are your recommendations?  Thanks.

Offline edlin

  • User
  • Posts: 548
Re: Swap partition - do I need it for SSD installation
« Reply #5 on: 2023/09/23, 17:10:47 »
There is no universal rule on how much RAM and swap are needed. It depends in particular on the use of the system whether and how much swap is needed.

If you use hibernation (suspend to disk), you should set up a little more than the physical RAM as swap.

I myself use 32 GB of physical RAM. However, it is never completely used by the system. I could do without swap altogether. But since I occasionally use hibernation, I have created a swap partition on an SSD. This is not a problem for the SSD because the swap partition is rarely used. A swap partition on a hard disk would no longer be fun for Hibernation, as it is much too slow. By the way, I have not yet lost an SSD because I used it too excessively.
I always advise using htop (or similar programmes) to observe the use of RAM. If you constantly use the RAM to full capacity and have to use the swap area, it is better to invest in more physical RAM.

Experience shows that most users never use the entire RAM. 16 GB is sufficient for everyday use.

edlin
« Last Edit: 2023/09/23, 17:15:36 by edlin »
Der Kluge lernt aus allem und von jedem,
der Normale aus seinen Erfahrungen
und der Dumme weiß alles besser.

Sokrates

Offline jsluk

  • User
  • Posts: 6
Re: Swap partition - do I need it for SSD installation
« Reply #6 on: 2023/09/23, 17:51:49 »
If you use hibernation (suspend to disk), you should set up a little more than the physical RAM as swap.
edlin

I have 16 Gigs of physical RAM.  Not sure I understand hibernation, but I set my computer to go blank screen (sleep? or hibernate?) after 15 minutes.  To activate the PC from this state, I either wiggle the mouse or I hit space bar or the Return key several times.  It is functioning properly even when I do not have swap.  I will study the manual to see if it shows how to add swap post install.  It cannot hurt.  Thanks.

Offline ro_sid

  • User
  • Posts: 228
Re: Swap partition - do I need it for SSD installation
« Reply #7 on: 2023/09/24, 01:14:10 »
I have 16 Gigs of physical RAM.  Not sure I understand hibernation, but I set my computer to go blank screen (sleep? or hibernate?) after 15 minutes.  To activate the PC from this state, I either wiggle the mouse or I hit space bar or the Return key several times.  It is functioning properly even when I do not have swap.  I will study the manual to see if it shows how to add swap post install.  It cannot hurt.  Thanks.

Well, sleeping often just means to blank the screen and put the CPU in a power-saving state. It stops and the system continues to run, when any external activity is detected (keyboard, mouse, and so on). That has nothing to do with disk-space, which is also true for suspend, which (mostly) means "suspend to ram". Here all activity is ceased, processes put on hold until wake-up, which often is more restricted than a simple mouse movement ((special) keys or (notebook-)lid). For both events, running out of power means the total loss of processes and results, and in the worst case filesystem corruption.
"Hibernation" (to disk, this is why you need the swap-space) is somewhat similar to suspend, but here, all data, RAM-content, and states are written out to the disk. Once done, you can (but do not have to :) ) remove all power from the system. Once restored, special actions like opening the lid, pressing a reserved key or the power (soft!) switch will wake up the system. When this is done, it will be in the same state that you left it in before hibernation.
Roughly speaking, you can suspend a system for hours, may be days until the battery is depleted, while a hibernated system can pause "indefinitely" without taking damage.