The officially official Devuan Forum!

You are not logged in.

#1 2023-01-07 14:37:28

Job
Member
Registered: 2019-03-13
Posts: 62  

[SOLVED] How to increase the SWAP partition

Hello good people of the forum,

This is something I have not done in my 20 years or so of using *NIX systems. I want to increase the swap partition. Looking around, I am suspecting this can be done with a live gparted session > delete current swap > create new space choosing "free space following" > make the new space created "linux-swap". Reboot the box.

If I keep the name of the new swap partition "/dev/sda5" I should be ok with fstab.

Any other pointers or corrections will be appreciated.

Regards.

Offline

#2 2023-01-07 15:55:50

rolfie
Member
Registered: 2017-11-25
Posts: 1,047  

Re: [SOLVED] How to increase the SWAP partition

You might need to look for the uuid instead of the device. Check your fstab.

Online

#3 2023-01-07 16:16:25

Job
Member
Registered: 2019-03-13
Posts: 62  

Re: [SOLVED] How to increase the SWAP partition

I saved that UUID info from fstab. Should that line change somehow? Unless if gparted change the UUID I should match the new output in fstab.

Offline

#4 2023-01-07 16:45:13

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] How to increase the SWAP partition

Job wrote:

Unless if gparted change the UUID

If you create a new swap partition it will have a different UUID.


Brianna Ghey — Rest In Power

Offline

#5 2023-01-07 16:48:02

aluma
Member
Registered: 2022-10-26
Posts: 522  

Re: [SOLVED] How to increase the SWAP partition

You don't have to delete the existing swap partition.
You just need to "move" the partitions in front of it, thus freeing up space for it.
Here ( https://dev1galaxy.org/viewtopic.php?pid=39531#p39531 ) I had to do it with the sda3 partition (sda2 and sda3 were the same size).
All UUIDs remain the same
5.jpg

Last edited by aluma (2023-01-07 16:50:42)

Offline

#6 2023-01-07 17:12:07

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] How to increase the SWAP partition

Or just make another swap partition and use both at the same time. Might be simpler.

EDIT: and faster, if they both have the same priority: https://tldp.org/HOWTO/Partition/setting_up_swap.html

Last edited by Head_on_a_Stick (2023-01-08 00:12:14)


Brianna Ghey — Rest In Power

Offline

#7 2023-01-08 07:26:12

aluma
Member
Registered: 2022-10-26
Posts: 522  

Re: [SOLVED] How to increase the SWAP partition

The question is in specific equipment and tasks, of course, and everyone chooses his own.

In my experience, with 4 GB of memory and normal user tasks, the swap has been empty for several years.
For tasks such as copying files that exceed the size of memory, the kernel, creating buffers, leaves approx. 100 MB without using swap.

Offline

#8 2023-01-08 12:06:07

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: [SOLVED] How to increase the SWAP partition

If the OP really is filling up their swap space then the real solution is to add more RAM. Adding more swap is just a work-around to help compensate for Linux's terrible OOM handling.


Brianna Ghey — Rest In Power

Offline

#9 2023-01-09 16:54:23

Job
Member
Registered: 2019-03-13
Posts: 62  

Re: [SOLVED] How to increase the SWAP partition

Success!!!

Gparted and I had to manually re-write fstab with new UUIDs.

Cheers.

Offline

#10 2023-01-10 11:11:37

Kelsoo
Member
Registered: 2016-12-09
Posts: 54  

Re: [SOLVED] How to increase the SWAP partition

Maybe of use to some here:

https://github.com/Tookmund/swapspace

This is a system daemon for the Linux kernel that eliminates the need for large, fixed swap partitions.

Usually when you install a GNU/Linux system, it sets up a swap partition on disk. The swap partition serves as virtual memory, so you may need a lot of it. But you can't store data there, so you don't want to sacrifice too much disk space. And it's not always easy, or safe, to change its size afterwards!

Running swapspace solves that problem. You no longer need a large swap partition. You can even do without the whole thing. The program manages swap files for you. These work just like partitions, except they're normal files. You can add more when you need them, or delete some when you want the disk space back. And that is exactly what swapspace does. It constantly monitors your system's virtual-memory needs and manages a pool of swap files accordingly.

With swapspace you can install GNU/Linux in one single big partition, without regrets later about picking the wrong size. Your system can handle the occasional memory-intensive task, without eating up disk space that you'll never get back.

Offline

#11 2023-01-10 20:51:36

Job
Member
Registered: 2019-03-13
Posts: 62  

Re: [SOLVED] How to increase the SWAP partition

I expanded swap on this box because every time the machine come back from hibernation it froze. Reading around it looks like swap has to be at least x2 the RAM. I have to say that seems to have solved that issue for me.

Kelsoo wrote:

Maybe of use to some here:

https://github.com/Tookmund/swapspace

This is a system daemon for the Linux kernel that eliminates the need for large, fixed swap partitions.

Usually when you install a GNU/Linux system, it sets up a swap partition on disk. The swap partition serves as virtual memory, so you may need a lot of it. But you can't store data there, so you don't want to sacrifice too much disk space. And it's not always easy, or safe, to change its size afterwards!

Running swapspace solves that problem. You no longer need a large swap partition. You can even do without the whole thing. The program manages swap files for you. These work just like partitions, except they're normal files. You can add more when you need them, or delete some when you want the disk space back. And that is exactly what swapspace does. It constantly monitors your system's virtual-memory needs and manages a pool of swap files accordingly.

With swapspace you can install GNU/Linux in one single big partition, without regrets later about picking the wrong size. Your system can handle the occasional memory-intensive task, without eating up disk space that you'll never get back.

Offline

#12 2023-01-10 21:45:39

MLEvD
Member
Registered: 2021-02-14
Posts: 140  

Re: [SOLVED] How to increase the SWAP partition

That's a myth about needing 2x ram of swap.

On the asus eee pc 701 with 493MiB of ram, It can hibernate comfortably* in 300MB of swap. Assuming you close your apps first big_smile

*about half the time, because voodoo

Offline

#13 2023-01-10 21:58:41

Job
Member
Registered: 2019-03-13
Posts: 62  

Re: [SOLVED] How to increase the SWAP partition

MLEvD wrote:

That's a myth about needing 2x ram of swap.

On the asus eee pc 701 with 493MiB of ram, It can hibernate comfortably* in 300MB of swap. Assuming you close your apps first big_smile

*about half the time, because voodoo

Maybe that is the problem. I always leave everything I am using open.

Offline

#14 2023-01-17 14:18:34

Job
Member
Registered: 2019-03-13
Posts: 62  

Re: [SOLVED] How to increase the SWAP partition

MLEvD,

I think this time tells a different story.

swap.png

Offline

Board footer