Page 1 of 1

[Solved] swap on automatically?

Posted: Mon Dec 09, 2019 12:12 pm
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..

Re: swap on automatically?

Posted: Mon Dec 09, 2019 12:48 pm
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.

Re: swap on automatically?

Posted: Mon Dec 09, 2019 1:15 pm
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.

Re: swap on automatically?

Posted: Wed Dec 11, 2019 11:37 am
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(?)

Re: swap on automatically?

Posted: Wed Dec 11, 2019 11:40 am
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. :)