Is it possible to resize the swap partition?

Open Development of Android, dual-booting other Linux OS and other hacks
Post Reply
dougeeebear
Archos Expert
Archos Expert
Posts: 170
Joined: Mon Apr 18, 2011 1:07 am
Location: Mid-South, USA

Is it possible to resize the swap partition?

Post by dougeeebear »

I have implemented Harfainx's [GUIDE] Change app space with stock ROM (it's awesome, by the way), and now I'm thinking with the limited ram on the Gen8, why wouldn't a similar procedure work for increasing the size of the swap partition?

I've checked the xda-developers forum, and about all I can find is how to set up a swapfile on the sd-card.
Apparently the performance is greatly improved with the swapfile, but I would rather have a larger swap partition.

I'm sure this would work by creating a partition for swap at the same time as creating the increased app space partition (create two partitions).
It would basically involve creating the partition and editing init.rc to point to the new swap partition (I don't know what line to edit for the swap).

This is my thinking, anyway.

Anyone have any thoughts on this?
A43IT / A70IT / A101IT
jfmcbrayer
Archos User
Archos User
Posts: 104
Joined: Wed Jan 26, 2011 3:21 pm

Re: Is it possible to resize the swap partition?

Post by jfmcbrayer »

I think you're right that the process should be similar to resizing the app partition. I haven't looked, but you'll want to look for a 'swapon' line in init.rc, I guess.

I kind of think it might not be worth it, depending on your usage, though. More swap will let you keep more apps open, so you have less of a hit when you switch back to them, but at the cost of slowing everything down, and the occasional near-lockup when everything gets bottlenecked on swap.
dougeeebear
Archos Expert
Archos Expert
Posts: 170
Joined: Mon Apr 18, 2011 1:07 am
Location: Mid-South, USA

Re: Is it possible to resize the swap partition?

Post by dougeeebear »

There is this line in init.rc

Code: Select all

on property:persist.sys.archos.swapctl.en=1
exec /system/bin/logwrapper /usr/bin/swap_ctl.sh start

There is this line in /usr/bin/swap_ctl.sh

Code: Select all

LOCAL_SWAP=/dev/block/mmcblk0p3

It may just be a matter of editing the line in swap_ctl.sh to point to /dev/block/mmcblk1p3 (to be determined).

My wife's 101 has a gazillion games on it, and after awhile the launcher will take forever to redraw all the icons.

I've tried this workaround
http://www.launcherpro.com/forum/viewto ... f=6&t=2652
but not much joy.

zeppelinrox's V6 Supercharger
http://forum.xda-developers.com/showthread.php?t=991276
doesn't really appeal to me at this time.

I may just experiment with this on my 43 and see what happens.

I think 512MB swap space should be more than sufficient.
A43IT / A70IT / A101IT
dougeeebear
Archos Expert
Archos Expert
Posts: 170
Joined: Mon Apr 18, 2011 1:07 am
Location: Mid-South, USA

Re: Is it possible to resize the swap partition?

Post by dougeeebear »

I added a new swap partition keeping the resized app partition intact, but now I find I'm not allowed to edit or change permissions on /usr/bin/swap_ctl.sh

Also, I wasn't sure if the swap partition should be logical or primary.
I chose logical, which may or may not be correct.

Back to the drawing board.
A43IT / A70IT / A101IT
jfmcbrayer
Archos User
Archos User
Posts: 104
Joined: Wed Jan 26, 2011 3:21 pm

Re: Is it possible to resize the swap partition?

Post by jfmcbrayer »

dougeeebear wrote:I added a new swap partition keeping the resized app partition intact, but now I find I'm not allowed to edit or change permissions on /usr/bin/swap_ctl.sh


I assume you've tried all the usual methods (copy as root to sdcard, edit, copy back as root), adb pull/edit/push, or edit with vi as root in a terminal? That's strange, because I was able to edit it (added a comment) with vi. Are you using Chulri's +rw root?

dougeeebear wrote:
Also, I wasn't sure if the swap partition should be logical or primary.
I chose logical, which may or may not be correct.


It doesn't matter whether it's logical or primary, though that may affect the naming (numbering) of the device. To be honest, it wouldn't even matter if it were a file; on Linux 2.6 an (unfragmented) swap file is almost exactly the same speed as a swap partition.
dougeeebear
Archos Expert
Archos Expert
Posts: 170
Joined: Mon Apr 18, 2011 1:07 am
Location: Mid-South, USA

Re: Is it possible to resize the swap partition?

Post by dougeeebear »

jfmcbrayer wrote:I assume you've tried all the usual methods (copy as root to sdcard, edit, copy back as root), adb pull/edit/push, or edit with vi as root in a terminal? That's strange, because I was able to edit it (added a comment) with vi. Are you using Chulri's +rw root?

I couldn't edit it with the swap partition created, why I don't know.
I have since redone it back to the way it was and now I can edit it.
And yes, I am using Chulri's +rw root.

It doesn't matter whether it's logical or primary
Ok, thanks.

I'll get back to it sometime later.
A43IT / A70IT / A101IT
Post Reply

Return to “Gen8 Hacking and Open Development”