Swap partition isn't enabled?

Hello everyone. I’m having an issue with my RAM. I only had 4GB of RAM (as of yesterday I now have 6GB) and it would just freeze up sometimes. I found the problem and I tried what I know to fix it without success. This is the output from a terminal from shortly after startup.

$ swapon -s
$ sudo swapon /dev/sda2
[sudo] password for arkansawdave: 
$ swapon -s
Filename				Type		Size	Used	Priority
/dev/sda2                              	partition	167772120-2

and here is my inxi

(Sorry, inxi deleted because I’m not allowed to share links. Yeah I know it’s not a link, but the new forum doesn’t.)

I tried adding that swapon command to the Xfce Session and Startup list and I just tried it with a sleep added.

    sleep 10 ; swapon /dev/sda2

Still swap doesn’t enable on reboot. Could someone give me a hand with this, please?

Thanks…

Can you post the contents of /etc/fstab please?

1 Like

Use /etc/fstab for this. You just need to add none swap defaults 0 0 roughly.
Ex:

UUID=THE_UUID none swap defaults 0 0

https://wiki.archlinux.org/index.php/Swap#Swap_partition

1 Like

Here’s my fstab.

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=221e96de-3a51-4e04-b0e4-6337ae92b4e9 /              ext4    defaults,noatime 0 1
UUID=f0edad23-06a5-4ce9-9476-10b24a2f1e07 /home          ext4    defaults,noatime 0 2

Did I maybe forget to set the swap mount point when I installed?

Yes, you should add a record for your swap partition, as per @cscs’ example.

2 Likes

Once you have done that you may wish to tune your swappiness to something like 10.
Also cache pressure …
Actually there is a script to automate some of those things if you like:

Thanks, I will set swappiness if it gives me any trouble, but they made some change about a year and a half ago that made the memory function a lot better and I haven’t had issue with the way it’s handled now. But if I do, I do know how. Thx, Guys.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.