[SCRIPT][UPDATED 01.26.14] Enable Ram Swap & Create a Swap File with |=~>SwapItOn<~=|

AlphaUMi

Member
May 24, 2014
38
9
0
127.0.0.1
I have a problem with the script. My prerequisites are:

- Huawei Ascend Y300 with stock Android 4.1.1 Jellybean
- Root access
- Busybox 1.22.1
- Init.d support

When the script performs its checks it stats everything is OK (and additionally in Terminal when I type "cat /proc/cpuinfo" under features I read "swp"), and the installation competes successfully. I choose "no" when asked to set minfree values since I have SuperCharger too.

This is the log after a reboot:

Code:
swapon: invalid option -- p
BusyBox v1.22.1-Stericson (2014-01-25 17:27:18 CET) multi-call binary.

Usage: swapon [-a] [DEVICE]

Start swapping on DEVICE

	-a	Start swapping on all swap devices

/system/etc/init.d/Z99SwapOn[82]: cat: /proc/swaps: No such file or directory
Problem is, I don't have a swap directory in /proc and I am unable to write to that folder and create one. I set permissions with my File Manager, and it seems ok, but cannot write to that folder. I tried to use chmod and mkdir with terminal, but I receive an error stating "no such file or directory".

Please, what can I do to make this script to work?
 

Zeuszoos

Senior Member
Aug 9, 2012
1,065
205
93
:laugh::cool::p:victory::D;)
Defiant07,

Okay, I am trying to figure all of this out.

Goal: Swap File on External SD Card

Device: Samsung Galaxy (SGH-M819N) Mega 6.3"
KitKat 4.4.4, Rooted, PhilZ/CWM Rec 6.59.0/6.0.5.1

I am also using "Universal Init.d

My phone currently uses a Swap of 1 GB at /dev/block/vnswap0

I would like to get rid of that and use just one single swap located at:

/storage/extSdCard (that's how the path shows, exactly)

I can use either a script, or a flashable, but I am not an expert and I am getting confused. For example, you talk about "configuring it". But I've never seen a script install, nor flashed a Zip and had it ask me about options settings.

I'm obviously missing something simple here. Could you please take pity on the stupid here and help me out a bit more to accomplish this goal? I have literally spent the last week on this and no matter what I have tried, I still get the same result (above) when I type "free" in terminal. Same size and location for swap. My device does support swap, obviously.

I really want to get this done, as my External SD is way faster than my Internal Storage and if swapping wears out my storage faster, it's a lot easier to replace an SD Card, than to replace your phone (especially when you can't afford a new phone)!

I appreciate your time! I'll do whatever you tell me and write things down for future reference. I can understand, once I'm given a bit of "talk to me like I'm 6" help one time. <lol>

Just FYI, I've even tried a bunch of different apps (Swapper2, et al), but it still reports it as 1 GB, in /dev/block/vnswap0

Thank You!

---------- Post added at 04:14 PM ---------- Previous post was at 03:26 PM ----------

Defiant07,

P.S.: When I run the script and it asks me to choose a location, it doesn't even mention my External SD Card. I do have one (I ran the script from it in the script manager you recommended).

It only offers: [D]ata, [C]ache, ystem & [K]ustom

My Ext SD is locate at:

/storage/extSdCard

Thanks!
 

Zeuszoos

Senior Member
Aug 9, 2012
1,065
205
93
Defiant07,

Update: I said what the heck and tried "Custom".

The script ran fine. It created the swap file on:

/storage/extSdCard

I did reboot into Recovery, wiped Dalvik Cache & Cache.

Rebooted and opened Terminal, but when I typed "free", it shows the "Swap" as Zeroes all the way across (Free, Total, etc.).

Maybe it's reporting on the old, default swap?

I don't know what command to use to check if it's using the swap that the script created on my External SD Card.

Or does it mean that it's just not working?

I did tell the script to use a delay, just in case.

Thanks!
 

adhawk

Member
Nov 11, 2012
31
2
0
Delete the init.d script Z99swapon

I ran the swapiton v13 script completely with suggested script manager to where if you are patient enough you can see a print of a cannabis weed plant in the end xD However, the script still didn't enable swap because my rom's busybox 1.21.1-jb doesn't have the priority -p option for the swapon command input arguments i.e swapon [-a] [device] only. But that has been solved by running the swapiton shift script using stericson's busybox. And yes i have 2 busybox within my rom, the one preinstalled by my rom is located in /sbin, while the stericson busybox is in installed in /system/xbin. i don't know if its ok or not to have many version of busybox installed in a rom but i just can't install the stericson busybox in /sbin because once the phone is rebooted the files in /sbin automatically turns back to jb busybox. Its a kernel thing maybe idk. That also means the rom will be unable to run the script z99swapon in init.d folder during boot although this rom has init.d support just because of the preinstalled busybox running in boot lacks the -p option for the swapon command.

So now here's my question, can i delete the z99swapon script in the init.d folder? does running the shift scripts (e.g swapiton, swapitoff, swapxxx, tweakstb) in /system/xbin requires the existence of the z99swapon script? I really don't mind if the script can't be run during boot to maintain the swap configs, i can just run the shift scripts manually.
 
Last edited:

kingwaqar

Member
Jan 31, 2016
32
0
0
Karachi
GT-i8262

I have done all steps greatly in GT-I8262 but i am having an error when i try to open swapiton and check free or cat /proc/........ both not working please tell me but i saw the file is there
my cpu supports swp

---------- Post added at 10:41 PM ---------- Previous post was at 10:34 PM ----------

Defiant07,

Update: I said what the heck and tried "Custom".

The script ran fine. It created the swap file on:

/storage/extSdCard

I did reboot into Recovery, wiped Dalvik Cache & Cache.

Rebooted and opened Terminal, but when I typed "free", it shows the "Swap" as Zeroes all the way across (Free, Total, etc.).

Maybe it's reporting on the old, default swap?

I don't know what command to use to check if it's using the swap that the script created on my External SD Card.

Or does it mean that it's just not working?

I did tell the script to use a delay, just in case.

Thanks!
same problem
 

yashg1

Senior Member
Jan 5, 2016
78
17
0
Mumbai
Hey, first of all thankyou so much for the Tweak.
I am using a custom ROM on grand prime. I've installed this tweak and works well but whenever I reboot the swap goes and I've to do the whole process again!
Is there anyway to get rid out of this?
 

josuesim1

Senior Member
Apr 23, 2016
87
17
0
Guatemala
/system/xbin/swapit[565]: 1707
6320
6320
6320
6320
6320
6320 - 20: unexpected '6320'
You knwo the deal. Keep your panties on
and wait . . .patience is a virtue

what i have to do
 

-Rye-

Senior Member
Dec 30, 2012
117
11
0
AMAZING.
And very pretty (Eat that, Supercharger)

Finally a swap file tool that works on the G3s :D.
All the others threw invalid arguments at me.

Strangely Poweramp gets killed awfully lot since I used this. Maybe LMK
One question though, I know you dislije using a custom path,
but why does /storage/external_SD always error out at the very end with "no free space" when I have 4 gb free ?
 

Prakash2000

New member
Mar 12, 2018
3
0
0
Awesome

Thank you for this script. I used it on my gts7392 and boosted up my ram by 700 mb. The swap will not work like the real ram but it will definitely increase performance. Very cool! Better than that roehsoft ram expander app because of four reasons - it is paid on playstore (although smart people know how to get it for free), the max limit of swap file is 4 gb , you have to enable swap every time you boot up and the app takes up extra space in ram. I am using script with script manager. Thanks a lot! :good:
 
Apr 30, 2016
10
0
0
Input your desired size in mb as an integer
for the primary swap file: 32

FIX ME! implement getmntent() bionic/libc/bionic/stubs.c:354 Oops...you do not have enough space...
...try again...bye :p.
Help me
 
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone