• We did not send an email asking for donations - please read this post.

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,278
Reaction score
1,064
Credits
9,177
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
7,381
Reaction score
6,371
Credits
59,820
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

Active Member
Joined
Apr 15, 2022
Messages
259
Reaction score
159
Credits
2,382
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
396
Reaction score
390
Credits
2,739
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
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top