Is swap recommended for a 4gb ram pc?If yes what is the recommended size?

Loneranger

New Member
Joined
Jul 22, 2022
Messages
13
Reaction score
1
Credits
109
I have installed linux in my old pc.It has 4 gb ddr3 ram.Should i create a swap partition?I will be happy to know the recommended size.
 


kc1di

Well-Known Member
Joined
May 14, 2021
Messages
1,642
Reaction score
1,457
Credits
11,850
It depends which Distro are you using? If it's a laptop I would set aside about 2 to 4 gbs swap for suspend and hibernate if you use them. If not with most distros today there is little need for a separate swap partition. One of the old rules of thumb was a swap 1/2 the size of installed ram. Some Distro use swap files in the root / partition as a swap area.
 

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
9,114
Reaction score
7,735
Credits
74,416
I'd recommend it. I'd recommend it regardless of how much RAM you have. Swap isn't just some place the kernel stuffs things when the RAM is running out.

Code:
free -m
              total        used        free      shared  buff/cache   available
Mem:          15905       12964         756        1028        2185        1585
Swap:          2047        1769         278
 

osprey

Well-Known Member
Joined
Apr 15, 2022
Messages
691
Reaction score
574
Credits
6,441
What KGill says. "Old PC" suggests "old rule" which was 2xRAM for swap space. My view is to let the kernel have the room to be as efficient as possible. The kernel is generally smarter than the user. Increasing the RAM size itself is a great benefit to the computer, so I'd do that if possible ... and still run 2xRAM if I could, though in the past I've increased RAM but left the swap space as it was because it was inconvenient to increase it.
 

craigevil

Well-Known Member
Joined
Feb 24, 2021
Messages
420
Reaction score
419
Credits
2,896
Use zram instead of a swap file. It works much better on low-end hardware.
Code:
free
               total        used        free      shared  buff/cache   available
Mem:            3793        2122         697         312         973        1281
Swap:           4095        1056        3039
Total:          7889        3179        3737
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com


Latest posts

Top