Related
I have manage to install the app 2 sd to my G1. but I have notice that even when i am installing new app, it is still taking the memories from my phone .
for example. I installed Docs to go. the actual size of the app was 4MB and it took 3 MB from my pone internal memories.
I have checked and i am 100% sure that I have done the app2sd correct coz the ext2 memory have been used.
Can anyone tell me if I have missed out something ...... I followed the steps from below.
http://android-dls.com/wiki/index.php?title=Haykuro_Apps_to_SD
and i am using a 5.0.2hr rom
I am not sure about any of the Haykuro roms, however most work about the same. Using adb shell type #mount and you should see /dev/block/mmcblk0p2 on /system/sd followed by ext2 or ext3.
You can also use #busybox df -h
/dev/block/mmcblk0p2 (your ext partition) (Used MBs) (Free MB) (Free space%) /system/sd
Now just because your apps are being stored to sd, there are still a couple other things that can be stored to sd as well.
Dalvik-cache
Cache
app
app-private
data (but not recommended)
media
Click here for an excellent method of moving them to the ext2/ext3 partition. Note: It is recommended that you have a class 6 card (no slower then class 4) otherwise you may experience issues to include frequent force closes, lag, system hangs, etc.
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
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
My nook color is back to 1.1.0 now. I want to say thank you to all of you guys for helping me out. It was such a great experience here and I really appreciate it.
What happened is that Joja15 helped me to create the missing partitions, and then something miraculously happened during charging: it just booted all up to 1.1.0, which I had on emmc before it got stuck. I could never have done this on my own without the help. Thank you so much Joja !
Liz
This is how it was done after you have adb working:see the original thread here:
http://forum.xda-developers.com/showpost.php?p=13003431&postcount=166
(1) Connect Nook to PC
(2) Boot Nook into CWM off of uSD card.
(3) Verify ADB is connecting to nook by issuing the command:
adb devices
(4) If you see a serial number you are connected. Next go into adb shell by typing:
adb shell
(5) Before going any further we will want to back up your partitions 1-3 as they contain important unique information for your nook like the serial number. Make sure you 450mb of free space on your SD card.
(6) Issue the following command to backup your mmcblk0p1 boot partition to your SD card.
dd if=/dev/block/mmcblk0p1 of=/sdcard/mmcblk0p1-boot.img
(7) Issue the following command to backup your mmcblk0p2 rom partition to your SD card.
dd if=/dev/block/mmcblk0p2 of=/sdcard/mmcblk0p2-rom.img
(8) Issue the following command to backup your mmcblk0p3 factory partition to your SD card.
dd if=/dev/block/mmcblk0p3 of=/sdcard/mmcblk0p3-factory.img
(9) Once your first three partitions are backed up in adb shell go into fdisk by typing:
fdisk /dev/block/mmcblk0
(10) Upon issuing the fdisk command you should see the following:
Command (m for help):
(11) Type m to get the help menu:
m
(12) You should see the following:
Command Action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
(13) We will use the above commands to recreate our partition table. First lets see what our current one looks like. Issue the print command by typing:
p
(14) You should see the following but probably will not because your partition table is screwed up what is listed below is what you will want to see once you have recreated your partitions:
Disk /dev/block/mmcblk0: 7944 MB, 7944011776 bytes
255 heads, 63 sectors/track, 965 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 * 1 9 72261 c Win95 FAT32
A)
/dev/block/mmcblk0p2 10 18 72292+ c Win95 FAT32
A)
/dev/block/mmcblk0p3 19 56 305235 83 Linux
/dev/block/mmcblk0p4 57 935 7060567+ 5 Extended
/dev/block/mmcblk0p5 57 114 465853+ 83 Linux
/dev/block/mmcblk0p6 115 236 979933+ 83 Linux
/dev/block/mmcblk0p7 237 281 361431 83 Linux
/dev/block/mmcblk0p8 282 935 5253223+ c Win95 FAT32
A)
(15) We will need to first delete the partition #4 using the d command. Enter d and it should ask you which partition to delete. You will want to select or enter the mmcblk0p4 one or the #4 partition. I entered "4".
(16) Now that it is deleted we will want to create the #4 partition fresh. Issue the following command to create a partition:
n
When you enter the n command it will ask you questions like the start, the end, and the type of partition. Use the information in the print out above to enter the correct information. After you create a partition use the print command "p" to look at the partition layout and make sure that it matches the above for the new partition you created. If it does not delete the partition and create it again with different settings until it does. I tried this step several times before it was done in the correct way
(17) Use the n command to create partitions 5,6,7, and 8. Same as partition 4, it took me several times to get this done.
After that step I got a very similar layout as in step 14, but not exactly the same.
So I took the SD card out and planned to charge the NC. And that is when my nook color booted all up to rooted 1.1.0.
Hi, I am new here. Please talented people hear me out.
What happened to my NC is that I have it rooted by auto no, and CM7-ed, and it's been amazing. (Thanks to all of you guys!)
But one day, 2 days after RC4 I messed up somehow. Now my nook color won't boot right, it stuck at the n screen forever, if I don't hold the power button to power it off. I tried a lot of things here on this forum. Most of the time I get this error msg: can't mount /cache, can't format /system, install aborted......
So I removed CWR, then try to use the 8 interruptions plus the N+POWER key. It always give me the install failed msg after it started to install. I've tried to power it up after this and nothing changed. I have tried this for more than 10 times, crying now, any advice will be appreciated!
Launch cwr from SD, and use adb:
fdisk /dev/block/mmcblk0 -l
And print the output here.
Sent from my Desire HD using XDA App
ktan said:
So I removed CWR, then try to use the 8 interruptions plus the N+POWER key. It always give me the install failed msg after it started to install. I've tried to power it up after this and nothing changed. I have tried this for more than 10 times, crying now, any advice will be appreciated!
Click to expand...
Click to collapse
Do as Sam pointed out... however... the 8 failed reporting install failed is not a real uncommon item.
Even though you get the install failed message... power off by holding power button... holding "n" button... power on... keep holding "n" it should boot to factory clear... do the clear... then it will (probably) boot normally.
After that... there are things we can do to fix the 8 failed boots...
Thanks for the reply.
I will try this after work today then update here.
samuelhalff said:
Launch cwr from SD, and use adb:
fdisk /dev/block/mmcblk0 -l
And print the output here.
Sent from my Desire HD using XDA App
Click to expand...
Click to collapse
I did this power + "n", and did the factory clear. When it's done the NC automatically reboot, then it stuck at N as always
What is next then?
DizzyDen said:
Do as Sam pointed out... however... the 8 failed reporting install failed is not a real uncommon item.
Even though you get the install failed message... power off by holding power button... holding "n" button... power on... keep holding "n" it should boot to factory clear... do the clear... then it will (probably) boot normally.
After that... there are things we can do to fix the 8 failed boots...
Click to expand...
Click to collapse
I get this:
C:\android-sdk-windows\platform-tools>adb shell
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
~ # fdisk /dev/block/mmcblk0 -l
fdisk /dev/block/mmcblk0 -l
Disk /dev/block/mmcblk0: 7944 MB, 7944011776 bytes
255 heads, 63 sectors/track, 965 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 * 1 9 72261 c Win95 FAT32 (LB
A)
/dev/block/mmcblk0p2 10 18 72292+ c Win95 FAT32 (LB
A)
/dev/block/mmcblk0p3 19 56 305235 83 Linux
/dev/block/mmcblk0p4 57 935 7060567+ 5 Extended
~ #
samuelhalff said:
Launch cwr from SD, and use adb:
fdisk /dev/block/mmcblk0 -l
And print the output here.
Sent from my Desire HD using XDA App
Click to expand...
Click to collapse
If you have the cwr working from sd, just download the latest cm7 and place it on the sd card. Boot from the sd to cwr and choose install zip from sd card, install the cm7 zip you just downloaded.
Sent from my DROID2 using XDA App
If thats all you have on your emmc, then 4 partitions are missing.
Could someone help him rebuild the partitions using fdisk or parted, based on the stock layout? I don't have time right now.
Rebuilding of system, data, cache and media is needed.
What have you done to mess with partitions? Dual-boot?
See this thread for what you're supposed to print with fdisk: http://forum.xda-developers.com/showthread.php?t=942324
Sam
Sent from my Desire HD using XDA App
I've tried stuff here and there, after got stuck at n screen. Not dual-boot I think. Now I know what I have messed up
Thank you for the reply. I am going to study that thread.
And please, any help from you guys will be great.
samuelhalff said:
If thats all you have on your emmc, then 4 partitions are missing.
Could someone help him rebuild the partitions using fdisk or parted, based on the stock layout? I don't have time right now.
Rebuilding of system, data, cache and media is needed.
What have you done to mess with partitions? Dual-boot?
See this thread for what you're supposed to print with fdisk: http://forum.xda-developers.com/showthread.php?t=942324
Sam
Sent from my Desire HD using XDA App
Click to expand...
Click to collapse
I've tried to install from zip file (stock). It just say install aborted. As you said, maybe i should try CM7 instead.
juvetch said:
If you have the cwr working from sd, just download the latest cm7 and place it on the sd card. Boot from the sd to cwr and choose install zip from sd card, install the cm7 zip you just downloaded.
Sent from my DROID2 using XDA App
Click to expand...
Click to collapse
How can you flash anything..? You don't have the appropriate partion layout..
You need to add the 4 missing partitions..
You should use parted (adb command). But if you have no clue and wish to use a GUI.. read the following, but I wont be held responsible for any damage..
If you choose to try, it's your responsibility all the way.. read the thread entirely before you attempt anything.
If you want repartition using a GUI on Linux, you can use a live cd:
For the following I would use gparted (linux disk utility). You can find a lot of info on Google if your not sure. Easiest is to use an Ubuntu.live CD and launch gparted.
- First with ADB:
- Boot with a bootable CWR. Once booted:
- then: echo /dev/block/mmcblk0 > /sys/devices/platform/usb_mass_storage/lun0/file
- The last command will mount your entire internal 8gb partition to your PC
Open Gparted:
- Select the 8GB drive (top right)
- you should see the4 existing partitions, with the extend at the end, on which you'll create the four missing partitions (system, data, cache and media, in that order)
- Unmount all partitions.
- Add the missing partitions starting with system, right after the extended partiton, find stock layout as an example and for partiton size references (from memory around 500 MB, then 900MB, then 350 and then 5GB, but find the exact size!)
- WARNING: every time you create a partition, make sure you choose round to cylinder and not MB, PLUS make sure you always leave a 1MB as preceding space, except for first partition (boot). If you don't follow this last recommendation, you'll end up with partitions writing over one another = corrupting partitions... Always leave a 1MB free space preceding.
- Finish by applying settings (nothing will be written to the disk before you apply). Then unmount the drive and reboot to cwr SD.
After that you can flash any rom to your nook to get it to boot again..
If you want to use command line partitioning, use fidsk/parted. Google it.
Again, if you attempt any of this, keep in mind you're playing around with the internal memory. IF anything goes wrong, you'll be left with sdcard booting only. But you'd really have to make a big mistake to get screwed.
And take time to check each step.. Instead of having to go through the process twice..
Sent from my NookColor using Tapatalk
Sam,
Thanks for all these input...
You are right. I am too stupid to see the truth I don't even have the right patition at this moment. I might go ahead start from parted. Need some serious reading before I screw up further more.
See this post in same thread Sam pointed earlier... it has a 7z copy of the partition 4 (mmcblk0p4) that will correct the other partition structures... then the 8 failed should work... it did on the one I was helping in that thread.
http://forum.xda-developers.com/showpost.php?p=12674635&postcount=18
I found my problem very similar to JoJa15.
When I check my recovery by this:
in adb mount mmcblk0p3 to /emmc and list its contents:
adb shell
mount /dev/block/mmcblk0p3 /emmc
ls /emmc
I found I have only two files:
ls /emmc
factory.zip lost+found rombackup.zip
~ #
This is different from what JoJa15 has. I did read on, but really hesitant to follow the posts after that before further guidance......I am afraid I will mess up with something again. So please tell me what to do next? I am so happy now, this seems to be going somewhere. Many many thanks!
DizzyDen said:
See this post in same thread Sam pointed earlier... it has a 7z copy of the partition 4 (mmcblk0p4) that will correct the other partition structures... then the 8 failed should work... it did on the one I was helping in that thread.
http://forum.xda-developers.com/showpost.php?p=12674635&postcount=18
Click to expand...
Click to collapse
ktan said:
I found my problem very similar to JoJa15.
When I check my recovery by this:
in adb mount mmcblk0p3 to /emmc and list its contents:
adb shell
mount /dev/block/mmcblk0p3 /emmc
ls /emmc
I found I have only two files:
ls /emmc
factory.zip lost+found rombackup.zip
~ #
This is different from what JoJa15 has. I did read on, but really hesitant to follow the posts after that before further guidance......I am afraid I will mess up with something again. So please tell me what to do next? I am so happy now, this seems to be going somewhere. Many many thanks!
Click to expand...
Click to collapse
Those are the only 2 files you should have on mmcblk0p3.
If you dd mmcblk0p4 file I provided in that thread... it will fix mmcblk0p5-8 and the 8 failed shoule work.... since the partitions will exist and be properly formatted.
Just be careful of you where you DD to. And make a DD image of 02 (rom) before you try anything..
Sent from my Desire HD using XDA App
samuelhalff said:
Just be careful of you where you DD to. And make a DD image of 02 (rom) before you try anything..
Sent from my Desire HD using XDA App
Click to expand...
Click to collapse
I'd also make DD image of 03.
Factory.zip is general and rom backup would be done with /rom..
But yeah, your never too careful..
Sent from my Desire HD using XDA App
I tried this
Code:
~ # dd if=/sdcard/mmcblk0p4-logical.img of=/dev/block/mmcblk0p4
dd if=/sdcard/mmcblk0p4-logical.img of=/dev/block/mmcblk0p4
dd: can't open '/sdcard/mmcblk0p4-logical.img': No such file or directory
~ #
I am definitely not doing this right.......
DizzyDen said:
Those are the only 2 files you should have on mmcblk0p3.
If you dd mmcblk0p4 file I provided in that thread... it will fix mmcblk0p5-8 and the 8 failed shoule work.... since the partitions will exist and be properly formatted.
Click to expand...
Click to collapse
Please bear with me coz I am really not familiar with adb.......
Could you please walk me through the steps right after this? Thanks a lot, I really appreciate it.
DizzyDen said:
Those are the only 2 files you should have on mmcblk0p3.
If you dd mmcblk0p4 file I provided in that thread... it will fix mmcblk0p5-8 and the 8 failed shoule work.... since the partitions will exist and be properly formatted.
Click to expand...
Click to collapse
[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