yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] famewolf:
I'm actually not a gamer...just on a low memory device that is regularly at 50-100mb of available ram. I ran the script on both devices...on the hd2 it offered me 2 locations...on the inspire it only offered /data as it couldn't find my sdcard. His change when ran from adb shell correctly returns /storage/primary/legacy but when ran in the modified script (pushed to /data/local/tmp) it gave me the no closing quote error I showed in earlier post.
[Android Software/Hacking General [Developers Only]] defiant07:
nice you're comfortable making the edit yourself.

It should be:

storage=`busybox mount | awk '/sdcard|storage/&&/vold/{print $3}' | awk 'NR==1'`

copy and paste this in place and then test please.
[Android Software/Hacking General [Developers Only]] famewolf:
This worked (or at least it's creating my swapfile now) and I can't believe I missed it...I stared and stared at that line.
[Android Software/Hacking General [Developers Only]] defiant07:
was /data only offered for the for the desire too? if so it kinda works for all you're devices...also under "USAGE" in the OP, I note that jb users will likely have to use /data.

see previous post...use that code
[Android Software/Hacking General [Developers Only]] defiant07:
you did not miss it...Zep probably had a typo.

make sure you don't get and swapon or swapoff errors.
[Android Software/Hacking General [Developers Only]] famewolf:
The HTC Desire HD/Inspire 4G are the same device...just one was internationally sold under Desire HD and AT&T's version was named inspire 4G.

Hmm Both the HD2 and the Inspire are running CM 10.1 (aka JB) and the HD2 is using DataonEXT (external ext4 partition) which is built into the rom while the Inspire is using MountonSD from this forum to accomplish the same thing.....both have 3GB ext4 partitions after the fat32 one.....I wasn't sure if they would interfere with this script since they remap part of /data..plus truthfully I'd rather wear out a microsd then create bad blocks in the nand.
[Android Software/Hacking General [Developers Only]] defiant07:
/cache???

Are you even using my script or are you just asking a kinda random question in a swap related thread???

How much decrease? Read the first page or two of the thread. Or search google.
[Android Software/Hacking General [Developers Only]] famewolf:
shell@android:/data/local/tmp # free

total used free shared buffers

Mem: 605936 577912 28024 0 14232

-/+ buffers: 563680 42256

Swap: 302076 1352 300724

Seem's to be enabled and beginning to be used.
[Android Software/Hacking General [Developers Only]] defiant07:
Indeed it is enabled and active :victory:...yet another fix to Zep's credit :good:.
[Android Software/Hacking General [Developers Only]] famewolf:
To answer your question:

shell@android:/data/local/tmp $ swapoff -a

swapoff: /etc/fstab: No such file or directory

The file actually does not exist.

So as long as I never need to turn it off or on I'm ok. ;)

In /fstab.spade I have:

# Android fstab file.
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK

#TODO: Add 'check' as fs_mgr_flags with data partition.
# Currently we dont have e2fsck compiled. So fs check would failed.

#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/platform/msm_sdcc.2/by-num/p25 /system ext4 ro wait
/dev/block/platform/msm_sdcc.2/by-num/p26 /data ext4 nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc wait,encryptable=footer
/dev/block/platform/msm_sdcc.2/by-num/p27 /cache ext4 nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc wait
/dev/block/platform/msm_sdcc.2/by-num/p28 /devlog ext4 nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc wait

AHA! I think what you want is /etc/vold.fstab

## Vold 2.0 fstab for HTC Ace

#######################
## Regular device mount
##
## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
## label - Label for the volume
## mount_point - Where the volume will be mounted
## part - Partition # (1 based), or 'auto' for first usable partition.
## <sysfs_path> - List of sysfs paths to source devices
######################

# Mounts the first usable partition of the specified device
dev_mount sdcard /storage/primary/legacy auto /devices/platform/msm_sdcc.4/mmc_host/mmc2
[Android Software/Hacking General [Developers Only]] defiant07:
swapoff -a ??? I've never see this kind of syntax...

swapoff command should look like swapoff /sdcard/swapfile

plus I was trying to ask if the script gave you and swapon or swapoff errors...not the commands themselves

if the the script did not give you any errors you can turn swap off with su -c swapitoff
[Android Software/Hacking General [Developers Only]] famewolf:
I updated my post since you wanted to know where jelly bean put the swap info....swapoff -a should turn off ALL swap available at least according to busybox...same with swapon -a

BusyBox v1.21.1-jb bionic (2013-07-01 01:04 +0200) multi-call binary.

Usage: swapoff [-a] [DEVICE]

Stop swapping on DEVICE

-a Stop swapping on all swap devices

I'll chalk this up to a busybox/jellybean mismatch.
[Android Software/Hacking General [Developers Only]] Far_SighT:
I remover my earlier swap and edited to this:

storage=/data

and once again ran the script with

storage=/cache

since /cache is faster.

I have a class 4 SanDisk sd. It'die if I use it to swap.
[Android Software/Hacking General [Developers Only]] famewolf:
If both /data and /cache are in the nand then neither is going to be faster than the other. I don't understand you folks....a microsd card is both inexpensive and replaceable....once your nand builds up bad blocks (a notorious problem for the HD2) that nand space is gone forever.

Phone = $100-$600 depending on device and when it was purchased. (My HD2 was $450 out the door where $350 now will get you a Nexus 4)

32GB microsd class 6 = $20
[Android Software/Hacking General [Developers Only]] zeppelinrox:
He wasn't offered an sdcard option (even tho he has one) because there is no "sdcard" in the path.

Hence the updated code to include "storage"

I know it's a real sdcard and good to go because of the "vold" ;)

Nope... no vold showed up in his mount output - which is why I was condfident there was no actual external sdcard.

Nice catch... that'll learn me but good :p

I'm pretty sure it worked and he was then offered the sdcard option with the updated code.
[Android Software/Hacking General [Developers Only]] defiant07:
Umm I'm pretty certain you need point swapoff -a toward something...a partition I think.

regarding the update of your previous post/me asking about data migration on jb...that was a question to Zep...and the more I think about it the more dumb I think it was.

And the output from you're free command actually answered the question of whether or not you got any swapon or swapoff related errors in the script.
[Android Software/Hacking General [Developers Only]] Far_SighT:
I get that, but a swap on a class 4 sd is just too slow for me.The device slows down as the Sensation Xe has only 768 mb ram, which means excessive dependency on swap with jb roms. So I need a fast(er) swap.

http://talk.maemo.org/showthread.php?t=73715
[Android Software/Hacking General [Developers Only]] famewolf:
Actually no...I run linux and swapoff -a works just fine....just like it tried to do with android it will look in /etc/fstab and turn off all the devices identified as swap.

xps8300:/workarea/android # cat /etc/fstab
/dev/disk/by-id/ata-ST3750528AS_6VP8LFND-part1 swap swap defaults 0 0
/dev/disk/by-id/ata-ST3750528AS_6VP8LFND-part2 / ext4 acl,user_xattr 1 1
/dev/mapper/cr_ata-ST3750528AS_6VP8LFND-part3 /home ext4 nofail,user_xattr 0 2

however /etc/fstab physically does not exist on my inspire or my HD2 for that matter....
[Android Software/Hacking General [Developers Only]] zeppelinrox:
btw I don't think you need to worry too much about the jb thing.

If there is an actual external sdcard (on

any

ROM) the script will find it and the /data/media/0 mount won't matter - that will only come into play if there is no real sdcard or sd slot.

Can you confirm that the updated code fixed the issue and that the script offered to use the sdcard?
[Android Software/Hacking General [Developers Only]] defiant07:
Yeah...I'm slowly realizing my ignorance...that whole /data was a work around for jb users without a real external sdcard...not jb in general...and this newest edit more or less just added another search term.

Yeah it worked...see the output he posted from the free command.
[Android Software/Hacking General [Developers Only]] famewolf:
I think you should try the microsd FIRST before going to nand. My Inspire has same ram...a single core 1GHZ cpu and a class 4 or 6 and it's running fine. My HD2 also has a 4 or 6 with 512mb. Then again it's your device. Mine are still very useful as voip phones in wifi only mode...barcode scanners...quick pics etc.

---------- Post added at 02:21 AM ---------- Previous post was at 02:18 AM ----------

Yep....confirmed it when I said it was building my swapfile. New code does the trick. Wow...first time I saw the "You can only thank 8 times a day."
[Android Software/Hacking General [Developers Only]] defiant07:
ahh...interesting...pardon my ignorance for at least the second time this evening.

:)...I've been hitting that limit a lot lately too because of Zep's help.
[Android Software/Hacking General [Developers Only]] famewolf:
You may need to bump up your estimates for 512mb devices......

root@android:/ # free

total used free shared buffers

Mem: 420248 405764 14484 0 1884

-/+ buffers: 403880 16368

Swap: 209912 172140 37772

In the old days linux used to allocate swap as 2* physical memory.
[Android Software/Hacking General [Developers Only]] defiant07:
Why? That output shows you still have like 37mb free swap, which is means you're still only using around 80%. Did you get it to max out? If so how much higher can you get it to go?

==edit==

nvm i c, you're already using a larger than recommended size and the used is exceeding the recommended size.

I too have 512mb device...how did you get it so high? I never come close to using all my 150 mb size.

Can you get it to go much higher? 168 is not too far off from the recommended size of 153.
[Android Software/Hacking General [Developers Only]] famewolf:
Well about 45 seconds after that post it soft rebooted to the cyanogenmod Circle and of course freed up all the swap space...so I imagine it managed to fill it. I'll have to see if it's repeatable...I also recently bumped the overclock from 1130 to 1190 in rom toolbox so I have to play "guess the culprit" ;)

The 209mb was the "recommended" size of the script but yeah I appear to be using it.....so whats the easiest way to increase the size of the swapfile? I think I'd try 256mb 50% of physical memory.

I'd have to list all the apps running I guess.... greenify...to hibernate some apps....screebl to keep screen lit...a battery saver...cloudcube to upload some files to ubuntuone cloud service.....uninstalling some unneeded apps from settings.....you get the idea. ;)
[Android Software/Hacking General [Developers Only]] defiant07:
Oh that is you recommended size...

