Welcome! Log In Create A New Profile

Advanced

speed up system by changing swap to another USB drive?

Posted by asterix 
speed up system by changing swap to another USB drive?
October 29, 2016 09:24PM
pogoplug RAM just 128mb/256mb, I also set swap on same USB drive. system is running slow and writing is very frequent. It's possible to speed up system by changing swap to another USB drive?



Edited 1 time(s). Last edit at 10/29/2016 09:27PM by asterix.
Re: speed up system by changing swap to another USB drive?
October 30, 2016 01:40AM
It's probably easiest to just create a swap file on another drive; there's no need to use an entire partition. I have mine on a 4TB hard drive that gets mounted to /media/WD4TB on my Dockstar. Here's how I did it:

Create a 1GB file filled with zeroes (probably overkill on the size, but I have plenty of space):
dd if=/dev/zero of=/media/WD4TB/swapfile bs=1k count=1M
Mark the file as swap space:
mkswap /media/WD4TB/swapfile
Test it:
swapon /media/WD4TB/swapfile
swapon -s
Output of swapon -s:
Filename                                Type            Size    Used    Priority
/media/WD4TB/swapfile                   file            1048572 268180  -1
To have it mounted at boot, add the following to the end of your /etc/fstab file:
/media/WD4TB/swapfile none swap sw 0 0
Make sure you remove or comment out any other reference to a swap partition in fstab. Once you reboot, issue the swapon -s command again to ensure it's being used or check the output of dmesg:
dmesg | grep swap
[   40.376362] Adding 1048572k swap on /media/WD4TB/swapfile.  Priority:-1 extents:9 across:1236992k FS

I am far from an expert, so if anyone sees any issues with this please let me know.

-JT
Re: speed up system by changing swap to another USB drive?
October 30, 2016 02:31AM
What are you running that eats all of 256 MB of ram ?
Re: speed up system by changing swap to another USB drive?
October 30, 2016 02:39AM
asterix Wrote:
-------------------------------------------------------
> pogoplug RAM just 128mb/256mb, I also set swap on
> same USB drive. system is running slow and writing
> is very frequent. It's possible to speed up system
> by changing swap to another USB drive?

Yes. It'll help a lot to create a swap file on another drive if you need to use swap that much.

But also use zswap to make it much better. Add this to the bootargs to activate zswap in the current kernel 4.8.3
zswap.enabled=1
You will see a big difference with zswap in your use case.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 10/30/2016 02:41AM by bodhi.
Re: speed up system by changing swap to another USB drive?
October 30, 2016 01:26PM
Thanks renojim! I have tried whole USB drive as swap, will try just a file later.

renojim Wrote:
-------------------------------------------------------
> It's probably easiest to just create a swap file
> on another drive; there's no need to use an entire
> partition. I have mine on a 4TB hard drive that
> gets mounted to /media/WD4TB on my Dockstar.
> Here's how I did it:
>
> Create a 1GB file filled with zeroes (probably
> overkill on the size, but I have plenty of
> space):
>



Edited 1 time(s). Last edit at 10/30/2016 01:27PM by asterix.
Re: speed up system by changing swap to another USB drive?
October 30, 2016 01:28PM
jessie+freepbx, E02 runs out 256MB often.

jst818 Wrote:
-------------------------------------------------------
> What are you running that eats all of 256 MB of
> ram ?
Re: speed up system by changing swap to another USB drive?
October 30, 2016 01:35PM
bodhi Wrote:
-------------------------------------------------------
> asterix Wrote:
> --------------------------------------------------
> -----
> > pogoplug RAM just 128mb/256mb, I also set swap
> on
> > same USB drive. system is running slow and
> writing
> > is very frequent. It's possible to speed up
> system
> > by changing swap to another USB drive?
>
> Yes. It'll help a lot to create a swap file on
> another drive if you need to use swap that much.
>
> But also use zswap to make it much better. Add
> this to the bootargs to activate zswap in the
> current kernel 4.8.3
>
> zswap.enabled=1
>
> You will see a big difference with zswap in your
> use case.

Very helpful, the system obviously runs faster, especially open web, but it's interesting pogoplug mount swap USB drive as "sda" first, so need to correct it in /etc/fstab.

Mine is E02 with 256MB ram, so highly recommended for others with 128MB.

I will try it later on my dockstar
Re: speed up system by changing swap to another USB drive?
October 30, 2016 04:02PM
asterix

> Very helpful, the system obviously runs faster,
> especially open web, but it's interesting pogoplug
> mount swap USB drive as "sda" first, so need to
> correct it in /etc/fstab.

In a multiple drive cofiguration like this, it's best to have 2 swap files. One in fstab as a default, in case the other drive is not mounted. The real swap file is on the 2nd USB drive and mount it in /etc/rc.local:
swapoff -a
swapon ....

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: