yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] defiant07:
No problem dude, we all have to sleep and have lives away from xda ;). The test at the beginning of my script only tests if the /etc/init.d directory exists, it does NOT test if it works...normally if it's there it's working, so it is a reasonable assumption and test :p...I think rebooting is the only way to really test if it works and that would be a pita for both me and the user.

lol...it seems both of my previous diagnoses were correct: broken init.d and missed errors :(. Glad ya got your init.d working, but the critical thing in regards to my script is that "function not implemented" error...

This error means the problem is your kernel does NOT properly implement swap ...this is the fifth kernel I have come across so far where the dev most likely forgot to enable a module or something in the kernel, which results in some swap related things working (e.g. the making of the swapfile) and some NOT to work (e.g. turning swap on/off). Needless to say this is problematic.

The solution is to either talk to your kernel's dev and inform him of the problem or to flash a different kernel that fully implements swap.

If there are no custom kernels for your device you are sol...sorry :crying:.

The user in the below quote had the same issue.

Glad you found a good kernel...interesting that you found so many with partial implementations...out of curiosity, did you try talking to any of the devs?

To be honest, I know very little about zram being that my kernel does not support it...I had one user tell me via pm they could NOT be used together and that they had to disable zram in order to get my script working properly...this makes sense being that as I understand things zram is a form of swap...so if you use zram, you are using swap, but it is a different form of swap. I skimmed THIS thread, seems to have some good info from some reliable sources.
[Android Software/Hacking General [Developers Only]] Zeratul91:
Well i didn't want to bother the developers before digging around a bit :p, by the way when I ran the script the zram was enabled and meminfo showed 240 mb (200 swap + 40 zram).

For now I will stick to swap since zram paradoxally eats a bit of ram and uses the CPU to compress data, but maybe tomorrow I'll do some tests :D

Inviato dal mio Nexus S usando Tapatalk 4
[Android Software/Hacking General [Developers Only]] ashishk87:
Thanks for all the help

Hey, thanks for all the help :good:

OK, its a ROFL moment for me !!

when i checked "cat /proc/cpuinfo" in terminal, it showed "swap".....i had init.d & busybox.....hence i flashed your script....

I even got that "swapon: /data/swapfile: Function not implemented...done." error at 1st attempt also, but I ignored it coz swapfile was created :o

Now, regarding kernel supporting swap.........

can you do anything bout adding proper swap support to the kernel? There is no custom kernel for my phone.....we have ICS custom kernel, which is of course not of any use.....actually, ICS gave me good free ram....JB has some problems.....when i power on my phone, free ram is around 200mb, but automatically drops to 100-110mb in few minutes, even if no apps are installed....

Funny thing is, my phone is actually performing well after flashing swapiton script, which is not even installed :p

and funnier thing is, I have told my ROM developer that i flashed swapiton & games are running without lag....also recommended the script to him :p :p

Now, telling him that our kernel doesn't support swap would be embarrassing ;) , so i'll just move on with what i have got....maybe we r goin to get 4.2 rom in few days....hoping for good ram managament in it :)

Finally, I have uninstalled swap using "unswapit".....but as u said in post #1, base "swapit" script is not removed.....so, can you help me removing it?

Thanks once again for all the help :)
[Android Software/Hacking General [Developers Only]] defiant07:
Interesting it works fine alongside zram for you...have fun experimenting :D.

I imagine you could add proper swap support, but it would be an involved process, which is beyond my knowledge...you'd have rebuild it for source or modify it with something like Android Image Kitchen or Injector.

lol...you are obviously quite susceptible placebo effects :silly:. Maybe you should tell your rom's dev; if they know there is a problem they will likely fix it and that way you could use this script and actually experience some real gains :p.

To remove swapit (since you flashed it) and unswapit (which is also left behind), using your root file manager navigate to /system/xbin, remount rw, and then delete the two file as you would any other files.
[Android Software/Hacking General [Developers Only]] defiant07:
Uploaded v11...minor update...improved the switch swap scripts and eliminated the usage of the swappinessvalue.txt file.

Note: If you are updating without changing swapfile location swapit will remove the swappinessvalue.txt file for you during the update process. If you update and decide to change location, follow the procedure outlined in the closing notes and run unswapit first.

Also note, beginning with this version, users should NOT rename or alter the init.d script, Z99SwapOn. Doing so may result in the switch swap scripts functioning improperly, which in turn may have negative ramifications for Z99SwapOn.
[Android Software/Hacking General [Developers Only]] guitarfreedom:
Thanks in advance bro for your job !

I installed this last version for the first time. On my Xperia U with GB, script seems to work good. But in which way can I verify that script is working?

Thanks ;)
[Android Software/Hacking General [Developers Only]] defiant07:
You are welcome dude.

The easiest way to verify all is working is to look at /data/Ran_SwapOn.log

Or if you are a terminal enthusiast...to verify swap is functioning use the free command (there should be non-zero values in the bottom/"swap" row)...to verify swappiness and the other optional tweaks you can do cat /proc/sys/vm/XXX, where XXX=the desired parameter (e.g. cat /proc/sys/vm/dirty_background_ratio).

thanks for the feedback...enjoy :)
[Android Software/Hacking General [Developers Only]] guitarfreedom:
mmm so I had already done "free" and swap is 0 and Ran_SwapOn.log confirmed now that swap is 0. It's only my placebo effect :silly:
[Android Software/Hacking General [Developers Only]] defiant07:
Yep...sorry :(

I am guessing you missed a "Function not implemented" error in the set up script...look in /data/BootLog_SwapOn.log it will show any errors...if there is a "Function not implemented" error the problem is that your kernel does not properly support swap; the solution would be to either talk to your rom's/kernel's dev to see if they can fix it or to flash a new, different kernel that fully/properly supports swap.

If there is no "Function not implemented" error in the BootLog and instead there is some other error post the BootLog and we can probably find a solution...most likely you'll need to rerun the base swapit script and set things up using the additional delay option.

lmk
[Android Software/Hacking General [Developers Only]] guitarfreedom:
Thanks for your gentle answer. Yes, problem is the kernel. I've noticed error "function not implemented" ...I'll try with another kernel. I'll post the result !

Thanks bro
[Android Software/Hacking General [Developers Only]] defiant07:
np man ;)...gl finding a good kernel; had one user that had to go through a few bad ones before he finally found one that worked :eek: :silly:.
[Android Software/Hacking General [Developers Only]] guitarfreedom:
I'm not lucky, there are only 2 gb kernels for my XU... And swap is disabled on each one.

I have to compile kernel myself :rolleyes:

Good job!;)
[Android Software/Hacking General [Developers Only]] defiant07:
Try talking to those dev's if they are still supporting their products...I bet they would at least try to fix the problem.

I'm assuming XU = Xperia U...did a quick search and found THIS, THIS and THIS, which support swap if you're interested in updating to ICS, although I am guessing you're sticking with gb for a good reason.
[Android Software/Hacking General [Developers Only]] stanlin salu:
Nice script...

Very powerful:)
[Android Software/Hacking General [Developers Only]] defiant07:
Thanks for the feedback, glad you found it useful :highfive:.
[Android Software/Hacking General [Developers Only]] stanlin salu:
Just wanted to ask...?

swap to data partition is better??

Or

Swap to sd??

Which wil perform good??

Keep up your good work mate:)
[Android Software/Hacking General [Developers Only]] eushaun99:
Its the same. Its just where you want to put the swapfile. [MENTION=5146220]defiant07[/MENTION] made this option because on 4.2 or newer the SD card file system changes so its quite confusing and complicated. He made the default place as data to avoid this confusion/complication.
[Android Software/Hacking General [Developers Only]] stanlin salu:
Thanks buddy..

You mean the sdcard read/write speed doesnt affect the performance??
[Android Software/Hacking General [Developers Only]] eushaun99:
According to my limited knowledge, nope. Defiant, feel free to correct me if I'm wrong. :D
[Android Software/Hacking General [Developers Only]] defiant07:
Thanks for the kind comments.

What [MENTION=5113073]eushaun99[/MENTION] told you is correct

in his case

being that his device does not have an actual external sdcard.

However, if you have an actual external sdcard then the question of which is "better" becomes much more murky and subjective. I am guessing/assuming this is the case that applies to you...

/data should perform better due to better read/write (obviously the performance difference will vary depending upon device and sdcard class/manufacturer), but sdcards are replaceable (although degradation is of minimal concern from what I have read). Given these circumstances some users opt to use /data even though they have actual external sdcards, while some users are more cautious and use their sdcard.

I imagine your usage style would also impact perceived performance differences; the harder you push your device whether it be multitasking or gaming the greater the perceived difference would be. Experiment...I personally notice little difference so I opt to use my sdcard...more space for apps, plus it's a bit safer :).

What you said regarding performance difference is true for you and other users who lack actual external sdcards. For users who have actual external sdcards it's a different, subjective story...see above if curious.
[Android Software/Hacking General [Developers Only]] eushaun99:
So I'm half right...yay! :)
[Android Software/Hacking General [Developers Only]] raffles496:
No have space?

Hi all. Me use the script, i cant use CWM (bootloader lock XP), but in a step show this error:

==============================================

Hi. Thanks for using...

//----------------------------------------//
// Defiant07's SwapItOn //
//----------------------------------------//

Hope you like it!

==============================================

Okay, first gunna make sure busybox has the
required applets, that you are running as
root, that /etc/init.d exists, and that your
kernel supports swap.

Boss, busybox is complete.

Gnarly, running as root.

Good, init.d detected.

Nice, swap is supported.

==============================================

Now I need some input from you so as to
customize the script according to your
needs and preferences.

Where should I make the swap file?
Pick (e)xternal sd card, (d)ata partition,
or (c)ustom location: c

Umm...fine...but be FOREWARNED this may
lead to swapon and swapoff related errors and
I will NOT respond to posts regarding such.

Okay, now input your desired path.
Path: /storage/external_SD/swap

The swap file will be made here:
/storage/external_SD/swap

If this location is copasetic with you
input (p)roceed or (e)xit: p

==============================================

Next, I need your desired swappiness.
Note: The higher the value the higher the
probability things will get transferred to
the swap file.

Please input your desired swappiness value
- any integer from 0 to 100 - and then
press enter: 60

==============================================

If you want, these vm/swap related settings
can be applied to your current session and
future boots:

dirty_background_ratio =
(15) [20] {60}
dirty_ratio =
(30) [40] {95}
vfs_cache_pressure =
(50) [10] {10}
dirty_writeback_centisecs =
(3000) [3000] {2000}
dirty_expire_centisecs =
(500) [1500] {1000}

The values in () are from ThunderBolt.
The values in [] are a middle ground by me.
The values in {} are from KickAssKernelizer.

Wanna give one them try? Input (t)hunderbolt,
(m)iddle, (k)ickasskernelizer, or (n)one: m

==============================================

If you are using the vold.fstab trick to
switch your internal and external sdcards or
if your swapfile location is slow to become
accessible an additional delay in the init.d
script maybe necessary so as to avoid
potential problems.

Should I add an additional delay to Z99SwapOn?
Input (y)es or (n)o: n

==============================================

Based on accessible ram, I recommend using a
size around: 309 mb.
It is unlikely you will use more than this.

Input your desired swap file size in mb
as an integer: 150

Oops...you do not have enough space...
...try again...Bye :p.

==============================================

Say me i not have space but of course Have, i dont know what happens? You can help me.

Greetings from Mexico and sorry for my bad English.
[Android Software/Hacking General [Developers Only]] eushaun99:
Try choosing external when the script asks you for swap location instead of custom since you selected your external SD card anyway.
[Android Software/Hacking General [Developers Only]] raffles496:
Thanks, exactly right now the file swap has created, but after rebooting and into the terminal, this is the result:

u0_a117@android:/ $ free
total used free shared buffers
Mem: 634064 601816 32248 0 8976
-/+ buffers: 592840 41224
Swap: 0 0 0
u0_a117@android:/ $

This means that SWAP memory is not activated, right? Why? My kernel is not compatible?

Sorry for my bad English and for the problems caused.

Greetings from Mexico.

Enviado desde mi LG-P714 usando Tapatalk
[Android Software/Hacking General [Developers Only]] defiant07:
Thanks for the assist; that would have been my suggestion too ;).