easiest way to increase size is to do

dd if=/dev/zero of=<your desired location> bs=1048576 count=XXX

where XXX=desired size in mb; example desired location: /sdcard/swapfile.

I am curious about your results lmk how much higher than the recommended size you can push it...probably won't change recommended size...your a bit a power user ;) who likes to push his device...I bet most people will never max out the rec size.
[Android Software/Hacking General [Developers Only]] famewolf:
I ran swapoff /sdcard/swapfile

I then used your command to resize the file to 256mb.

I then tried to run the swapon command....

root@android:/ # swapon /sdcard/swapfile

swapon: /sdcard/swapfile: Invalid argument

Ok so where am I going wrong?

Mem: 420248 398220 22028 0 5920

-/+ buffers: 392300 27948

Swap: 0 0 0

Hmm swapoff /sdcard/swapfile also returns same invalid argument. rerun the script?

*update*

Deleted the swapfile and the swappiness file....reran the script.....appears to be taking now....it didn't like the dd.(it needed to be formatted)...oh and you should probably mention in post to run swapoff first before wiping the swapfile. ;)
[Android Software/Hacking General [Developers Only]] defiant07:
Okay, I think I FINALLY understand that whole situation now...as well as the associated code...

storage=`busybox mount | awk '/sdcard|storage/&&/vold/{print $3}' | awk 'NR==1'`
if [ "$storage" ]; then
echo " Where should I make the required files?"
echo " Pick (e)xternal sd card or (d)ata partition."
echo
read location
case $location in
e|E);;
d|D)storage=/data;;
*) echo " Learn how to read and/or type! Bye :p."; exit 69;;
esac
else storage=/data
fi

...I was so fixated on what felt like some unknown jb specter, my mind kept trying to like everything to jb...pretty silly looking back on things.

At any rate now that I more full understand the above code, couldn't it be reduced to:

echo " Where should I make the required files?"
echo " Pick (e)xternal sd card or (d)ata partition."
echo
read location
case $location in
e|E) storage=`busybox mount | awk '/sdcard|storage/&&/vold/{print $3}' | awk 'NR==1'`;;
d|D) storage=/data;;
*) echo " Learn how to read and/or type! Bye :p."; exit 69;;
esac

What's the reason for embedding the case statement in an if statement?

edit spoke too soon...i figured it out...it forces /data if the busybox mount comes up empty.
[Android Software/Hacking General [Developers Only]] eushaun99:
I think it should be swapon /data/media/0/swapfile if you're on jb. That was my problem. BTW, I hear someone calling me. Need me to be your guinea pig? :D
[Android Software/Hacking General [Developers Only]] famewolf:
The case statement allows you to accept upper and lower case of the two choices and an error message if they type something else....you'd have to use a multiple if, or, if, or else to accomplish same thing.
[Android Software/Hacking General [Developers Only]] defiant07:
Sorry...bad attention to detail on my part...forgot the mkswap...did not think the whole process through...its getting late...gunna crash soon.

btw - the swapoff before delete info is in the OP under 'USAGE>>uninstall'...you should have already known that part :p (I'm joking of course), lol.
[Android Software/Hacking General [Developers Only]] famewolf:
No....any jellybean'r with an actual sd card can just use that....it's only when the "sdcard" is still internal storage like on a nexus 4 or 7 that you have to use /data.
[Android Software/Hacking General [Developers Only]] eushaun99:
Oh yeah, that was the case for my galaxy tab 10.1. It didn't have an external SD card. Sorry.
[Android Software/Hacking General [Developers Only]] defiant07:
I know how case statements work...look at both sets of code...and then explain to me how the end results of the two codes differ...there is no need for the if statement in the first set of code, which is the code currently in the script, if the storage=busybox blah blah blah command/variable definition is moved into the case statement like in the second set of code.

The test in my head tells me there's no difference, but it is admittedly a fault mechanism...lol. So I was just being lazy and asking instead of doing and testing...I'll do it tomorrow...too tired now...good night.
[Android Software/Hacking General [Developers Only]] famewolf:
Sleep is highly overrated...if you stay awake long enough you get a buzz similar to being intoxicated...and after that, free hallucinations. ;)

Thanks you and zeppelinrox for the help. I suppose a 6.1 will be coming down the pipe at some point. I pointed several HD2 users who wanted swap in your direction. *ducks*
[Android Software/Hacking General [Developers Only]] defiant07:
lol...naw, we resolved [MENTION=320962]famewolf[/MENTION]'s issues.

yep

I'm retarded too...I only FINALLY pieced together that whole fix we did for your bug a few hours ago.
[Android Software/Hacking General [Developers Only]] famewolf:
Well my issues related to your script. I'm sure I still have plenty of issues...just ask my ex-girlfriend. ;)

You should probably edit post 1 to indicate JB users CAN use external sd as long as they have physical sd slot/card. ;) I know...tomorrow....err today...since it's 4:30am here.
[Android Software/Hacking General [Developers Only]] defiant07:
lol...I'll stick with mushrooms when I'm fully awake :eek:...although some mushrooms now would make me awake :silly:.

umm, was gunna wait to for more changes, but since the people are flocking, I upload a minor update with the fix first thing tomorrow morning :).

Now good night for reals.
[Android Software/Hacking General [Developers Only]] eushaun99:
I can't change the swappiness in terminal to 10, 30, 50, 70, and 90. It gives permission denied. And yes, I typed su before. And in script manager, those scripts doesn't show the icon which indicates that it is a script as swap0, swap20, swap40, swap60, swap80, and swap100. But if I run them in script manager manually, its fine.
[Android Software/Hacking General [Developers Only]] defiant07:
GD, I take a shower and there's another bug crawling around...

thanks...forgot to set the permissions...good catch...yet another reason to update tomorrow.
[Android Software/Hacking General [Developers Only]] famewolf:
Watch out! He's sleepcoding!
[Android Software/Hacking General [Developers Only]] NYLimited:
As someone recently pointed out, SD Cards are much cheaper and easier to replace than NAND.

As for Class 10 and UHS I - they are NOT always faster. You need to check the specifications and usage guidelines vs. real-life use. :cool:

I did (ask your ex) and you do (have other issues). :laugh:

Anyway, thanks for the external note - you answered a question I just asked you elsewhere. :good:
[Android Software/Hacking General [Developers Only]] sanpedro_bonita:
My bootloop problem is solved! Thnks. Btw, I had sandisk ulta 16gb class10. Anyone using it? It is good for swap?

Sorry for my bad english.
[Android Software/Hacking General [Developers Only]] famewolf:
[MENTION=5146220]defiant07[/MENTION]

You wanted to know how badly I'd blow the estimate of 209mb out of the water.....so far this is the high point:

total used free shared buffers

Mem: 420248 407044 13204 0 3068

-/+ buffers: 403976 16272

Swap: 524280 382000 142280

truthfully this is with only around 3 or 4 apps opened by ME but several such as lux lite, screebl, deep sleep battery saver etc running in background.
[Android Software/Hacking General [Developers Only]] defiant07:
not the most effective method for a person of my mental faculties...made most of the edits last night after shower...tested this morning...forgot a closing quote :mad:

Nice...thanks for letting me know.

Regarding your sdcard question the short, dirty answer is 'yes' the long answer is 'maybe' read [MENTION=770489]NYLimited[/MENTION]'s post on previous page.

Wow...it almost matches actual accessible ram...if other users start reporting similar results I will revise the recommendation.

Do you tweak other swap related settings like cache pressure and dirty ratio?

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

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

Attached updated version for impatient folks...will update OP in near future.

[MENTION=2935458]RFrancis[/MENTION] update to this version...I took out all the free commands...now you can use it with Project Xtreme.
[Android Software/Hacking General [Developers Only]] famewolf:
Apparently not. The "aggressive" preset in Rom toolbox pro sets:

Foreground App 25mb

Visible App 32mb

Secondary Server 39mb

Hidden Application 110mb

Content Provider 121mb

Empty App 131mb

However it no longer appears to be allowing me to set the presets....it's currently using 8,12,20,50,70,90...do you set these in your script somewhere?

*update* Added a homepage screenshot to show low available memory...system info in the clock.
[Android Software/Hacking General [Developers Only]] defiant07:
Oh okay.

Negative...I don't touch minfrees...I doubt this issue is related to SwapItOn...it only does the three things mentioned in the OP.

Can you change your minfrees with command:

su
echo "XX,XX,XX,XX,XX,XX" > /sys/module/lowmemorykiller/parameters/minfree

XX=your minfree values which are expressed in pages (1 page = 4 kb) (e.g. - 6144 pages = 24576 kb = 24 mb)

and then confirm with:

su
cat /sys/module/lowmemorykiller/parameters/minfree

If this works, my guess is its the app...maybe clear data or un/reinstall. But I'm just guessing.
[Android Software/Hacking General [Developers Only]] famewolf:
Will look into it...but if the app is the issue it's a recent issue because I've been using rom toolbox pro a long time........oh...and a new "high score" ;)

total used free shared buffers

Mem: 420248 409228 11020 0 236

-/+ buffers: 408992 11256

Swap: 524280 395956 128324

I won't post every time....just if it runs out again. :P~~~~

root@android:/ # cat /sys/module/lowmemorykiller/parameters/minfree

2048,3072,5120,12800,17920,23040

So currently set to 8,12,20,50,70,90 I'll play with changing them a little later.
[Android Software/Hacking General [Developers Only]] defiant07:
I suppose rom toolbox could not like something in the init.d script, but I dunno what. Have you made any other system changes lately?

umm...already knew that...the test is changing the minfree values.

I thought of a guaranteed solution to this problem: Just add the echo command with your desired minfrees to Z99SwapOn...add a new line containing the command after the line that begins with swapon...then you don't need to use that set on boot service.
[Android Software/Hacking General [Developers Only]] eushaun99:
I have a suggestion. Maybe you can make the swapit script detect whether the swapfile is already created by older version of swapit? And if there is a swapfile then skip the creation of swapfile as it takes time. And if there isn't a swapfile then only create the file. Possible? Its just a file right? You don't change anything inside do you? Again, just a suggestion. If you can't then its fine. :)
[Android Software/Hacking General [Developers Only]] Lefteris Fragiadakis (Frago):
V6-v7 make my rom to lag a lot,something bug with swapiness my settings

External

171 swap file

10 swapiness

Ics

Xperia play

Older version perfect with this settings
[Android Software/Hacking General [Developers Only]] defiant07:
Took me a second to figure out why...but yeah that is a good idea, it would make updating faster if the user does not want to change the swapfile size.

This is definitely doable...I'll work on it and add this feature to the next update...the way it will work is: you'll go through all choices you do now including size and then when you reach the part where it actually makes the file if it detects a old swap file it will ask you if you want to make a new file with the size chosen in the opening options or skip making the swapfile.

It does not have anything do with your swappiness settings...they would be more or less constant across the different versions...

being that it's correlated with v6 and v7...it could be the changes made to the init.d script, which made it bootloop proof...the changes that were made are quite proven though (they come from V6 SuperCharger), so I doubt this is the cause...there were no other changes to v6 that would account for lag.

Does the lag clear after a while or is it constant?

Have you made any other system changes recently?

If you downgrade to v5 do things go back to normal?