Jump to content

[MOD] Swap to /system & /data & /cache


Guest kannasbor0

Recommended Posts

Guest kannasbor0

Hi everyone!

I made an init.d script, which creates 3 swap files (85 MB each), first in the /system, second in the /data, third in the /cache, and they significantly boost multitasking performance, becuse they're working in parallel mode.

I am using CM 10.1, but I think it it works with all roms.

You have to install busybox 1.20.2 from stericson with the pro app (I can't post it, because it's a paid app), because the other versions can't use swap files in parallel mode (the swapon applet does't have "-p" parameter, to set priorities, so the script exits, and doesn't create swap files), which is the main advantage of this script.

The script set swappiness to 90 ,removes and recreates the swap files at boot, so the boot time increased to 3 mins.

If you delete the "rm .../swap*.img" from the script, it will not deletes the files, so the boot time will be normal.

The matter why I remove, then recreate the files is that they dont't stress the specific part of the eMMC in this way.

Usage:

Backup your current rom.

Install busybox 1.20.2.

Copy 02Swap2SysDataCache file to /system/etc/init.d folder, and set permissions to 755 (rwxr-xr-x).

Reboot (2,5-3 mins each boot).

Enjoy!

You can check swaps with "cat /proc/swaps" command, if they have the same priority, you're done. :-)

Luca020400 made a flashable zip, download, and enjoy!

Thanks again luca! :)

Flashable zip

Swap2SysDataCache.zip

Edited by kannasbor0
Link to comment
Share on other sites

Guest anotherjib

 

You can check swaps with "cat /proc/swaps" command, if they have the same priority, you're done. :-)

 

It shows /dev/block/zram0 which is a partition with priority -1 and three files /system/swap1.img, /data/swap2.img and /cache/swap3.img all with priority 1

 

Does this mean all is well? :))

Link to comment
Share on other sites

Guest kannasbor0

It shows /dev/block/zram0 which is a partition with priority -1 and three files /system/swap1.img, /data/swap2.img and /cache/swap3.img all with priority 1

Does this mean all is well? :))

Yep, it's working! :)

I suggest you to disable zram (add a ".txt" extension to the name of the zram the script in the init.d folder), it stresses the cpu, so eats your battery.

Edit: Please give me feedback, does it boost your multitasking performance?

Edited by kannasbor0
Link to comment
Share on other sites

Guest anotherjib

Yep, it's working! :)

I suggest you to disable zram (add a ".txt" extension to the name of the zram the script in the init.d folder), it stresses the cpu, so eats your battery.

Edit: Please give me feedback, does it boost your multitasking performance?

Sorry for belated answer, was busy these days.

 

Could you please explain in more detail? In /system/etc/init.d I have files 00banner, 50selinuxrelabel, 90userinit, and your script. Which one do you mean?

 

And yes it helps a lot! Antutu went from 5731 to 7749!

 

P. S. In the thread http://www.modaco.com/topic/370237-all-modother-disableenable-swap-zram-fstrim/ Victod proposes to use the command

swapoff /dev/block/zram0

May I just add this line to your script?

 

P. P. S. Question obsolete, already managed to disable zram and installed fstrim, antutu now says 7777

Edited by anotherjib
Link to comment
Share on other sites

  • 1 month later...
Guest tarinka

Can you write to me step by step how to install this script, because i have installed this http://www.modaco.com/topic/371894-mod-rom-dragonsphere-team40-442-swapdragonx-boost-your-android-to-the-limitversion-1works-with-all-phones/. How to remove and install yours. I don't understand where to type this command   "cat /proc/swaps" command. Thnx in advanced, i use slimkat 5.9

Link to comment
Share on other sites

Guest anotherjib

Can you write to me step by step how to install this script, because i have installed this http://www.modaco.com/topic/371894-mod-rom-dragonsphere-team40-442-swapdragonx-boost-your-android-to-the-limitversion-1works-with-all-phones/. How to remove and install yours. I don't understand where to type this command   "cat /proc/swaps" command. Thnx in advanced, i use slimkat 5.9

You can enter "cat /proc/swaps" in (for example) Android Terminal Emulator. You can also use it to set permissions for the script.

First you must have busybox installed (and of course you must have root access).

Unzip the script anywhere on your phone;

Find it with simple explorer and copy it to the /system/etc/init.d folder

Now run terminal emulator; you will get a black window with "something@someotherthing:/ $"

Type su root (enter)

You must get "yetanotherthing #"

Type cd /system/etc/init.d (enter)

Type chmod 755 02Swap2SysDataCache (enter)

Reboot

To check if the script works - run terminal emulator again and type cat /proc/swaps

It must list three swap files (in /system, /data and /cache folders)

As for uninstalling the swapdragon script - I think the right way is to ask them for a flashable uninstall zip. Their script writes several things to build.prop and somewhere else and it is impractical to change them back by hand.

Link to comment
Share on other sites

  • 1 month later...
Guest anotherjib

I've just noticed that your script ceased to create the first swap file (in /system); the other two are there but this one is missing.

All three were there earlier but now only the second and the third appear. Do you know what to do? I've updated ROM several times (I have slimkat for u8833 (Huawei y300-0100)) but I did not notice after which update did it happen. Right now I'm on 6.6. Antutu is worse than before - 7540

Link to comment
Share on other sites

  • 2 weeks later...
Guest anotherjib

I've just noticed that your script ceased to create the first swap file (in /system); the other two are there but this one is missing.

All three were there earlier but now only the second and the third appear. Do you know what to do? I've updated ROM several times (I have slimkat for u8833 (Huawei y300-0100)) but I did not notice after which update did it happen. Right now I'm on 6.6. Antutu is worse than before - 7540

An update to the quoted question: my slimkat is currently 7.0, still the same problem. When I run the script manually then it works well - does create the system swap file. Any suggestions?
Link to comment
Share on other sites

Guest kannasbor0

An update to the quoted question: my slimkat is currently 7.0, still the same problem. When I run the script manually then it works well - does create the system swap file. Any suggestions?

Maybe the script runs too early or too late at boot, so you have to rename to 05-....... to make it work again.

Regards.

Link to comment
Share on other sites

Guest anotherjib

Maybe the script runs too early or too late at boot, so you have to rename to 05-....... to make it work again.

Tried, does not help :(

Would you suggest to try any other number? In /system/etc/init.d I currently have

00banner

05Swap2SysDataCache

09Dis-Zram0

50selinuxrelabel

77fstrim

90userinit

99SuperSUDaemon

Link to comment
Share on other sites

Guest anotherjib

Have you busybox pro ??

Or install the synopsis kernel

Yes I have busybox pro, and in fact the script worked fine before slimkat 6.2 (I believe; maybe later maybe earlier)

Do you still advise to try synopsis? If yes, how do I flash it?

Link to comment
Share on other sites

Guest luca020400

#!/system/bin/sh

#Use 1.20.2 Stericson BusyBox

#to make "swapon -p" working!

sleep(5)

mount -o remount,rw /system

mount -o remount,rw /data

mount -o remount,rw /cache

#system

rm /system/swap1.img

dd if=/dev/zero of=/system/swap1.img bs=1024 count=85000

mkswap /system/swap1.img

swapon -p 1 /system/swap1.img

#data

rm /data/swap2.img

dd if=/dev/zero of=/data/swap2.img bs=1024 count=85000

mkswap /data/swap2.img

swapon -p 1 /data/swap2.img

#cache

rm /cache/swap3.img

dd if=/dev/zero of=/cache/swap3.img bs=1024 count=85000

mkswap /cache/swap3.img

swapon -p 1 /cache/swap3.img

echo 90 > /proc/sys/vm/swappiness

Link to comment
Share on other sites

Guest porozex

No avail, /system swap still missing :(

try to remove the script from initd. and the swap.img's from the correspective folders then reboot and wipe cacke/dalvik.

after that copy it again to initd folder and give the correct permissions. i hope it will work like this

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.