[GUIDE][HOW TO] How to create a swap file for expand the ram without apps!

Search This thread

Lopicl.00

Senior Member
Sep 25, 2012
723
1,313
Androidland
Hey guys! Today i am showing to you how to create a swap file for ram expansion without any app. Easy and simple! ;)
Also i will give you an init.d script that will enables and starts the swap at all the boots!

What you need:
- Installed Kernel with Swap function and init.d (NOT the stock one!!! This metod is tested on my thunderkernel RC1)
- Root
- A file explorer (ES File Explorer recommended!)
- Terminal Emulator
- An sdcard (recommended class 10)
- A Galaxy Ace-i

OK LET'S START!

FIRST METHOD (Create a swapfile on your sdcard)

1) Open terminal emulator and type this things (type enter at the and of any line!)
NOTE: "count=700000" creates a 341MB swap file! "count=300000" creates a 146 MB swap file!
Code:
su
dd if=/dev/zero of=/sdcard/swapfile count=700000
chmod 777 /sdcard/swapfile
mkswap /sdcard/swapfile
swapon /sdcard/swapfile

2) Ok!!! Now you have created the swap file and you have activated it! Now it is time to download the init.d script in the attachment. (For the first method!)

3) Extract the 99_swap on your phone sdcard.

4) Open ES File Explorer and copy 99_swap in /system/etc/init.d. Then go to terminal emulator and type
Code:
su
chmod 777 /system/etc/init.d/99_swap

5) Reboot your phone!

6) With this method you can see on logcat the status of the activation of swap, search for swap in the logcat. Also if you can't logcat you can open /data/swap.log! ;)

7) NOTE: with this method when you will connect the phone to the pc, the mount will fail. You have to go tho terminal emulator and type
Code:
su
swapoff /sdcard/swapfile
Then when you will disconnect usb cable you will have to type this for reactivate swap
Code:
su
swapon /sdcard/swapfile


SECOND METHOD (Using csc partition, thanks to rafael.baugis and domnic79)

1) Open terminal emulator and type
Code:
su
dd if=/dev/zero of=/dev/stl10
mkswap /dev/stl10
swapon /dev/stl10

2) Ok!!! Now you have created the swap file and you have activated it! Now it is time to download the init.d script in the attachment. (For the second method!)

3) Extract the 99_swap on your phone sdcard.

4) Open ES File Explorer and copy 99_swap in /system/etc/init.d. Then go to terminal emulator and type
Code:
su
chmod 777 /system/etc/init.d/99_swap

5) Reboot your phone!

THANKS TO:
- Me for first method, init.d scripts and this guide
- rafael.baugis and domnic79 for second method

I AM NOT RESPONSIBLE FOR DEAD SD CARDS! DO IT AT YOUR OWN RISK!!!
 
Last edited:

drumiec

Senior Member
Oct 25, 2010
76
39
is there easy method for make swap partition? Partition creating on sd is easy by using some partition tools on pc, but how to mount it on phone?
 

Lopicl.00

Senior Member
Sep 25, 2012
723
1,313
Androidland
With this method you don't have to create a swap partition on your sdcard! It uses a file instead of a partition! ;)

Posted from my chocolate bar that also makes coffee using Tapatalk 4 integrated microchip... : P
 

michielvDroid

Senior Member
Aug 11, 2012
200
33
michielv.eu
is there easy method for make swap partition? Partition creating on sd is easy by using some partition tools on pc, but how to mount it on phone?

Mini tool partition wizard for creating the swap partition.
Swapper2 app for mounting the partition, set swappiness, save unmount, ...

Sent from my GT-S5830i using xda app-developers app
 

Lopicl.00

Senior Member
Sep 25, 2012
723
1,313
Androidland
yeah i know it :) just asking for 3rd method. Anyway, can you tell me how much swap file reduce sdcard life?



Mini tool partition wizard for creating the swap partition.
Swapper2 app for mounting the partition, set swappiness, save unmount, ...

Sent from my GT-S5830i using xda app-developers app

But this guide is for creating a swap file without apps! Anyway you can use also CWM for create swap partition... But yuou will lose all your files on sdcard.

A swap partition, or swapfile, on the sdcard will reduce the life of 25/50% but if you have a class 10 i think the life will be more longer lasting! ;)

Posted from my chocolate bar that also makes coffee using Tapatalk 4 integrated microchip... : P
 

drumiec

Senior Member
Oct 25, 2010
76
39
edit:

72MB of swap is installed with busybox (pro).
 

Attachments

  • SC20130728-133021.png
    SC20130728-133021.png
    35 KB · Views: 646
Last edited:

El_Dark

Senior Member
Dec 13, 2012
417
216
36
Santiago
I've a question Lopi, if I'm on stock ROM and install custom Kernel, keeping in mind that stock ROM uses the CSC, won't it be better to use on a ROM that actually doesn't use the CSC? or it doesn't hurt the ROM to break the CSC area?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 11
    Hey guys! Today i am showing to you how to create a swap file for ram expansion without any app. Easy and simple! ;)
    Also i will give you an init.d script that will enables and starts the swap at all the boots!

    What you need:
    - Installed Kernel with Swap function and init.d (NOT the stock one!!! This metod is tested on my thunderkernel RC1)
    - Root
    - A file explorer (ES File Explorer recommended!)
    - Terminal Emulator
    - An sdcard (recommended class 10)
    - A Galaxy Ace-i

    OK LET'S START!

    FIRST METHOD (Create a swapfile on your sdcard)

    1) Open terminal emulator and type this things (type enter at the and of any line!)
    NOTE: "count=700000" creates a 341MB swap file! "count=300000" creates a 146 MB swap file!
    Code:
    su
    dd if=/dev/zero of=/sdcard/swapfile count=700000
    chmod 777 /sdcard/swapfile
    mkswap /sdcard/swapfile
    swapon /sdcard/swapfile

    2) Ok!!! Now you have created the swap file and you have activated it! Now it is time to download the init.d script in the attachment. (For the first method!)

    3) Extract the 99_swap on your phone sdcard.

    4) Open ES File Explorer and copy 99_swap in /system/etc/init.d. Then go to terminal emulator and type
    Code:
    su
    chmod 777 /system/etc/init.d/99_swap

    5) Reboot your phone!

    6) With this method you can see on logcat the status of the activation of swap, search for swap in the logcat. Also if you can't logcat you can open /data/swap.log! ;)

    7) NOTE: with this method when you will connect the phone to the pc, the mount will fail. You have to go tho terminal emulator and type
    Code:
    su
    swapoff /sdcard/swapfile
    Then when you will disconnect usb cable you will have to type this for reactivate swap
    Code:
    su
    swapon /sdcard/swapfile


    SECOND METHOD (Using csc partition, thanks to rafael.baugis and domnic79)

    1) Open terminal emulator and type
    Code:
    su
    dd if=/dev/zero of=/dev/stl10
    mkswap /dev/stl10
    swapon /dev/stl10

    2) Ok!!! Now you have created the swap file and you have activated it! Now it is time to download the init.d script in the attachment. (For the second method!)

    3) Extract the 99_swap on your phone sdcard.

    4) Open ES File Explorer and copy 99_swap in /system/etc/init.d. Then go to terminal emulator and type
    Code:
    su
    chmod 777 /system/etc/init.d/99_swap

    5) Reboot your phone!

    THANKS TO:
    - Me for first method, init.d scripts and this guide
    - rafael.baugis and domnic79 for second method

    I AM NOT RESPONSIBLE FOR DEAD SD CARDS! DO IT AT YOUR OWN RISK!!!
    1
    I've a question Lopi, if I'm on stock ROM and install custom Kernel, keeping in mind that stock ROM uses the CSC, won't it be better to use on a ROM that actually doesn't use the CSC? or it doesn't hurt the ROM to break the CSC area?

    CSC area is not important

    Inviato dal mio Nexus 7 con Tapatalk 4
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone