{SOLVED} Swap - 4GB RAM, 32GB SSD

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
theeyan
Level 4
Level 4
Posts: 282
Joined: Sat Sep 20, 2014 3:27 pm

{SOLVED} Swap - 4GB RAM, 32GB SSD

Post by theeyan »

Hi to all,

Hope this is the right place to ask this question. I recently installed a 32GB SSD on my laptop. It also has 4GB RAM (system monitor says 3.7, but I'm guessing the additional 0.3GB are allocated to the graphics?).

I opted for a manual install and added 1.5GB of swap space. After testing my machine, the swap was sometimes used, but the data was measured in kb. Since the SSD is just 32GB, I was wondering if it would be okay for me to use Gparted and reduce the swap size to 500mb. If yes, will I be able to allocate the remaining 1GB to the main partition, or would I have to make a new partition (which wouldn't make much sense)?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
mintybits

Re: Extended-Swap - 4GB RAM, 32GB SSD

Post by mintybits »

3.7 = 4
On planet Geek.

There are two different counting systems in use in the computer world: human and geek. In human, G=1000^3. In geek, G=1024^3.

This causes much confusion and geek counting should be outlawed in Mint.
Some use notation Gi to inducate geek but as this is not universally enforced you really cant be sure what G means. Different apps use different counting systems and this is just stupid.

As for swap size, you have to be careful not to run out of ram space or your system will grind to a halt. The total of ram and swap need to be at least 4GB in my estimation for typical usage. So you are borderline. But if you have measured your swap usage and it remains below 500MB then you might be ok...but you probably wont be able to hibernate. Using gparted you can shrink and move swap to the right and then extend your root partition.
theeyan
Level 4
Level 4
Posts: 282
Joined: Sat Sep 20, 2014 3:27 pm

Re: Extended-Swap - 4GB RAM, 32GB SSD

Post by theeyan »

Thanks for the great explanation, and also for teaching me the basics of Geek. I appreciate the effort (-:

I am light user, doing just about everything online. 4GB of RAM should be more than enough for my needs. That being said, it is probably wiser to leave things as is, with 1.5GB of swap. If I ever do need the extra space I will just use an SD card, since there is a slot for it to begin with.

Cheers (-:
mintybits

Re: {SOLVED} Swap - 4GB RAM, 32GB SSD

Post by mintybits »

Pleasure. :)
Apologies to any geek reading this.
User avatar
Reorx
Level 12
Level 12
Posts: 4044
Joined: Tue Jul 07, 2009 7:14 pm
Location: SE Florida, USA

Re: {SOLVED} Swap - 4GB RAM, 32GB SSD

Post by Reorx »

You might want to consider decreasing your swappiness from the default of 60 down to 10 (if you haven't already).

If you run your laptop on battery - when your battery gets low enough, the laptop will hibernate. Your swap size has to be at least as large as your RAM size to hibernate and then un-hibernate successfully... If the laptop is always plugged in to the wall, then you can probably safely decrease your swap size.
Full time Linux Mint user since 2011 - Currently running LM21C on multiple Dell laptops - mostly Vostro models.

Image Image Image
theeyan
Level 4
Level 4
Posts: 282
Joined: Sat Sep 20, 2014 3:27 pm

Re: {SOLVED} Swap - 4GB RAM, 32GB SSD

Post by theeyan »

Oh, so for the laptop to hibernate I need to have 4GB of swap? Wow, I did not know that. I never really used the hibernate function. Just suspend.

As for swapiness, I read about it. Also read how some people put it on 25 or so. Is there a reason why swapiness is set to 60 if everbody recommends it should be on a much lower number?
niowluka

Re: {SOLVED} Swap - 4GB RAM, 32GB SSD

Post by niowluka »

theeyan wrote:Is there a reason why swapiness is set to 60 if everbody recommends it should be on a much lower number?
Not everybody recommends to lower it, for some people it's actually the higher values that improve performance. You can change that value at runtime, so experiment and pick whatever works best for you.
User avatar
Reorx
Level 12
Level 12
Posts: 4044
Joined: Tue Jul 07, 2009 7:14 pm
Location: SE Florida, USA

Re: {SOLVED} Swap - 4GB RAM, 32GB SSD

Post by Reorx »

theeyan wrote:Oh, so for the laptop to hibernate I need to have 4GB of swap? Wow, I did not know that. I never really used the hibernate function Just suspend.
If you are running a laptop and run on battery, there is a power management setting that defaults to hibernate the system when the battery gets critically low. If you don't run on battery and don't hibernate, you don't have to worry about the size of the swap partition other that for it's swap function.

(the process of hibernation writes the entire contents of the RAM space to the swap partition - if the partition is not large enough to hold the whole RAM space, the system will not be able to un-hibernate and restore the prior session... the process of suspending entails preserving the contents of RAM by not powering down RAM BUT the rest of the system IS powered down thus saving on power consumption. because the contents of RAM are not written anywhere during a suspend, swap size has no effect on suspend)
theeyan wrote:...Is there a reason why swapiness is set to 60 if everbody recommends it should be on a much lower number?
Yes there is a reason and everybody (who understands swappiness) does not recommend that it should be lower (for all users). I have read (I am no an authority on this) that servers can benefit from a swappines setting of 60. Desktop users can benefit from lower settings. The most common recommendation I have seen for desktop (and laptop) systems are based on the RAM space but typically are around a swappiness of 10. The reason I recommended lowering your swappiness is that it will cause you to use swap less which might help you get away with a smaller swap partition...
Full time Linux Mint user since 2011 - Currently running LM21C on multiple Dell laptops - mostly Vostro models.

Image Image Image
theeyan
Level 4
Level 4
Posts: 282
Joined: Sat Sep 20, 2014 3:27 pm

Re: {SOLVED} Swap - 4GB RAM, 32GB SSD

Post by theeyan »

(the process of hibernation writes the entire contents of the RAM space to the swap partition - if the partition is not large enough to hold the whole RAM space, the system will not be able to un-hibernate and restore the prior session... the process of suspending entails preserving the contents of RAM by not powering down RAM BUT the rest of the system IS powered down thus saving on power consumption. because the contents of RAM are not written anywhere during a suspend, swap size has no effect on suspend)

Very interesting. About "preserving the contents of RAM", does that mean only what is being currently used by RAM? So if I have 4gb RAM, but the system is using only 500mb prior to hibernation, will I still be able to hibernate it with the current 1.5GB od Swap?

As for swapiness. I understand it now. My mistake was to think that only regular users use Linux, while the truth is that the bigger part of Linux users are actually servers.
niowluka

Re: {SOLVED} Swap - 4GB RAM, 32GB SSD

Post by niowluka »

theeyan wrote:(the process of hibernation writes the entire contents of the RAM space to the swap partition - if the partition is not large enough to hold the whole RAM space, the system will not be able to un-hibernate and restore the prior session... the process of suspending entails preserving the contents of RAM by not powering down RAM BUT the rest of the system IS powered down thus saving on power consumption. because the contents of RAM are not written anywhere during a suspend, swap size has no effect on suspend)

Very interesting. About "preserving the contents of RAM", does that mean only what is being currently used by RAM? So if I have 4gb RAM, but the system is using only 500mb prior to hibernation, will I still be able to hibernate it with the current 1.5GB od Swap?
https://wiki.archlinux.org/index.php/Su ... Ffile_size

You can always create a swap file, e.g. on / (root), and suspend to that.
Locked

Return to “Beginner Questions”