Correct, the zeros in the bottom row indicate swap is not active.

The most likely cause is your kernel. Look in /data/BootLog_SwapOn.log and I am guessing you will find a "function not implemented" error (this error would also show up in setup script during the part where it makes the swapfile). If you find this error it means the kernel's dev did not fully/properly implement swap. The solution is to either talk to the kernel dev or flash a new, different kernel.

If you do NOT find the "function not implemented" error in the BootLog, post the BootLog. In the cases where this error is not present, the problem has been that the swapfile is not being detected at the time the script runs due to the location being slow to mount. The solution would be to rerun the setup script and when it asks you if you want to add an additional delay say "yes" and this should do the trick :).

Thanks for the feedback...lmk your findings :fingers-crossed:.
[Android Software/Hacking General [Developers Only]] phil_greg2001:
Hi defiant07,

Many thanks for your script, it works very well on my i9000 + 4.3.1 HellyBean + ExtnalSD 200Mb swap + 40% + CyanCore 3.20 :good:

Thanks to you, it is very easy to create a swap now :cowboy:
[Android Software/Hacking General [Developers Only]] alleyezondisromo:
Could i flash this on a nexus 4? would it give me a benefit... memory is onboard.. would that make a difference ?
[Android Software/Hacking General [Developers Only]] defiant07:
You are most welcome. Glad you found it useful :D.

Sorry for the delayed response been out of town...

Yeah you should be able to use it so long as your kernel supports swap.

Regarding benefits: If you get lag while hard gaming or if there is a lot of redraws while multitasking adding swap should help. However, if you have neither of these issues I doubt you would notice much of difference. Although, you can always just give it try; it should not be harmful.

============

[MENTION=5396998]raffles496[/MENTION] - did you every resolve your issue???
[Android Software/Hacking General [Developers Only]] raffles496:
Thanks for your help and interest.

Me no response for lack of time (homework the university :p). Now, I tried adding delay option in the configuration of script, but after of restart, the result is same, SWAP is not activated. I've also search the file "/data/BootLog_SwapOn.log" but this no exist, there a log named "/data/Ran_SwapOn.log" and this is you content:

Time To Get Our SwapOn!!!

##########################################################################
#>>>>>>>°•°•°•[{[{Defiant07's SwapOn Verification!?!?!?!}]}]•°•°•°<<<<<<<#
##########################################################################

Swappy Swap Swappin' Swappiness: 60
SwapOn@: 04:48:45 PM 2013.10.27

Dirty Background Ratio: 25
Dirty Ratio: 50
VFS Cache Pressure: 10
Dirty Writeback Centisecs: 3000
Dirty Expire Centisecs: 1500

total used free shared buffers
Mem: 634064 626480 7584 0 10548
-/+ buffers: 615932 18132
Swap: 0 0 0

##########################################################################

Flash other kernel is not a choice for me, as my telephone is relatively new not exist compiled kernels also my bootloader is locked :(:( .

P.S: I used "universal init.d" and me see that the activated of this app and others (Xposed, Greenify, UDN, root necessary with all) is slow, also the scan media takes time and start after of activated the others apps, I think that maybe is a problem of delay. You that think?

Greetings from Mexico and sorry for my bad English.

Enviado desde mi LG-P714 usando Tapatalk
[Android Software/Hacking General [Developers Only]] defiant07:
Sorry for delayed response, got back home and the internet was broken...just fixed it this morning.

Regarding your P.S.: The addition of the delay to the init.d script should NOT cause any kinds of slow downs. All it does is cause the script to run one minute after android loads (without the delay it runs as soon as android is loaded).

Being that adding the delay did not help and that you don't get a BootLog, try rerunning the set up script using the option to make a new swapfile. Pay attention to the output during the part where the swapfile is actually created and you will probably find a "function not implemented" error. As previously noted this error means you kernel does NOT fully/properly support swap and if you don't want to flash a new kernel then you are SOL, sorry. If you do NOT find this error post the scripts output using the option to make a new swapfile.

lmk your findings and gl with school.
[Android Software/Hacking General [Developers Only]] Arkanoide:
The script works well on the galaxy S (aka I9000) but i tried to mount the sdcard via USB.

So i used the command

su -c swapitoff

the script runs but the swap is still enable :( So i tried the second command

su -c unswapit

It uninstall the script and the swap was 0 (with command free), so there is no swap but from now, when i plug the USB there is no notifcation which ask to mount the sdcard. The notification pop before i used the script.

Someone had already experiment that ?

Sorry for my english :)
[Android Software/Hacking General [Developers Only]] defiant07:
Hmm...interesting. I personally have not encountered such issues.

Did you get any errors while running swapitoff? Maybe it did not properly locate the swapfile. Also did you run swapitoff

before

connecting the usb? If you ran it

after

connecting maybe that fubared things.

After the uninstall, despite not getting the usb notification, were you able access your sdcard on your pc?

Since you uninstalled, I suspect a reboot will resolve the notification issue.

If you feel like testing/reinstalling, I would be most interested to know if you can replicate the problem and if you could post the output from swapitoff. Thanks and sorry for any inconveniences.
[Android Software/Hacking General [Developers Only]] Arkanoide:
hum... yes i did run swapitoff after connecting the usb. :silly: but i had no error during runing the script swapitoff.

I can't access to the sdcard from my pc.

I thought that a reboot will fix it but it didn't help. I also checked in /system/etc/init.d/ if there is still some file but no.

I will try to reinstall if i can replicate the problem.

EDIT : After reinstall the script, the swapitoff command works well :) but there isn't the notification to mount the sdcard :s

I will flash my rom to see if it fix the issue and i will try your script again :)

EDIT 2 : well,it didn't solve the problem (I didn't do a full wipe, don't want to reinstall every apps ^^). I think i will stay with this issue until 4.4 ^^. I don't know if the problem really happen after install your script but anyway your script works well for the swap :D
[Android Software/Hacking General [Developers Only]] defiant07:
Turning swap on and setting your
swappiness value...

[B][COLOR="Red"]swapon: /storage/external_SD/swapfile: [U]Function not implemented[/U][/COLOR][/B]
...done.

Yep, it's your kernel; it does not fully/properly support swap.

Very odd that neither uninstall+reboot nor dirty rom flash worked :confused:. Both of these methods would more or less completely undo everything done by my script, especially the latter. Dunno what else to suggest except to restore a nandroid made prior to installing my script, which can be a pita...sorry dude.

Being that I have never had this issue reported before and that you're not totally sure maybe it is something else. Any other system changes/tweaks, new/updated xposed modules, or new/updated root apps since the last time you successfully connected your device to pc via usb?
[Android Software/Hacking General [Developers Only]] Arkanoide:
Nothing i can remember. I'm not sure either that issue is related to your script but i prefer to ask here because it was the only one flash i had before the problem. Anyway, thanks for your script :) It is probably something else but it is not a major problem for me i can wait KitKat :D keep up the good work :victory:
[Android Software/Hacking General [Developers Only]] defiant07:
Glad it's not too much of an inconvenience...if you have made no other changes then it probably is an issue that arises from the combination of my script and your rom...wish I could have been of help, but I am at a lose :( (did some googling, but found nothing similar).

No problem man...should you ever decide to flash a custom kernel with swap support, you know where to find me :p,
[Android Software/Hacking General [Developers Only]] eushaun99:
Defiant, I have a question that I hope you may be able to answer. If my ROM has zram, will enabling swap cause any conflict?
[Android Software/Hacking General [Developers Only]] defiant07:
I am 99% confident you can use zram

and

swap. I dunno much about zram being that my kernel does not support it, but from what little I do know I see no theoretical reason why they would conflict (zram compresses stuff in actual ram and swap shifts stuff to what might be called 'fake ram').

Also note: one user in this thread reported using both zram and swap without any negative issues, however, another user told me via pm that he could not get swap working with zram enabled (he said he had to disable zram to get my script/swap working, although I have some suspicion this may have been a case of GUI :p).

If you give it a try please report your findings as I am curious.
[Android Software/Hacking General [Developers Only]] eushaun99:
Thanks. I'll try it out and let you know. ;)