[Solved] swap on automatically?

Forum rules
Before you post please read this
Post Reply
catch22
Level 3
Level 3
Posts: 182
Joined: Mon Oct 01, 2012 7:50 am
Location: Belgium
Contact:

[Solved] swap on automatically?

Post by catch22 »

Attached is a screenshot - it shows that the swap partition doesn't have a lock-symbol next to it.
So I right-click it and select swapon, which I presume is correct.

Undoubtedly there should be a more efficient way to have the swap act as swap automatically upon booting, but how can I get it to do so?

A side question, now I'm at it - is there a point in making the swap partition (a lot) larger than 1,5 times the RAM, say ten times or so, or completely pointless (or not good practice, even?)
It's a very old slow machine..
Attachments
swapon_GParted.png
Last edited by catch22 on Wed Dec 11, 2019 12:04 pm, edited 1 time in total.
done with distro-hopping! Linux Mint desktop / Bunsen Labs netbook

jjp2145-oldtimer
Level 1
Level 1
Posts: 30
Joined: Wed Oct 02, 2019 11:43 am

Re: swap on automatically?

Post by jjp2145-oldtimer »

(1) Run

Code: Select all

blkid
to get the UUID for the swap partition.

(2) Run

Code: Select all

 xed admin:///etc/fstab
Then add a line to your fstab that looks like this:

Code: Select all

UUID="Long hex string you found in the last step" none swap sw 0 0 


(3) Save and reboot. Open the terminal and run

Code: Select all

swapon --show
to make sure it worked.

Edit sorry, I don't know why I originally typed that with backslashes instead of slashes.

gm10
Level 20
Level 20
Posts: 10999
Joined: Thu Jun 21, 2018 5:11 pm

Re: swap on automatically?

Post by gm10 »

While that will work (the blkid might need a sudo first), the no doubt safer way would be via the Disks tool. Click on the swap partition, click on the cogs icon below it, select Edit Mount Options... and make it look exactly like this (just with your UUID selected from the dropdown):

Image

I'll note that LM 19.x installs with a swap file by default, but OP didn't share what OS they are actually running.
Tune up your LM 19+: ppa:gm10/linuxmint-tools

catch22
Level 3
Level 3
Posts: 182
Joined: Mon Oct 01, 2012 7:50 am
Location: Belgium
Contact:

Re: swap on automatically?

Post by catch22 »

gm10 wrote:
Mon Dec 09, 2019 1:15 pm
I'll note that LM 19.x installs with a swap file by default, but OP didn't share what OS they are actually running.
Thank you both for the info.
The Disk tool change solved it :)

As for my OS-information, it is LMint 19.2 Cinnamon 64-bit.
Why there was no swap with the install? No idea..
The LMint was installed after Haiku BeOS, but that couldn't have been of influence, I think(?)
done with distro-hopping! Linux Mint desktop / Bunsen Labs netbook

gm10
Level 20
Level 20
Posts: 10999
Joined: Thu Jun 21, 2018 5:11 pm

Re: swap on automatically?

Post by gm10 »

catch22 wrote:
Wed Dec 11, 2019 11:37 am
Why there was no swap with the install? No idea..
The LMint was installed after Haiku BeOS, but that couldn't have been of influence, I think(?)
If your swap partition already existed as you installed it, then swap file creation would have been skipped in favour of the existing swap partition. But why it was not getting mounted automatically I do not know - I cannot think of anything outside of user intervention (i.e. you changed it intentionally or accidentally). No big deal since you've got it working now. :)
Tune up your LM 19+: ppa:gm10/linuxmint-tools

Post Reply

Return to “Mounting Partitions”