Physics_Dude
Posts: 4
Joined: Fri Sep 28, 2012 3:19 pm

Increase size of existing swap file

Sat Jun 08, 2013 2:10 am

First of all I need to mention that my Pi is running off a mechanical HDD, not an SD card. So from this it is understandable that a larger swap file would be beneficial when the internal ram fills up.

The existing 100MB swap file at /var/swap is doing a good job, but I am in need of a bit more. Perhaps a Gig or two.

Does anyone have a few words on how I can go about doing this without causing to much trouble on the system?

User avatar
rpdom
Posts: 12511
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK

Re: Increase size of existing swap file

Sat Jun 08, 2013 5:26 am

Change the size in /etc/dphys-swapfile:

Code: Select all

CONF_SWAPFILE=100
man dphys-swapfile for details.

Physics_Dude
Posts: 4
Joined: Fri Sep 28, 2012 3:19 pm

Re: Increase size of existing swap file

Sat Jun 08, 2013 8:28 am

Code: Select all

$ free -m
             total       used       free     shared    buffers     cached
Mem:           485        141        344          0         10         63
-/+ buffers/cache:         66        419
Swap:         1023          0       1023
Thanks! :mrgreen:

Zeno
Posts: 3
Joined: Tue Jan 14, 2014 4:56 pm

Re: Increase size of existing swap file

Wed Feb 05, 2014 11:14 am

I think it should be CONF_SWAPSIZE
AFAIK CONF_SWAPFILE is for the swap location

User avatar
alexanderre
Posts: 17
Joined: Fri Mar 04, 2016 4:51 pm
Location: Kyiv, Ukraine
Contact: Facebook

Re: Increase size of existing swap file

Thu Feb 01, 2018 7:59 pm

exactly what I was looking for, thanks, guys :)

n67
Posts: 697
Joined: Mon Oct 30, 2017 4:55 pm

Re: Increase size of existing swap file

Thu Feb 01, 2018 9:29 pm

This is a good necro.

I've been wondering exactly this for awhile now - and may well have started a new thread about it had I not seen this one. Well done!

BTW, is there any way to make it use the new settings (after editing the config file) other than rebooting? I try to avoid rebooting if possible.
"L'enfer, c'est les autres"

User avatar
jostle
Posts: 16
Joined: Tue Mar 06, 2018 6:26 am

Re: Increase size of existing swap file

Tue Mar 06, 2018 6:43 am

@n67

You just need to run

Code: Select all

sudo dphys-swapfile setup
to update the settings changes.

Have Fun ...
Have Fun ...

User avatar
richlion2
Posts: 75
Joined: Thu Mar 29, 2018 7:14 am

Re: Increase size of existing swap file

Sun Apr 01, 2018 1:24 pm

Hello,

I just found this thread, as I need to inscrease my swap space. I am a bit confused, I am on a RPI 3 B+ with all the updates and when I run "top" is shows swap size is 1000 KiB. So the value in the file /etc/dphys-swapfile is in what if it is 100? I edited the file :
/etc/dphys-swapfile and changed from 100 to 200 and now "top" is showing 2048 MiB.

Thanks,
Richard
“It’s nice to be important, but it’s more important to be nice.” ;)

jahboater
Posts: 2656
Joined: Wed Feb 04, 2015 6:38 pm

Re: Increase size of existing swap file

Sun Apr 01, 2018 2:43 pm

I use

Code: Select all

sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start
"setup" doesn't work for me.

And "free -h" is a quicker way of checking things than top.

Return to “Beginners”

Who is online

Users browsing this forum: Bing [Bot], Douglas6, marciokoko and 52 guests