Have Hero on my G1 but have questions? - G1 Q&A, Help & Troubleshooting

I am liking the Hero software and will diff be putting it on my Mytouch when some figures out how to root that phone.
1. I thought I would have more internal mem from the G1 after I did the part on the memory card in console? Hero running laggy and I thought the apps would run from my memory card ?
2. Bluetooth, notification lights not working when I recieve texts?
3. Laggy laggy lol it's awsome software

FenderGuy said:
I am liking the Hero software and will diff be putting it on my Mytouch when some figures out how to root that phone.
1. I thought I would have more internal mem from the G1 after I did the part on the memory card in console? Hero running laggy and I thought the apps would run from my memory card ?
2. Bluetooth, notification lights not working when I recieve texts?
3. Laggy laggy lol it's awsome software
Click to expand...
Click to collapse
1. They should run from the SD if it is correctly set up. You should be running with a linux-swap partition also. JAC says to not use anything bigger than 32mb but I have mine at 128mb with swappiness at 60 and haven't seen a loading screen since first boot.
2. BT and LED are not working in any Hero build. JAC is getting closer to getting BT fixed, and I bet LED is next.
3. The lag should abate soon after adjusting you swap settings (The swappiness is set in the a2sd.sh file)

i did a fat32, ext2, and linux-swap part in the console
Please explain #3?

So you can abd pull the a2sd.sh and adjust the swappiness settings from there and push it back?
As for A2SD still using up space, I believe the phone needs to be restarted for apps to be moved to the ext partition.

How can I tell if the apps are running the sd card? I thought the JACHeroski 2.7.4 already had the swapper in it?
I have a 8gb sc card did this Fat32 6936 Ext2 7448 Linux-swap 7576
I did take the twitter and books marks widgets off the main screen seems to be quicker...I would like optimize my G1 so the rom runs smooth, so far i like the rom

FenderGuy said:
How can I tell if the apps are running the sd card? I thought the JACHeroski 2.7.4 already had the swapper in it?
I have a 8gb sc card did this Fat32 6936 Ext2 7448 Linux-swap 7576
I did take the twitter and books marks widgets off the main screen seems to be quicker...I would like optimize my G1 so the rom runs smooth, so far i like the rom
Click to expand...
Click to collapse
If you don't have ADB, then type in the terminal:
$su
#cp /system/bin/a2sd /sdcard
Open the file in a text editor from your computer and change the echo 30 > swappiness value to whatever swapiness you want (Mine is 60 but I have a bigger swap partition. If you only have a 32mb partition I would leave it at 30, but I would recomnmend having 64mb and changing it to 60 swappiness)
then save to file back to the root of you sd card and type in terminal again:
$su
#mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
#cp /sdcard/a2sd /system/bin/a2sd
#reboot
and your swap settings are updated !

Cool thanks, I am actually going to take the 8Gb out and put in a 1gb, I am going to be selling the phone soon. Will the 1GB work for the apps to sd transfer?

FenderGuy said:
Cool thanks, I am actually going to take the 8Gb out and put in a 1gb, I am going to be selling the phone soon. Will the 1GB work for the apps to sd transfer?
Click to expand...
Click to collapse
Yes and no. It will work, but very slowly. The stock 1gb card is very slow.

Having an issue with this process:
Open the file in a text editor from your computer and change the echo 30 > swappiness value to whatever swapiness you want (Mine is 60 but I have a bigger swap partition. If you only have a 32mb partition I would leave it at 30, but I would recomnmend having 64mb and changing it to 60 swappiness)
What file is it?

FenderGuy said:
Having an issue with this process:
Open the file in a text editor from your computer and change the echo 30 > swappiness value to whatever swapiness you want (Mine is 60 but I have a bigger swap partition. If you only have a 32mb partition I would leave it at 30, but I would recomnmend having 64mb and changing it to 60 swappiness)
What file is it?
Click to expand...
Click to collapse
/system/bin/a2sd
as stated earlier, yo copy it to your sd card
Code:
su
cp /system/bin/a2sd /sdcard
Then edit the file and save it back to the card
Then use this command to push it back, then reboot.
Code:
su
mount -o remount,rw /dev/block/mtdblock3 /system
cp /sdcard/a2sd /system/bin/a2sd
reboot
Just make sure that after you've edited it and want to save you don't save it as a text file, which would add .txt

AdrianK said:
/system/bin/a2sd
as stated earlier, yo copy it to your sd card
Code:
su
cp /system/bin/a2sd /sdcard
Then edit the file and save it back to the card
Then use this command to push it back, then reboot.
Code:
su
mount -o remount,rw /dev/block/mtdblock3 /system
cp /sdcard/a2sd /system/bin/a2sd
reboot
Just make sure that after you've edited it and want to save you don't save it as a text file, which would add .txt
Click to expand...
Click to collapse
Don't worry about running 2.7.4 until it's completely refined. I am running 2.7.3 with a 64 mg swap partition and it is SUPERFAST with 6 home screens being used, with widgets on them all:
Crappy video quality:
http://www.youtube.com/watch?v=KxLZOhUA3R0

Related

app2sd with Cyanogen

after trying for a couple days i think i finally got all of the necessary components for the a2sd auto swap program to work on my phone, but i dont think it is working yet..
I partitioned my SD card (fat32 and ext2),
adb push c:\userinit\userinit.sh /system/sd ,
adb shell chmod 755 /system/sd/userinit.sh ,
adb shell reboot ,
the phone rebooted, but i think it is still saving apps to the phones hard drive.
also I entered cat /proc/ramzswap into my terminal console and it said that the good compression was at 71%
(since it said in the userinit.sh guide "To see if it is working enter: cat /proc/ramzswap in the terminal console app on the phone. You should have a XX% GoodCompress listed if it is working properly.")
any input would be apperciated
i am using cyanogen v3.6.8.1
shockaj said:
after trying for a couple days i think i finally got all of the necessary components for the a2sd auto swap program to work on my phone, but i dont think it is working yet..
I partitioned my SD card (fat32 and ext2),
adb push c:\userinit\userinit.sh /system/sd ,
adb shell chmod 755 /system/sd/userinit.sh ,
adb shell reboot ,
the phone rebooted, but i think it is still saving apps to the phones hard drive.
also I entered cat /proc/ramzswap into my terminal console and it said that the good compression was at 71%
(since it said in the userinit.sh guide "To see if it is working enter: cat /proc/ramzswap in the terminal console app on the phone. You should have a XX% GoodCompress listed if it is working properly.")
any input would be apperciated
i am using cyanogen v3.6.8.1
Click to expand...
Click to collapse
So are you trying to do a2sd, Swap, or both? If its just a2sd, its automatically done for you if you have partitioned card.
i am just trying to get a2sd.
i partitioned my phone using ubuntu and when i finished it said that the sd card was not formated but when i rebooted it the sd card was fine so im assuming its still patitioned..
shockaj said:
i am just trying to get a2sd.
i partitioned my phone using ubuntu and when i finished it said that the sd card was not formated but when i rebooted it the sd card was fine so im assuming its still patitioned..
Click to expand...
Click to collapse
Easiest way to check if its partitioned correctly is to goto recovery console.
Code:
parted /dev/block/mmcblk0
print
and it should display partitions on the SD card. If it doesn't look right to you...
How to partition your SD card from console (This requires the cyanogen recovery 1.3.1)
Example for my 8GB card.
Reboot and enter recovery (home+power) then go to console. Enter the below pressing "enter" after each line.
parted /dev/block/mmcblk0
print (to verfiy we know what size card we are dealing with. Mine was 8166 read below if yours is different)
rm 1 (if you had more than 1 partition you would want to rm them as well)
mkpartfs primary fat32 0 7526
mkpartfs primary ext2 7526 8166
quit
upgrade_fs
recovery
if your card isn't 8166 when you type print then you will need to modify those numbers to match your card size. You basically work back to figure out the totals. To figure it out, start with your cards total size. For example 8166 total Subtract 128 for swap (8038) minus 512 for ext (7526) the rest will go to fat32. Each partition starts where the other left off.
Click to expand...
Click to collapse
Toy around with the numbers if you want.
hi xsnipuhx
is there a way to chek the partition using command terminal from windows?
i have not been able to....
I have the latest cyanogen rooted firmware 1.6 and i want to have app2sd. Can i simply partition my sdcard to ext3 and re-install cyanogen? or is there more steps inbetween? thanks

How Do I move a certain app back to internal memory?

I have partitioned sd card and I have the hello im apk on the sd and I want it on my phone because it wont let me change my buddy pic it says please make sure your sd card is in the phone so Im going to try to put it back on internal storage to see if it works. So how do I move it? I parted with apps2sd but the app wont work with cyan 4.0.1 so how Do I move it?
Apps2sd is really an all or nothing proposition. You can't have one app on internal memory and the rest on the SD card.
If you want to get rid of apps2sd altogether I can tell you how to move everything back.
OTOH, if an app is complaining about the sd card it's probably talking about the fat32 partition that it wants to store images on. Is your fat32 close to being full or something?
on a side note im on cyan 4.0.1 I was at 3.6.8.1 when I used the apps2d app and now when I try to open it it says Oops! Looks like you need to go through the tutorial to set up apps to sd. Please go to blah blah blah why is it doing this
what do I have to do to get this app running gain I already haves apps going to sd.
The top part of Cyanogen's stable thread says not to use any other method of apps to sd because his has a script built in.
So. Stop fiddling with whatever apps2sd app you have.
go to terminal and type:
Code:
su
ls /dev/block/mm*
Tell me what you see. (And please take a moment to make your posts a little more readable, I'm having a hard time deciphering what you're asking/saying. )
what Am I suppost to do? I dont want to do it without knowing
open the application 'terminal emulator' -- this is like the dos 'command prompt' in windows or a term window in Linux
type 'su' and press enter -- this Switches User to root, or the administrator of the machine (your phone)
type 'ls /dev/block/mm*' -- 'ls' is 'list' directories. /dev is where all the devices are, block is hard-drive like devices (your internal memory and the sd card) and mm* is every block device that starts with 'mm....' which should be mmcblk0 (the sdcard), mmcblk0p1 (the fat32 partition) and mmcblk0p2 (the ext partition)
If the last exists, the cyanogen automatic apps2sd will have already moved all your applications there. If only one exists, it means you either formatted the whole SD card to ext2 for apps2sd (and left nothing fat32) or formatted none of it and your apps are already on your phone.
if your 'ls /dev/block/mm*' says that you have a mmcblk0p2, than run "ls /system/sd/app/*" and you should see a bunch of files ending in .apk. If so, then you have to undo apps2sd to get the Hello IM app back to internal memory.
Report back on the outputs of the above and further instructions will be provided.
Ok Iv done all that so how do I undo them and if so how will I get them back?
Tell me what all that said back when you typed it in. THEN I can tell you what to do.
I see all my apk files now what? I want to move that 1 app onto the phone memory and every other apk on the sd. Im ready for the next step.
I see a bunch of files ending in .apk now what?
Hmm. I just looked up 'Hello IM!' and see that it's a paid app.
So, we can move just paid apps to the internal memory and leave the free ones on the sd card.
if yes run the following in terminal emulator:
su
rm /data/app-private
mkdir /data/app-private
cp /system/sd/app-private/* /data/app-private
Copying the apps may not work and you may have to uninstall/reinstall, but when you install them they'll be on the internal memory.
Oh, but cyanogenmod will put them back on the sd card when you reboot, so if having the app on the internal memory does fix the problem, you'll have to edit the a2sd script.
The problem isn't that your apps are on the sdcard. The app itself doesn't know. Your partions may be out of whack or the app itself may just need to be reinstalled.
When your apps are on the sdcard they are on a different partition then what every app uses your sdcard for. Not sure if I wrote that where you can comprehend it or not...
wat do u mean out of wack
PsychoI3oy said:
If you want to get rid of apps2sd altogether I can tell you how to move everything back.
Click to expand...
Click to collapse
I've done some searching, and haven't found any way to do this that has worked for me. Could you please pass some of this info along?
Thanks.
HowTo - un-apps2sd (on CyanogenMod)
Ok, this is based on the assumption that you are running a Cyanogen rom. I'm sure it could be adopted for use on another one, but Cyanogen 4.0.x is what I'm running. You'll probably have to re-install any paid apps (app-private) but normal apps should run fine after this.
Instructions for use with adb:
Code:
adb remount
adb push a2sd.txt /system/bin/a2sd
adb shell
# rm /data/app
# mkdir /data/app
# cp /system/sd/app/* /data/app/
# rm /data/app-private
# mkdir /data/app-private
# cp -r /system/sd/app-private/* /data/app-private
# reboot
for terminal emulator, assuming the new a2sd.txt is on your sdcard:
Code:
mount -o rw,remount /system
mount -o rw,remount /data
cp /sdcard/a2sd.txt /system/bin/a2sd
and then continue the adb instructions from after 'adb shell'
after reboot you can confirm that it worked by running:
ls -l /system
from terminal emulator (no need to remount/su) and you should see 'app' and 'app-private' as directories (and not app -> /system/sd/app).
If you're running some other a2sd method, you'll have to edit/remove the script that's doing the linking, then delete the symlinks and copy back (should be similar to above).
The modified a2sd.txt attached just takes away the apps-to-sd part. Dalvik-cache is still run from /system/sd/ as are whatever other magical juicy bits he's got in there.
If you upgrade to another Cyanogen rom, the new version of a2sd will get pushed and everything will be moved back. The only way to get rid of it permanently would be to delete the ext2/3/4 partition on your sd card.
If you decide you want apps2sd again and don't want to upgrade, just put the a2sd.orig.txt back as /system/bin/a2sd and reboot, it'll automagically move everything back to the /system/sd/app on your ext partition.
I just did the un-apps2sd then put the original back and everything's fine (and was fine with un-apps2sd).
That should cover most things....
Thank you so much for the step by step instructions.
One minor correction, maybe, shouldn't there be a '/' at the end of the second to last line?
Also, for me I didn't copy over the modified a2sd.txt file. After I copied everything to internal I shutdown the phone and deleted the ext partition. All seems to be working well!
Thanks again.
daveerickson said:
Thank you so much for the step by step instructions.
One minor correction, maybe, shouldn't there be a '/' at the end of the second to last line?
Also, for me I didn't copy over the modified a2sd.txt file. After I copied everything to internal I shutdown the phone and deleted the ext partition. All seems to be working well!
Thanks again.
Click to expand...
Click to collapse
Trailing slashes are optional in most shells, including this one.
Glad it worked for you.
these doesn't seem to be working for 4.2.1, no a2sd file exists in /system/bin, maybe he moved it somewhere else, i'm trying to find it but i'm not being lucky.
any help?
No, he broke up the bits that were in a2sd and spread them across several files in /system/etc/init.d/
http://wiki.cyanogenmod.com/index.php/Removing_Apps2SD has the instructions now.

Question regarding SWAP

I've heard a lot that using swap will eventually kill your sd card no matter what. Is that true ? I am currently using Cyanogen Mod 4.0.4 with 32Mb swap. I flashed JAC's hero yesterday, but reflashed the CM just after an hour cuz it was freaking SLOW. Can anyone tell me another way to speed it up ? I dun wanna reformat the entire SD card to get a bigger SWAP size or change the swappiness since they are very tiring and confusing. I would be glad if someone could show me a detailed tutorial on how to modify all the stuffs about swap like swappiness, compcache with swap, with backing swap,... ( this is really confusing ). Thanks in advance
Ok well you will most likely need to repartition to increase your swap size if you wannas go hero, I would do a 96mb swap. If you need a guide on doing that lemme know but if you did it once it's the same thing again, just change the numbers a bit to allow for a 96mb linuw-swap. Now for changing swappiness the easiest way I think is to goto Terminal Emulator and type: echo 60 > /proc/sys/vm/swappiness
That will give you a swappiness of 60, I would go with 80 or 100 though as it will speed up hero quite a bit. As for killing your sd, don't worry about it cuz it will take over a year and by then I doubt you will have the same phone or sd, and eve if you do it doesn't kill your sd it just shrinks it's maximum size, slowly.
Anything else fire away.
An sdcard can only take some much read/write cycles so eventually it will start corrupting sectors of your sd but it would prob be a long time before you would notice, sd cards are cheap and will be cheaper by the time you wear out your card, as for repartioning, you can use parted in the recovery manager, I do not have the commands for it but if you look in a few posts here, this has been covered a couple times this past week
Hey codani, long time no see, I would stay and chat but I going to play some poker, it was pushed back and I have to get going
Gridlock for president 2016!!!!!!!!!!!!
kitten time mofo
Thanks guys, for all the information. My only last concern is how to change the swap's type, I mean like swap with backing up, compcache with swap, etc
Thanks again.
Well for hero I don;t think you need to bother with anything besides a linux-swap, and honestly I have never tried anything but that myself so if you are really interested in it I would say wait for someone who knows more about backing swap and compcache to reply.
Try a 96mb linux-swap with 100 swappiness and see how that does. Oh btw when you do terminal emulator and adjust the swappiness make sure yout type su and hit enter first.
crpercodani said:
Ok well you will most likely need to repartition to increase your swap size if you wannas go hero, I would do a 96mb swap. If you need a guide on doing that lemme know but if you did it once it's the same thing again, just change the numbers a bit to allow for a 96mb linuw-swap. Now for changing swappiness the easiest way I think is to goto Terminal Emulator and type: echo 60 > /proc/sys/vm/swappiness
That will give you a swappiness of 60, I would go with 80 or 100 though as it will speed up hero quite a bit. As for killing your sd, don't worry about it cuz it will take over a year and by then I doubt you will have the same phone or sd, and eve if you do it doesn't kill your sd it just shrinks it's maximum size, slowly.
Anything else fire away.
Click to expand...
Click to collapse
I've been looking for this forever. Thank you sir!
You wouldn't change swappiness like this in JacHero
If you wish to go with Hero, the instructions on how to format your SD card are right on the first page of JacHero...
If you want a FAAAAST Hero, and I mean FAST... like, 100% usable with no lag hero.... then use 96mb linux swap with 80 swappiness... turn off backing swap and compcache. You'll be blown away at how usable it is.
To do this, format your card as per the instructions, make sure you have 96mb linux swap.... flash the Hero rom. After booting into Hero, go to the market and download "text edit" -
Then...
go to terminal and:
su
rwsystem
cp /system/bin/user.conf /sdcard/user.conf
Open up text edit, press menu, then "open" and select your sd card and open the user.conf file. and set the en_compcache_CC and backing swap to "0" instad of 1, I can't think of the specific names, but it's obvious. Then set linux-swap to 1, and linux swap swappiness to 80. Save the file.. then
back in terminal,
su
rwsystem
cp /sdcard/user.conf /system/bin/user.conf
and that's it, I don't think you need to reboot the phone, but do it anyways... it'll be laggy for about 20 seconds while the swap builds up, then bam, lightning fast.
Hope this helps.
vr24 said:
You wouldn't change swappiness like this in JacHero
If you wish to go with Hero, the instructions on how to format your SD card are right on the first page of JacHero...
If you want a FAAAAST Hero, and I mean FAST... like, 100% usable with no lag hero.... then use 96mb linux swap with 80 swappiness... turn off backing swap and compcache. You'll be blown away at how usable it is.
To do this, format your card as per the instructions, make sure you have 96mb linux swap.... flash the Hero rom. After booting into Hero, go to the market and download "text edit" -
Then...
go to terminal and:
su
rwsystem
cp /system/bin/user.conf /sdcard/user.conf
Open up text edit, press menu, then "open" and select your sd card and open the user.conf file. and set the en_compcache_CC and backing swap to "0" instad of 1, I can't think of the specific names, but it's obvious. Then set linux-swap to 1, and linux swap swappiness to 80. Save the file.. then
back in terminal,
su
rwsystem
cp /sdcard/user.conf /system/bin/user.conf
and that's it, I don't think you need to reboot the phone, but do it anyways... it'll be laggy for about 20 seconds while the swap builds up, then bam, lightning fast.
Hope this helps.
Click to expand...
Click to collapse
I tried this and I did notice a difference in speed. But it also created a problem with loading screens (which I didn't have before) But This is still good advice as now I can mess with this on my phone. Other people may have better luck with these settings. I've also noticed that what works for one, may not work for someone else
vr24 said:
You wouldn't change swappiness like this in JacHero
If you wish to go with Hero, the instructions on how to format your SD card are right on the first page of JacHero...
If you want a FAAAAST Hero, and I mean FAST... like, 100% usable with no lag hero.... then use 96mb linux swap with 80 swappiness... turn off backing swap and compcache. You'll be blown away at how usable it is.
To do this, format your card as per the instructions, make sure you have 96mb linux swap.... flash the Hero rom. After booting into Hero, go to the market and download "text edit" -
Then...
go to terminal and:
su
rwsystem
cp /system/bin/user.conf /sdcard/user.conf
Open up text edit, press menu, then "open" and select your sd card and open the user.conf file. and set the en_compcache_CC and backing swap to "0" instad of 1, I can't think of the specific names, but it's obvious. Then set linux-swap to 1, and linux swap swappiness to 80. Save the file.. then
back in terminal,
su
rwsystem
cp /sdcard/user.conf /system/bin/user.conf
and that's it, I don't think you need to reboot the phone, but do it anyways... it'll be laggy for about 20 seconds while the swap builds up, then bam, lightning fast.
Hope this helps.
Click to expand...
Click to collapse
Either way will work, only downside to how I explained it was if you reboot you will lose the setting. The OP wanted the simplest way to do it and the way you explained is a bit more complicated although it may be permanent.
How do I verify swappieness? I.e. see what it's set at now.
tsnow247 said:
How do I verify swappieness? I.e. see what it's set at now.
Click to expand...
Click to collapse
su
vi /system/etc/user.conf
That'll open the file and your looking for swappiness
tsnow247 said:
How do I verify swappieness? I.e. see what it's set at now.
Click to expand...
Click to collapse
Assuming you use userinit.sh + user.conf setup, you should be able to do the following:
Code:
adb shell sh /system/sd/userinit.sh -s
in command prompt (the location of userinit.sh script might be different on your ROM).
This will list the status of the compcache module, linux swap, etc. See documentation here.

How to SWAP for tattoo

Warning : It can (and will) shorten SD or NAND lifespan.
A little tutorial for those who want to try swap on their tattoo without decreasing the life of their sd card.
Download the file attached here, or here.
And then do this :
Code:
adb shell "mkdir /data/swap"
adb push swapfile.swp /data/swap
adb shell
mkswap /data/swap/swapfile.swp
losetup /dev/block/loop0 /data/swap/swapfile.swp
swapon /dev/block/loop0
free ( to check if its running)
If you want to use it on the SD :
Code:
adb push swapfile.swp /sdcard/
adb shell
mkswap /sdcard/swapfile.swp
losetup /dev/block/loop0 /sdcard/swapfile.swp
swapon /dev/block/loop0
free ( to check if its running)
Keep in mind you must do losetup and swapon after each reboot.
Have been testing it for a while. No problems till now and delivers a very noticeable speed increase.
Thank you very much igstoian.
I'm gonna use it in my ROM if you don't mind.
Great that I can help.
Also post your experience with it. How is the speed gain?
Maybe this is a dumb question, but is it possible to enable swap even if my phone does not have custom boot.img??
I've rooted it, but not permanently (after a reboot I have to run the exploit again and I don't want to take the risk to brick it).
/Edit: WTF?! It's blazing fast Thank you!
Then you have to run the exploit and enable swap on every reboot if you want it...
You are actually using the data partitions for swap? And you think that increases SD card life? Sure it does, but what about the NAND flash that our data partition is, and has poorer life anyway than the damn 10 buck SDcard!?
eyegor said:
You are actually using the data partitions for swap? And you think that increases SD card life? Sure it does, but what about the NAND flash that our data partition is, and has poorer life anyway than the damn 10 buck SDcard!?
Click to expand...
Click to collapse
right
guess it's still too hard to change internal storages
It would be better to use a swap partition? A file is not the same as a partition.
Testing, swap file in system memory:
-a full day of use, the swap is 3 mb.
-30 programs loading into memory, the swap is less than 4 mb of use.
The use made is at least equal to a partition could increase. Or helping the compcache (I haven´t compcache)
It doesnt matter if its a file or a partition. you write files to a partition or you write info to a file. its still writing and its the read-write cycles that damages memory, not the amount of files being written.
lgstoian said:
Warning : It can (and will) shorten SD or NAND lifespan.
A little tutorial for those who want to try swap on their tattoo without decreasing the life of their sd card.
Download the file attached here, or here.
And then do this :
Code:
adb shell "mkdir /data/swap"
adb push swapfile.swp /data/swap
adb shell
mkswap /data/swap/swapfile.swp
losetup /dev/block/loop0 /data/swap/swapfile.swp
swapon /dev/block/loop0
free ( to check if its running)
If you want to use it on the SD :
Code:
adb push swapfile.swp /sdcard/
adb shell
mkswap /sdcard/swapfile.swp
losetup /dev/block/loop0 /sdcard/swapfile.swp
swapon /dev/block/loop0
free ( to check if its running)
Keep in mind you must do losetup and swapon after each reboot.
Have been testing it for a while. No problems till now and delivers a very noticeable speed increase.
Click to expand...
Click to collapse
Thankyo lgstoian for this how-to
Only a question:
Can I push swapfile.swp in /cache directory instead /data?
/chache has more space free
I guess you can. I haven't tryed it yet. But as it has been said in the thread it's preferable to use the sd and not any internal memory.
Wow, thank you, really speed improvement!
How to make it permanent? We have to modify init.rc in boot image?
Do you have to modify init.rc to make it permanent ? :/
Why not just use swapper?
http://code.google.com/p/a-swapper/
P
Thank you Paul : )
help
hello what we type and where type and what by type
paulobrien said:
Why not just use swapper?
...
P
Click to expand...
Click to collapse
Because not everyone flashed his tattoo and has a custom ROM, so for the folks who have to use the m7 exploit everytime after a reboot, the method lgstoian presented is the only choice
Greets
I have formatted a swap partition on my sdcard. How to use it??
Interesting. However, using swap on SD makes your SD Card unable to unmount. Internal Flash is better, 16MB on my end and I see no damage yet. And the swap is full too (16MB used, 0MB free!)
Yet. Exactly, no damage YET.
The nand flash uses a bad-block management system so i have no idea how one would notice it, i guess files getting corrupt and space being reduced.
Anyway, the only phones running android that need swap are the G1 and 32B magic.
Those phones simply have too little RAM, using straight compcache is a lot better for the 32A Magic (it resides in RAM, thus no damage) and hence the tattoo has the same amount of RAM it is better for it as well

[DEV-HINT] Implementing a swap partition or swap file for new and old bootloader

[DEV-HINT] Implementing a swap partition or swap file for new and old bootloader
Wikipedia defines swap file (or paging) as: "[..] use disk storage for data that does not fit into physical random-access memory (RAM)."
With CM10 or CM10.1 around, the 'about phone' screen usually shows 343 MB of usable RAM on the LG-P990, so one gets ideas. With CM9 it was a bit better, but still.... Take Chrome for example: nice to the eye, but not so nice to the RAM of devices that have been around a lot longer than the Nexus 4 with its whopping two Gigabytes. So what's the catch with swap? For example, a HDD swap partition on a PC offers some sort of relief when RAM is scarce by moving some parts of the RAM (pages) to the HDD and moving them back when it needs it. Of course, it comes for a price: performance! But it works. So why not using it on Android too? To hell with the fact that virtual RAM on the internal memory card is a lot slower than physical RAM, there are times when it would be just nice to have the extra megabytes at hand.
Were you a bit envious too when you saw that the 'new' partition layout that came with the ICS bootloader on our beloved LG-P990 had a swap partition included? Well, I was. I even changed to a customized layout to get one for a little while too... But that is not really necessary. Never was, actually. I came back to the original layout and old bootloader weeks ago. What still bugged me was the missing swap partition. CM10.1, CM10 or even CM9 could really use swap from time to time but commonly don't use it.
So, is there really a big difference between the two partition layouts? Yes, but regarding the swap it doesn't count. In fact, the situation for both user groups is pretty much the same: both do not use any kind of swap space whatsoever. First, there are the users with the new bootloader. They have the swap partition but actually don't make use of it. As compared with users with the old bootloader: they may not have the swap partition on their partition table but even they can easily implement a solution very similar to a standard swap partition: a swap file. Then they can benefit as well from some extra Megabytes in certain low memory situations. You don't have a swap partition/file in use yourself yet? In just a few minutes you can change that no matter what bootloader you have.
First you have to find out which bootloader/partition layout is on your LG-P990:
here is how you determine your bootloader/partition layout: reboot!
If you see a pink LG logo when the phone boots then you have the new bootloader/new partition layout (ICS)
If you see a white LG logo when the phone boots then you have the old bootloader / old partition layout(GB)
All commands used in the terminal are shown with a '$'-sign or '#'-sign (root). Copy just the commands without the signs to the terminal, unless stated otherwise.
New bootloader/partition layout (ICS) - Pink LG logo as splash screen - You have the old bootloader/partition layout? Skip to the second part below.
If you are using the new partition layout, then it is easy to use the swap mechanism. The 350MB swap partition is just waiting for you to be switched on.
Use 'adb shell' or the terminal:
check the situation with
Code:
$ free
Does it show 0 0 0 in the swap line? Then swap is not working at the moment and has to be switched on.
Use
Code:
$ su
to get superuser rights
Make the swap partition usable (Be extra careful! Triple-check the command!)
Code:
# mkswap /dev/block/mmcblk0p4
Switch it on
Code:
# swapon /dev/block/mmcblk0p4
Change swappiness to zero at runtime
Code:
# sysctl -w vm.swappiness=0
To keep the swap partition switched on, after reboot and even after flashing ROM updates
create the file /data/local/userinit.sh
Put these lines inside (with the '#' sign)
Code:
#!/system/bin/sh
swapon /dev/block/mmcblk0p4
sysctl -w vm.swappiness=0
swappiness=0 lets the kernel use the swap partition only when there is no more physical RAM left.
Save the file.
Now reboot.
Check it via adb shell or terminal if it is working.
Code:
$ free
The swap line should show that 350 MB are available (total/free).
Check the swappiness with
Code:
$ cat /proc/sys/vm/swappiness
It should show 0 now.
Testdrive your work. Start Chrome or a game or whatever uses a lot of RAM on your system. Use it heavily and then check the swap usage of your kernel again with a final
Code:
$ free
Just try it!
Old bootloader/partition layout (GB) - White LG logo as splash-screen
The task is to create a 128 MB Swap-File on the data partition. 128 MB seems enough since it is just for memory emergencies. And it's best to create it on the data partition and not on the sdcard because of the USB mass-storage support that would interfere with any swap file on sdcards. By the way, it doesn't format your data partition. It just makes your usable space of the data partition 128 MB smaller than it is right now. Basically, it creates an empty file with the fixed size of 128 MB and makes it usable as a swap 'partition'. It has the same functionality as a swap partition. And the same speed. And everything else. It just doesn't reside in its own partition. It is even better: when you don't want it anymore or change the size of it, just stop the swap-file with 'swapoff' and delete the file 'swapfile' in your data partition and it's gone for good. Immediately you can use the freed-up space for something else.
Use 'adb shell' or the terminal:
check the situation with
Code:
$ free
Does it show 0 0 0 in the swap line? Then it is not working at the moment and has to be switched on.
See with
Code:
$ df
whether there is enough free space left on /data. 200 MB or more should be free on /data. 128 MB will be used.
Get superuser rights
Code:
$ su
Optional: To see more interesting memory stats you can use
Code:
# cat /proc/meminfo
Now create the file named 'swapfile' with the size of 128 MB
Code:
# dd if=/dev/zero of=/data/swapfile bs=1024 count=128000
This can take a moment.
Limit the rights of the swapfile
Code:
# chmod 600 /data/swapfile
now set up the swapfile for swap usage
Code:
# mkswap /data/swapfile
Switch it on
Code:
# swapon /data/swapfile
Hint: switch off would be swapoff /data/swapfile
Now it is already working!
Tune it to your needs: we just want the swap file to be used in emergencies when there is no RAM left anymore and Android would turn Project Butter in Project Stutter.
Check the status of swappiness
Code:
# cat /proc/sys/vm/swappiness
Default is 60. That is much too high. swappiness=0 lets the kernel use the swap file only when there is no more physical RAM left.
Change it to zero
Code:
# sysctl -w vm.swappiness=0
With this sysctl command you can change the swappiness setting (0-100) on runtime.
If you want to make these settings permanent no matter if you reboot or even flash a ROM update without wiping data then
create the file /data/local/userinit.sh
Put these lines inside (with the '#' sign)
Code:
#!/system/bin/sh
swapon /data/swapfile
sysctl -w vm.swappiness=0
Save it.
Reboot and check it with a last
Code:
# free
in terminal. Now testdrive your swap file with two browsers and a game simultanously or whatever suits your needs to stress your P990.
Just try it yourself!
Have fun!
and another awesome dev thread by Raum1807 :good:
Interested in making a flashable zip out of it? If not I could do it next week.
Just adding everything into one sh-file which gets called by the updater-script - or just via the Terminal.
tonyp said:
and another awesome dev thread by Raum1807 :good:
Interested in making a flashable zip out of it? If not I could do it next week.
Just adding everything into one sh-file which gets called by the updater-script - or just via the Terminal.
Click to expand...
Click to collapse
Thanks for the offer. Thought about that, too. But I think it is more interesting to understand what we are doing here by following it step-by-step. A script makes it too easy... Maybe later, we will see.
sorry for this dumb question.
what's the difference between using this method and using roehsoft ram expander?
both of them have the option to change swappiness and to enable/disable swap from sdcard (roehsoft ram expander can even choose ext sd as swap location)
i don't get it :silly:
old bootloader:
/data/swapfile # that's internal sd right?
wouldn't it be better to use external sd for swapping as swapping heavily might in the long run kill a flash drive?
derEremit said:
old bootloader:
/data/swapfile # that's internal sd right?
wouldn't it be better to use external sd for swapping as swapping heavily might in the long run kill a flash drive?
Click to expand...
Click to collapse
i don't think so, AFAIK the max reading speed for ext sd is 10 MBps, which is lower than reading speed in our int sd (about 13 MBps). that's why using int one for swapping would be a better choice
please CMIIW, i'm still noobs in this kind of stuff. though, i just want to share what i know
I have one point to this.
You write "swappiness=0 lets the kernel use the swap partition only when there is no more physical RAM left."
But there is every time some free space on RAM, because android never let decrease memory to zero.
babi_perang said:
sorry for this dumb question.
what's the difference between using this method and using roehsoft ram expander?
both of them have the option to change swappiness and to enable/disable swap from sdcard (roehsoft ram expander can even choose ext sd as swap location)
i don't get it :silly:
Click to expand...
Click to collapse
- Doesn't use the external sdcard
- Doesn't cost 7 Euro
- gives you an idea how things work
Sent from my LG-P990 using xda app-developers app
derEremit said:
old bootloader:
/data/swapfile # that's internal sd right?
wouldn't it be better to use external sd for swapping as swapping heavily might in the long run kill a flash drive?
Click to expand...
Click to collapse
Swapping is only happening when the RAM is critically low. Btw, the swap partition of the ICS partition layout is also located on the internal memory. No difference so to speak. Using this method shouldn't harm the internal memory at all.
Sent from my LG-P990 using xda app-developers app
tomsi91 said:
I have one point to this.
You write "swappiness=0 lets the kernel use the swap partition only when there is no more physical RAM left."
But there is every time some free space on RAM, because android never let decrease memory to zero.
Click to expand...
Click to collapse
Yes, the memory management of Android tries to keep the RAM clean while keeping the last few opened apps in the RAM. Four or five running CM10.x on the P990. But the less RAM you have on your phone the harder this balance gets. Imagine memory eating apps like Gallery/Camera or Chrome. They benefit from more memory being available.
Sent from my LG-P990 using xda app-developers app
Thank you for this helpful guide! It is so easy to make it. And now I know a bit much more about Android and RAM.
Gesendet von meinem LGP990 mit CM10.
Hey! This seems interesting but i have a question , before doing this we have 343 RAM available and after all this trouble only 350 ? so thats 7more RAM or am i missing something ?
Soare23 said:
Hey! This seems interesting but i have a question , before doing this we have 343 RAM available and after all this trouble only 350 ? so thats 7more RAM or am i missing something ?
Click to expand...
Click to collapse
Yes, you forgot to read the original post that explains what exactly swap is:
So what's the catch with swap? For example, a HDD swap partition on a PC offers some sort of relief when RAM is scarce by moving some parts of the RAM (pages) to the HDD and moving them back when it needs it. Of course, it comes for a price: performance! But it works. So why not using it on Android too? To hell with the fact that virtual RAM on the internal memory card is a lot slower than physical RAM, there are times when it would be just nice to have the extra megabytes at hand.
Click to expand...
Click to collapse
The reported RAM will remail the same because you aren't increasing your physical RAM.
When i try to creat a swap file, this Error appears:
/def/zero/: canot open for read: Not directory
I'm a superuser
---------- Post added at 09:20 PM ---------- Previous post was at 09:13 PM ----------
After disconnecting from computer it worked!
Swappiness=0 doesn't stick for me after reboot It returns to 60 everytime.
@Raum1807
Awesome thread. Thanks for kindly explaining everything. I learned a lot here!
Ajsh said:
Swappiness=0 doesn't stick for me after reboot It returns to 60 everytime.
Click to expand...
Click to collapse
just put:
echo "0" > /proc/sys/vm/swappiness
at the end of a .sh file in init.d
As we´re talking about using the wasted Swap-Partition:
Is it possible to use it as a "new" kind of Ramhack?
As for now we cut off some shared Ram of GPU to use it as normal RAM. What if we let the GPU use the Swap-Partition as its Memory and get all physical RAM available?
GPU will not perform as good as now, but some People don´t need a Phone to play Games...
Is this possible or restricted to some Nvidia-Libs that are Closed-Source??
zerocoolriddler said:
As we´re talking about using the wasted Swap-Partition:
Is it possible to use it as a "new" kind of Ramhack?
As for now we cut off some shared Ram of GPU to use it as normal RAM. What if we let the GPU use the Swap-Partition as its Memory and get all physical RAM available?
GPU will not perform as good as now, but some People don´t need a Phone to play Games...
Is this possible or restricted to some Nvidia-Libs that are Closed-Source??
Click to expand...
Click to collapse
This is interesting... it could really make a difference , only if it works tho heh.
Sent from my LG-P990 using xda app-developers app
Can we have both Swap and Zram on in CM 10 ? Any possible side effects

Categories

Resources