1. Download our Official Android App: Forums for Android!

Root ( Guide ) Creating and using a Swap Partition

Discussion in 'Android Devices' started by rhino889a, Feb 24, 2013.

  1. rhino889a

    rhino889a Android Expert
    Thread Starter
    Rank:
    None
    Points:
    143
    Posts:
    1,004
    Joined:
    May 30, 2012

    May 30, 2012
    1,004
    177
    143
    Male
    Bum
    Somewhere in the Internet
    OK before we go any further! previous phones had a partition layout where mmcblck0 was the SDcard (external) our phone uses mmcblck1 for the external sd. This is important because if you use an app it may be preset to use mmcblck0 as swap partition.using this setting will cause you to use your sbl2 or sbl3 as swap partition.this will brick your phone and unbrick guide will be useles.
    you may not really need swap as we have alot of memory,but it can be vvery valuable under certain conditions.

    so you will need to create a partition dedicated for swap only.now writing to the sdcard as memory is slower than ram the phone comes with.so the smaller the partition the quicker the p[hone can find what has been written to it.For most use you dont need huge partition.128 to 256 may be perfect for daily use. running linux or memory intensive apps me need more. 2 gig swap partition sounds cool,but if you only use 128 the p[hone may need to search through the 2 gig to get what it needs.which will increase the read time.
    p[artition tools.
    MiniTool Partition Wizard Home Edition - CNET Download.com

    GParted -- About

    these are 2 links to useable software that will get the job done.there are others.
    also i have 2 android apps that may work on our phone but i will have to dig those up and post later.
    also if you have other phones with cm you can use it to partition sdcard.
    Like i have optimus m with cm,i can format in the optimus then put it in my motion

    so our phone uses partition 1 as storage,also thats the partition windows reads when you hookup to usb.
    this partition has 2 options for the format. fat or fat 32. i use fat 32. it will support storing a file up to 4 gig in size.

    now if you want to run apps from your external sd the second partition needs to be made. again dont make this huge. really just as big or slightly more than you think you need. 6 gig aplication sounds great but will reduce read time. now the format can be ext2 ext3 ext4. now most use ext4 for running apps

    next is the swap partition
    Linux swap is the only format i have used, others may be possible but i dont know. remember the size of this patition is important, you can reduce the read write speed by making too big.

    so an exmple of sd card may be this
    32 gig sd card
    partition 1 ....29 gig... fat 32... storage (music,movies,saved data etc)
    partition 2..... 1 gig... ext4 ....run apps from
    partition 3 ....500 m... linux swap.. the swap partition

    remember there always seems to be unailable space as the os hides a little for its use

    ( i dont know if this is possible on android yet,my common sense tells me that if you can have several Swap partitions it would enhance swap speed. )
    example
    500 meg swap partition
    or
    4 swap partitions at 125 m
    i mention this as an idea,i dont know how to configure this or is possible on android.

    so now to setup android to begin.
    i am sure there is a file you can simply write to that activates it but i havent found it yet,

    so here is a link to an app that will do that for you
    https://play.google.com/store/apps/details?id=lv.n3o.swapper2 (FREE)
    this app will say it failed but wait it will then say it activated swap,weird i dont know why.

    this works fine. go to advanced to tell it to use swap partition instead of swap file. BUT CHANGE TO MMCBLCK1 now if you made sd like my examample mmcblck1p3 is what you change this setting to

    swappiness. the option are 0 through 100. this is the priorty android uses swap
    setting of 0 will make android avoid using swap
    setting of 100 will make android use swap alot.

    so you dont want to use swap if you have alot of free memory so 100 probably would make things slower and not efficient.

    if you use 0 android may never really use this.

    60 is common but you can experiment with this.

    so everything is set and you want to check it is working
    you can use terminal emulator to check its working and monitor usage incase you want to change swappiness or resize swap patition
    https://play.google.com/store/apps/details?id=jackpal.androidterm&feature=search_result#?t=W10.


    once installed
    type su this makes terminal emulator ask superuser for root access
    type free this makes terminal emulator display the memory used. it will show ram available ram used and ram thats free
    at the bottom will show swap available swap used and swap thats free

    So that should get people swapping if they need it. Please feel free to post suggestions or ideas that will help others setup swap for thier needs.
    i didnt invent swap nor did i invent any tools or apps and dont want credit or a pat on the back. i just want people to be able to make their phone work the way they want to
    so if you feel something i posted is wrong or can be better please say so as evberybody that reads this needs the best information that can be available

    AGAIN please use the proper mmcblck and partition
    swap can be a valuable tool but having root access you have the ability to write into partitions and files that can brick you beyond simple unbrick guide
     

    Advertisement

  2. sammyz

    sammyz LG Whiz Kid
    Rank:
    None
    Points:
    423
    Posts:
    8,840
    Joined:
    Jun 3, 2011

    Jun 3, 2011
    8,840
    2,500
    423
    Male
    Video Production
    Sunrise, Fl
    I would make that, big and red ;)

    I don't want this causing permabricks :eek:
     
  3. rhino889a

    rhino889a Android Expert
    Thread Starter
    Rank:
    None
    Points:
    143
    Posts:
    1,004
    Joined:
    May 30, 2012

    May 30, 2012
    1,004
    177
    143
    Male
    Bum
    Somewhere in the Internet
    niether do i thats sorta why its the first and last i wrote, let me see if i can change that
     
  4. Sepero

    Sepero Linux Guru
    Rank:
    None
    Points:
    163
    Posts:
    963
    Joined:
    Aug 26, 2010

    Aug 26, 2010
    963
    594
    163
    I would personally say that repartitioning for this purpose is excessively dangerous and should be under taken by those who are very knowledgeable. I think a more reasonable solution for most people would be to create a swap file instead on your sdcard. Assuming the sdcard is fat32, then having a swap on the sdcard will not incur any overhead for file journaling.

    EDIT:
    Correction, repartitioning your sdcard is not excessively dangerous. I did not fully read the instructions and thought it was about repartitioning the internal file system. Also though, I would still simply recommend using a swap file instead of repartitioning. There are apps in the play store that will do this for you. ;)
     
    k0r likes this.
  5. rhino889a

    rhino889a Android Expert
    Thread Starter
    Rank:
    None
    Points:
    143
    Posts:
    1,004
    Joined:
    May 30, 2012

    May 30, 2012
    1,004
    177
    143
    Male
    Bum
    Somewhere in the Internet
    wow , other than getting proper blck its not more dangerous than partitioning an sdcard for running apps from sd. i believe if journaling is a major factor it can be turned off. i dont know just something i did for several of my phones. i am pretty sure it works better than a swp file, and many people here are experienced.they root and reflash phones. but take it for what it is, information.... choose to use it or not ....I guess
    is there journaling for swap?
     
  6. Sepero

    Sepero Linux Guru
    Rank:
    None
    Points:
    163
    Posts:
    963
    Joined:
    Aug 26, 2010

    Aug 26, 2010
    963
    594
    163
    @rhino889a

    1. My apologies, I just read your post wrong originally. (see my edits) I was just afraid that you had posted something significantly different.
    2. A swap file should be just as fast a swap partition if it is on a fat32 (or any non-journaled) filesystem.
    3. I do not believe swap files themselves are journaled, because they do not need to carry information between reboots.
     
  7. rhino889a

    rhino889a Android Expert
    Thread Starter
    Rank:
    None
    Points:
    143
    Posts:
    1,004
    Joined:
    May 30, 2012

    May 30, 2012
    1,004
    177
    143
    Male
    Bum
    Somewhere in the Internet
    ok i understand now, and your other input is valuable, this isnt really about me.getting information out in the open so we can all see it. now people have data and new ideas. the app i posted does provide swapfile use as well. so if swap is needed people have knowledge and options

    so mabe the differnce between the two may be determined by the format. whatever makes the format. each block or sector and its size and its abilty to be written on and read from.
    i would assume a format made of smaller blocks or sectors may be able to read and write faster than format made more for storing larger chunks of data. i guess larger blocks sectors, i dont know.

    so is it quicker for android to find a file in a large partition or find a exact partition
    then which format can read and write small bits of data quickly fat32 or linux swap format
     
    k0r likes this.
  8. Sepero

    Sepero Linux Guru
    Rank:
    None
    Points:
    163
    Posts:
    963
    Joined:
    Aug 26, 2010

    Aug 26, 2010
    963
    594
    163
    I'm not 100% sure on this, but I think that block/sector size are only relevant as far as the Operating System locating files. Once a file is located and opened by the OS, then this should not have any affect. After boot, a swap file would remain as an always open file.
     
  9. sammyz

    sammyz LG Whiz Kid
    Rank:
    None
    Points:
    423
    Posts:
    8,840
    Joined:
    Jun 3, 2011

    Jun 3, 2011
    8,840
    2,500
    423
    Male
    Video Production
    Sunrise, Fl
    @rhino, why won't the unbrick guide fix this?? o_O I believe you, I just want to know any idea why?
     
  10. Sepero

    Sepero Linux Guru
    Rank:
    None
    Points:
    163
    Posts:
    963
    Joined:
    Aug 26, 2010

    Aug 26, 2010
    963
    594
    163
    It is because if a person accidentally runs it on the internal storage, then the partition table will be over-written. Emode exists on one of the internal partitions (possibly the "recovery" partition). If the internal partition table is over-written, then there is no emode partition. And no emode partition means no emode. ;)
     
    mysticspiral, sammyz and k0r like this.
  11. rhino889a

    rhino889a Android Expert
    Thread Starter
    Rank:
    None
    Points:
    143
    Posts:
    1,004
    Joined:
    May 30, 2012

    May 30, 2012
    1,004
    177
    143
    Male
    Bum
    Somewhere in the Internet
    Well ok. Like the app i posted above It is preset to swap on mmcblck0. That is sd on some phones. But is sbl partitions on our motion. From my experience if you swap into those partitions the communications from the kdz tool and your phone wont exist. With root acess you can f#### stuff up. I guess you could tell your webrowser to put downloads in your recovery or firmware partition if you werent paying attention.
    . If you have the right partion you can download 4 movies text people run mp4 video convert er and have 20 dolphin browser tabs open at once. And not experience the lag as you would with out the help of swap.

    Also from experience from raid settings. Different formats have different chunk sizes.the OS drives would be small for fast rw small files..then you use the same format with larger chunks for larger files like movies or large zips an such. I think thats why there are si many formats and would assume linux swap format is not created with huge chunks as the swapped data probably isnt large chunks

    I dont know if the sd is mapped and each piece has an adress.if not i guess android searches the partion till it finds what it wants. If so having a small partition ti start lookin in will speed things up. I am not sure about anything but am guessing it may apply here
     
  12. plasticarmyman

    plasticarmyman Android Expert
    Rank:
    None
    Points:
    113
    Posts:
    892
    Joined:
    Oct 27, 2011

    Oct 27, 2011
    892
    254
    113
    Male
  13. rhino889a

    rhino889a Android Expert
    Thread Starter
    Rank:
    None
    Points:
    143
    Posts:
    1,004
    Joined:
    May 30, 2012

    May 30, 2012
    1,004
    177
    143
    Male
    Bum
    Somewhere in the Internet
  14. mochirba

    mochirba Lurker
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Jun 28, 2015

    Jun 28, 2015
    1
    0
    5
    Male
    Hi bro, I tried thid one on my Acer Liquid Z2 but it say alltime (Function not implemented)...I don't know why, please help me to get swap partition on my phone. I will appreciate u forever u will get big respect from me.
     
    #14 mochirba, Jun 28, 2015
    Last edited: Jun 28, 2015
Tags:

Share This Page

Loading...