[MOD] Increase RAM memory size(without swapper!) (good for gaming)

Search This thread

bamsbamx

Senior Member
Aug 2, 2011
572
591
Bilbo
livenfun.com
Hi, here is a good mod specially for gaming and ICS roms which consumes big memory amount!!!

It is basically an .sh script that enables swapping. This makes device use part of sdcard to use it as RAM memory, so it can be increased a lot...

The only requirement is have root, use relatively fast sdcard and have enabled init.d scripts..

WI always have used this mod on my phone so i think it no needs testing :)

To it follow these steps:
1.- Root your device

2.- Make a swap partition in your sdcard (this step will format your sdcard!)
http://forum.xda-developers.com/wiki/SD_card_partitioning
2.1-In step 3 select "swap partition"
2.2-I recommend to make ~512MB partition because the SO will be going to fill it during you use the phone, but i always had 1GB partition, and no problems ;) You can select 100MB or 50MB, but this is too little

3.- Check if there is a folder called init.d inside /system/etc/
3.1-If its there, follow next steps
3.2-If it is not there, you must activate init.d support, follow this tutorial: http://forum.xda-developers.com/showthread.php?t=1422061

3.- Copy 00userinit file to your device (must remove the .txt extension of the file, because i needed to put it to attatch the file)

4.- With root explorer, xplore, or similar copy it to /system/etc/init.d

5.- Set all permissions: rwxr-xr-x

6.- Reboot device

7.- For checking if it works, download Terminal emulator and type "free". See attatchment.

8.- If "swap" line has no "0" value, it works, congratulations ;)

With this, you will:
Have swapping activated in your phone permanently, or until you remove that script or change of ROM.

Have bigger RAM memory amount, depending on your swap partition size

If you use supercharger or any RAM manager program, i should recomend you to activate hard gaming option, because:
-As you have bigger RAM memory, the useless aplications, instead of be closed, they will be stored in your sdcard partition so, you re able to have multitasking and hard gaming option at the same time


But this is not all!! You can open and edit this file to adapt it to your requirements:
You can edit this line to set swapiness cuantity, this defines the OS tendency to use swap partition, I not recommend to set it to 100, but 60 is good. Also, if you have slower sdcard, you should set it to 30~40:
-Change 60 value by something you want from 1 to 100 "then echo 60 > /proc/sys/vm/swappiness;"

If you have another sdcard partition like EXT4 or something to APP2SD, you should change the last number of "mmcblk0p2" by the number of the partition, i mean:
-If you have 3 partitions with this order: Fat32(that you use everyday), EXT4, and SWAP you should change it by mmcblk0p3
-If 3 partitions with this order: Fat32, SWAP,and EXT4, you should set it mmcblk0p2

I forgot it! To use this, remember that you should:
INSTALL THE LATEST BUSYBOX VERSION!!!

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

FOR THOSE WHO HAVE NOT WORKING, DELETE 00userinit and follow the steps with 01userinit attatched file
 

Attachments

  • 00userinit.txt
    185 bytes · Views: 38,923
  • shot_000005.jpg
    shot_000005.jpg
    16.2 KB · Views: 24,330
Last edited:

mehdi.moha

Senior Member
Dec 21, 2010
1,925
251
Vaxjo
i already have linux swap partition and use "swapper 2 " with doom kernel

after using swap we should disable ( turn off ) the swapper2 and then mount the SD card to computer ... so , my question is , is your script the same ? or it can disable - enable itself automatically ?
 
  • Like
Reactions: DiamondBond

extremetempz

Senior Member
Jun 8, 2012
440
387
Hi, here is a good mod specially for gaming and ICS roms which consumes big memory amount!!!

It is basically an .sh script that enables swapping. This makes device use part of sdcard to use it as RAM memory, so it can be increased a lot...

The only requirement is have root, use relatively fast sdcard and have enabled init.d scripts..

WI always have used this mod on my phone so i think it no needs testing :)

To it follow these steps:


With this, you will:



But this is not all!! You can open and edit this file to adapt it to your requirements:


I forgot it! To use this, remember that you should:

Will this reck your phone in the long run
 
  • Like
Reactions: SShadowXX

bamsbamx

Senior Member
Aug 2, 2011
572
591
Bilbo
livenfun.com
This can't 'wreck a phone' but it can make the life of the SDCARD shorter.

That is what says some people, but i always have used it and no problems...

In addition, sdcard life is sure longer than 10 years, if you use swap constantly it could be reduced to7 or 8...

Then, it makes no sense to say that, because you probably will buy another sdcard in less than 5 years ;)
 

jimmyvau

Senior Member
Jun 8, 2011
87
33
Saint Louis
I tried this without success. I had to change the script that you provided. First I added #!/system/bin/sh to line 1 so it would run as a shell script and then the partition on my device was /dev/block/mmcblk0p3. I had to do the following to figure out which partition on my sdcard was actually set as swap. Once I edited the script with the addition to line 1 and the correct partition everything worked as expected.

Code:
~ # su
[email protected]:/ # fdisk -l /dev/block/mmcblk0

Disk /dev/block/mmcblk0: 31.9 GB, 31914983424 bytes
255 heads, 63 sectors/track, 3880 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

              Device Boot      Start         End      Blocks  Id System
/dev/block/mmcblk0p1               1        3818    30666992   c Win95 FAT32 (LBA)
/dev/block/mmcblk0p2            3818        3849      250000  83 Linux
/dev/block/mmcblk0p3            3850        3880      249007+ 82 Linux swap

And my 00userinit script looks like:
Code:
#!/system/bin/sh
if [ -n /dev/block/mmcblk0p3 ]; 
  then mkswap /dev/block/mmcblk0p3; 
fi;

if [ -e /dev/block/mmcblk0p3 ];
  then echo 60 > /proc/sys/vm/swappiness; 
  swapon /dev/block/mmcblk0p3; 
fi;

I'm running FXP 142 CM9.1.
 

bamsbamx

Senior Member
Aug 2, 2011
572
591
Bilbo
livenfun.com
I tried this without success. I had to change the script that you provided. First I added #!/system/bin/sh to line 1 so it would run as a shell script and then the partition on my device was /dev/block/mmcblk0p3. I had to do the following to figure out which partition on my sdcard was actually set as swap. Once I edited the script with the addition to line 1 and the correct partition everything worked as expected.

Code:
~ # su
[email protected]:/ # fdisk -l /dev/block/mmcblk0

Disk /dev/block/mmcblk0: 31.9 GB, 31914983424 bytes
255 heads, 63 sectors/track, 3880 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

              Device Boot      Start         End      Blocks  Id System
/dev/block/mmcblk0p1               1        3818    30666992   c Win95 FAT32 (LBA)
/dev/block/mmcblk0p2            3818        3849      250000  83 Linux
/dev/block/mmcblk0p3            3850        3880      249007+ 82 Linux swap

And my 00userinit script looks like:
Code:
#!/system/bin/sh
if [ -n /dev/block/mmcblk0p3 ]; 
  then mkswap /dev/block/mmcblk0p3; 
fi;

if [ -e /dev/block/mmcblk0p3 ];
  then echo 60 > /proc/sys/vm/swappiness; 
  swapon /dev/block/mmcblk0p3; 
fi;

I'm running FXP 142 CM9.1.

Dont know what happened, the script I provided works for me, maybe you had to add that because you are running CM...

And what you say about partition number, I already stated that in original post.... thanks for reporting ;)
 

bamsbamx

Senior Member
Aug 2, 2011
572
591
Bilbo
livenfun.com

i think its different, i dont know how does it work, but reading its description I think that this app creates a swap file, instead of using swap partition.. I think this is worse method than i have posted, because system compresses all swapped memory into a file,so it could be slower... In addition, you must install an app to make it work, which means a service running in background, less space for other apps, etc,etc...

I dont know, but i think my method is better ;)
 

alex.mircea0509

Senior Member
Dec 27, 2009
78
21
ploiesti
Hello, can you tell us how this interferes with z-ram? I have z ram init.d script activated also. What is your recomandation? Turn it off or keep them both? Thx
 

alex.mircea0509

Senior Member
Dec 27, 2009
78
21
ploiesti
Is there a way u could do this without wiping the sd card?

Yes. I never partition from my phone. Insert ur card into ur laptop and partition with paragon partition manager (or your choice). If you have some free space on it you could easily resize ur fat32 partition to make it smaller and then use the unpartitioned space to make a linux swap partition or en ext2/3 for link2sd, if u want (I have both).. :p Did it lots of times. No problem

---------- Post added at 11:11 AM ---------- Previous post was at 11:06 AM ----------

I tried this without success. I had to change the script that you provided. First I added #!/system/bin/sh to line 1 so it would run as a shell script and then the partition on my device was /dev/block/mmcblk0p3. I had to do the following to figure out which partition on my sdcard was actually set as swap. Once I edited the script with the addition to line 1 and the correct partition everything worked as expected.

Code:
~ # su
[email protected]:/ # fdisk -l /dev/block/mmcblk0

Disk /dev/block/mmcblk0: 31.9 GB, 31914983424 bytes
255 heads, 63 sectors/track, 3880 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

              Device Boot      Start         End      Blocks  Id System
/dev/block/mmcblk0p1               1        3818    30666992   c Win95 FAT32 (LBA)
/dev/block/mmcblk0p2            3818        3849      250000  83 Linux
/dev/block/mmcblk0p3            3850        3880      249007+ 82 Linux swap

And my 00userinit script looks like:
Code:
#!/system/bin/sh
if [ -n /dev/block/mmcblk0p3 ]; 
  then mkswap /dev/block/mmcblk0p3; 
fi;

if [ -e /dev/block/mmcblk0p3 ];
  then echo 60 > /proc/sys/vm/swappiness; 
  swapon /dev/block/mmcblk0p3; 
fi;

I'm running FXP 142 CM9.1.


I had to add the first line too. Thx for the tip. I'm on stock (NXT 1.3 flavour :p )
 
Last edited:

mykamran

Senior Member
Oct 20, 2011
372
28
Whether Thise need what memory class 2 best performance?and thise damage on sd or not?

Sent from my R800i using Tapatalk 2
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 41
    Hi, here is a good mod specially for gaming and ICS roms which consumes big memory amount!!!

    It is basically an .sh script that enables swapping. This makes device use part of sdcard to use it as RAM memory, so it can be increased a lot...

    The only requirement is have root, use relatively fast sdcard and have enabled init.d scripts..

    WI always have used this mod on my phone so i think it no needs testing :)

    To it follow these steps:
    1.- Root your device

    2.- Make a swap partition in your sdcard (this step will format your sdcard!)
    http://forum.xda-developers.com/wiki/SD_card_partitioning
    2.1-In step 3 select "swap partition"
    2.2-I recommend to make ~512MB partition because the SO will be going to fill it during you use the phone, but i always had 1GB partition, and no problems ;) You can select 100MB or 50MB, but this is too little

    3.- Check if there is a folder called init.d inside /system/etc/
    3.1-If its there, follow next steps
    3.2-If it is not there, you must activate init.d support, follow this tutorial: http://forum.xda-developers.com/showthread.php?t=1422061

    3.- Copy 00userinit file to your device (must remove the .txt extension of the file, because i needed to put it to attatch the file)

    4.- With root explorer, xplore, or similar copy it to /system/etc/init.d

    5.- Set all permissions: rwxr-xr-x

    6.- Reboot device

    7.- For checking if it works, download Terminal emulator and type "free". See attatchment.

    8.- If "swap" line has no "0" value, it works, congratulations ;)

    With this, you will:
    Have swapping activated in your phone permanently, or until you remove that script or change of ROM.

    Have bigger RAM memory amount, depending on your swap partition size

    If you use supercharger or any RAM manager program, i should recomend you to activate hard gaming option, because:
    -As you have bigger RAM memory, the useless aplications, instead of be closed, they will be stored in your sdcard partition so, you re able to have multitasking and hard gaming option at the same time


    But this is not all!! You can open and edit this file to adapt it to your requirements:
    You can edit this line to set swapiness cuantity, this defines the OS tendency to use swap partition, I not recommend to set it to 100, but 60 is good. Also, if you have slower sdcard, you should set it to 30~40:
    -Change 60 value by something you want from 1 to 100 "then echo 60 > /proc/sys/vm/swappiness;"

    If you have another sdcard partition like EXT4 or something to APP2SD, you should change the last number of "mmcblk0p2" by the number of the partition, i mean:
    -If you have 3 partitions with this order: Fat32(that you use everyday), EXT4, and SWAP you should change it by mmcblk0p3
    -If 3 partitions with this order: Fat32, SWAP,and EXT4, you should set it mmcblk0p2

    I forgot it! To use this, remember that you should:
    INSTALL THE LATEST BUSYBOX VERSION!!!

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------

    FOR THOSE WHO HAVE NOT WORKING, DELETE 00userinit and follow the steps with 01userinit attatched file
    6
    I tried this without success. I had to change the script that you provided. First I added #!/system/bin/sh to line 1 so it would run as a shell script and then the partition on my device was /dev/block/mmcblk0p3. I had to do the following to figure out which partition on my sdcard was actually set as swap. Once I edited the script with the addition to line 1 and the correct partition everything worked as expected.

    Code:
    ~ # su
    [email protected]:/ # fdisk -l /dev/block/mmcblk0
    
    Disk /dev/block/mmcblk0: 31.9 GB, 31914983424 bytes
    255 heads, 63 sectors/track, 3880 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
                  Device Boot      Start         End      Blocks  Id System
    /dev/block/mmcblk0p1               1        3818    30666992   c Win95 FAT32 (LBA)
    /dev/block/mmcblk0p2            3818        3849      250000  83 Linux
    /dev/block/mmcblk0p3            3850        3880      249007+ 82 Linux swap

    And my 00userinit script looks like:
    Code:
    #!/system/bin/sh
    if [ -n /dev/block/mmcblk0p3 ]; 
      then mkswap /dev/block/mmcblk0p3; 
    fi;
    
    if [ -e /dev/block/mmcblk0p3 ];
      then echo 60 > /proc/sys/vm/swappiness; 
      swapon /dev/block/mmcblk0p3; 
    fi;

    I'm running FXP 142 CM9.1.
    2
    Does it works on locked bootloaders, obviously on gingerbread??????
    2
    7 years late, but I'm going to try it.
    2

    i think its different, i dont know how does it work, but reading its description I think that this app creates a swap file, instead of using swap partition.. I think this is worse method than i have posted, because system compresses all swapped memory into a file,so it could be slower... In addition, you must install an app to make it work, which means a service running in background, less space for other apps, etc,etc...

    I dont know, but i think my method is better ;)