[TOOL] G2X Cleanup Batch *** WARNING *** WILL FORMAT INTERNAL SD

Search This thread

mansa_noob

Senior Member
Feb 21, 2012
533
151
Markham
If you are going to flash and ICS ROM after this tool please make sure to first install a GB then ICS otherwise your SD card will not be accessible. I am trying to find a fix but it has been illusive. This statement will be removed once a fix has been found and OP updated.

Now with CWM Touch!

This method uses NVFLASH to recreate all partitions and formats them, thereby getting rid of the file allocation pointers and hence renders data inaccessible without effort.

Note: I have never seen a file come back to life or its data affect other files without effort on the users part or a temporary glitch once the partitions and pointers have been overwritten. Please post a reply with evidence if you have seen it.


Benefits:

The contents of the zip file can be used to super clean G2X before a new ROM flash. This tool recreates all the partitions in the phone so wipes the pointers to all files (everything). The method it employes has existed from before. The files here will stop short of pushing a ROM, so that you can push your favorite ROM.

Prerequisites:

  • G2X (Will not work on O2X due to different partition table)
  • Desire to have a clean install of your favorite ROM :D
  • Backup your data

    *** WARNING ***​

    This tool will wipe both phone internal memory and internal SD card. External SD card content is safe.

    Don't say you haven't been warned!

What to do:

  • Download the attached Zip file.
  • Take out the battery (assuming you have backed up your data on external SD card, computer or elsewhere), connect the device via USB while holding VOL+ and VOL- together. Don't let go of the volume buttons until the device is recognized.
    (I typically leave Device Manager open to see when it shows up in the list under "USB Controllers").
  • Launch flash.bat, sit back and wait until the process finishes (generally a good idea to open a command prompt, CD to the directory and then run the file).
  • Unplug, put battery in, reboot into CWM recovery (pushed by this tool) by holding VOL- first, then pressing and holding POWER).
  • Flash your favorite ROM.
  • Enjoy!

I made this package because I could not get the bluetooth to work with G2x GB 2.3.3 (and below). The issue was a disconnect problem where both the phone and headset would still think they were connected but in audio would not be routed for a call or media. After this procedure my phone has not had an issue for almost 3 weeks now. I have tried it with two ROMs and 3 different headsets without any issues.

I guess I will not toss this phone after all :D.

Putting it out there in the hope that it may help others solve some of their issues as well. I suspect bad data stays in places not touched by other methods.

Your comments are most welcome.

[Update]

Klathmon has made an newer version with CWM 5.0.2.8. RP by Klathmon can be found here:

http://xdaforums.com/showpost.php?p=24768294&postcount=66

I have tested the windows version but linux one is untested. Use at your own risk.

[Update]

Now with CWM Touch!

Thanks to everyone who has contributed on this thread with a drive to positive change! You work/comments/suggestions are very much appreciated.



References:
http://xdaforums.com/showthread.php?t=1248644. This link was the inspiration for the current work.

Link to CWM Touch development thread. I took the image posted there: http://rootzwiki.com/topic/22984-recovery-touch-enabled-cwm-5813/



[EDIT] The zip file should be fixed now. Darn work machine does something to the upload.
 

Attachments

  • G2XCleanUpBatchInternalSDFormat.zip
    7.4 MB · Views: 3,514
  • G2XCleanUpBatchInternalSDFormatCWMTouch.zip
    7.7 MB · Views: 3,043
Last edited:

khanggle

Member
Oct 15, 2010
49
5
Hamilton
was just about to flash the new hellfire rom and saw this tool! will try it out and see how things go
edit: yeah corrupt zip on my end too.
 
Last edited:
  • Like
Reactions: mansa_noob

buru898

Senior Member
Ohh I like this. Thank you for sharing :).

This thing is faster than nullifier, and I especially like how you don't need to be in CWM to use it. It just seems like doing it in "update mode" would allow better manipulation of the phone's internals.
 
Last edited:

DsturbD

Senior Member
Feb 27, 2012
2,168
1,264
Kannapolis, NC
so this tool DOES format and nullify in addition to recreating the partitions?

deleting and recreating partitions does not remove data. only by writing over existing data can you get rid of it (like nullifier does)
 

MWBehr

Senior Member
Oct 11, 2010
1,164
380
Corpus Christi
so this tool DOES format and nullify in addition to recreating the partitions?

deleting and recreating partitions does not remove data. only by writing over existing data can you get rid of it (like nullifier does)

He states in OP that it doesn't write anything, therefor doesn't "nullify". It formats and partitions.
 

mansa_noob

Senior Member
Feb 21, 2012
533
151
Markham
so this tool DOES format and nullify in addition to recreating the partitions?

deleting and recreating partitions does not remove data. only by writing over existing data can you get rid of it (like nullifier does)

Actually you are right. Deleting, recreating and formatting partitions does not get did of the 1s and 0s, so in that sense the data is still there. However the pointers are gone, and hence even though the data is still there it can't be accessed without effort.

What do you think the nand has on it when the device is shipped... I can assure you its not ask zeroes!

Sent from my LG-P999 using XDA
 

MWBehr

Senior Member
Oct 11, 2010
1,164
380
Corpus Christi
Actually you are right. Deleting, recreating and formatting partitions does not get did of the 1s and 0s, so in that sense the data is still there. However the pointers are gone, and hence even though the data is still there it can't be accessed without effort.

What do you think the nand has on it when the device is shipped... I can assure you its not ask zeroes!

Sent from my LG-P999 using XDA

Well no, it has a next to worthless version of android :D Also, the point he was trying to get across is that it would be better for you to present the script for what it is and not try to compare it to other scripts that do something entirely different. You do kind of imply that you accomplish the same thing as the Nullifier script and more, when in fact you simply do something different.

Some may and probably will prefer your script, at least for specific purposes, while others will prefer the Nullifier script.
 

mansa_noob

Senior Member
Feb 21, 2012
533
151
Markham
Well no, it has a next to worthless version of android :D Also, the point he was trying to get across is that it would be better for you to present the script for what it is and not try to compare it to other scripts that do something entirely different. You do kind of imply that you accomplish the same thing as the Nullifier script and more, when in fact you simply do something different.

Some may and probably will prefer your script, at least for specific purposes, while others will prefer the Nullifier script.

Done. OP updated to reflect. Thanks for clarifying that. It was not my intention to state that this tool does anything any other does, or does not.

I think we are all trying to do the same thing... get rid of the issues when swapping ROMs like _____. I can't seem to think of a good analogy here :D.
 
  • Like
Reactions: DsturbD

DsturbD

Senior Member
Feb 27, 2012
2,168
1,264
Kannapolis, NC
thanks for clarifying the OP, that makes much more sense

and no i wasnt trying to say you were reinenting the wheel, just trying to understand what your tool is actually doing

and also i do understand that it would take effort to get data off any type of storage device once the partition has been erased. i deal with wiping hard drives in a data center all the time. we use a DOD wipe tool that writes 1s and 0s over a drive a minimum of three full times to eradicate the data

but with this tool doing it outside of CWM, it sounds like it may do a better job of it

but i must ask, why do you need to push CWM? what if i have a newer version of it already on my phone?
 
  • Like
Reactions: mansa_noob

mansa_noob

Senior Member
Feb 21, 2012
533
151
Markham
but i must ask, why do you need to push CWM? what if i have a newer version of it already on my phone?

There is no need to push CWM 5.02. As I said in the OP it is a mod of the script found in the reference. In that script it was pushing default recovery. Since the recovery partition is being overwritten as well you will loose existing one and you need a recovery to be able to push a new ROM. Hence the need to push recovery (instead of using super one click).

As long as the recovery is not bigger than the partition that holds it :D we should be able to push a newer version. However I can't leave it empty or people will look for me with a shotgun (myself included ;)).
 
Last edited:
  • Like
Reactions: DsturbD

PL0X_Kleiner

Senior Member
Dec 13, 2011
77
5
St. Louis
So would it be benefitial or pointless to nullify to clear the data then run this script for a... super clean? :D:D

Sent from my LG-P999 using XDA
 

DsturbD

Senior Member
Feb 27, 2012
2,168
1,264
Kannapolis, NC
There is no need to push CWM 5.02. As I said in the OP it is a mod of the script found in the reference. In that script it was pushing default recovery. Since the recovery partition is being overwritten as well you will loose existing one and you need a recovery to be able to push a new ROM. Hence the need to push recovery (instead of using super one click).

As long as the recovery is not bigger than the partition that holds it :D we should be able to push a newer version. However I can't leave it empty or people will look for me with a shotgun (myself included ;)).


ahhhhhh now i understand. my eyes have been opened LOL :)

---------- Post added at 07:36 PM ---------- Previous post was at 07:35 PM ----------

So would it be benefitial or pointless to nullify to clear the data then run this script for a... super clean? :D:D

Sent from my LG-P999 using XDA

i think it would be pointless unless you are super paranoid
 
  • Like
Reactions: mansa_noob

mansa_noob

Senior Member
Feb 21, 2012
533
151
Markham
ahhhhhh now i understand. my eyes have been opened LOL :)

---------- Post added at 07:36 PM ---------- Previous post was at 07:35 PM ----------



i think it would be pointless unless you are super paranoid

Nobody is twisting any arms here... Use it if you want to, don't if you don't want to.

I saw benefit so posted so that others may benefit as well.

Sent from my LG-P999 using XDA
 
  • Like
Reactions: overground

da-pharoah

Senior Member
Mar 24, 2009
2,779
1,593
Seacoast near Joppa
Ok so question, why are you killing all the data on your internal SD card? Why not just the individual partitions that the phone uses? Your destroying data that don't need to be destroyed before flashing a rom...

Sent from my LG-P999 using xda premium
 

mansa_noob

Senior Member
Feb 21, 2012
533
151
Markham
It does not have to be destroyed. I just haven't had a chance to test without recreating emmc yet.

Next step. Likely tomorrow. Would like to test before release.

Sent from my LG-P999 using XDA

[edit] BTW, I do want to restate that there is some data that needs to be destroyed which is not being taken care of by other methods. I don't believe it is in the emmc, but rather it resides in one of the other partitions. Most methods out there are only working in the /data, /system and /cache domain.

My original problem (bluetooth disconnect) which happens to be a problem for some in the community even now was only completely fixed by this method.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 36
    If you are going to flash and ICS ROM after this tool please make sure to first install a GB then ICS otherwise your SD card will not be accessible. I am trying to find a fix but it has been illusive. This statement will be removed once a fix has been found and OP updated.

    Now with CWM Touch!

    This method uses NVFLASH to recreate all partitions and formats them, thereby getting rid of the file allocation pointers and hence renders data inaccessible without effort.

    Note: I have never seen a file come back to life or its data affect other files without effort on the users part or a temporary glitch once the partitions and pointers have been overwritten. Please post a reply with evidence if you have seen it.


    Benefits:

    The contents of the zip file can be used to super clean G2X before a new ROM flash. This tool recreates all the partitions in the phone so wipes the pointers to all files (everything). The method it employes has existed from before. The files here will stop short of pushing a ROM, so that you can push your favorite ROM.

    Prerequisites:

    • G2X (Will not work on O2X due to different partition table)
    • Desire to have a clean install of your favorite ROM :D
    • Backup your data

      *** WARNING ***​

      This tool will wipe both phone internal memory and internal SD card. External SD card content is safe.

      Don't say you haven't been warned!

    What to do:

    • Download the attached Zip file.
    • Take out the battery (assuming you have backed up your data on external SD card, computer or elsewhere), connect the device via USB while holding VOL+ and VOL- together. Don't let go of the volume buttons until the device is recognized.
      (I typically leave Device Manager open to see when it shows up in the list under "USB Controllers").
    • Launch flash.bat, sit back and wait until the process finishes (generally a good idea to open a command prompt, CD to the directory and then run the file).
    • Unplug, put battery in, reboot into CWM recovery (pushed by this tool) by holding VOL- first, then pressing and holding POWER).
    • Flash your favorite ROM.
    • Enjoy!

    I made this package because I could not get the bluetooth to work with G2x GB 2.3.3 (and below). The issue was a disconnect problem where both the phone and headset would still think they were connected but in audio would not be routed for a call or media. After this procedure my phone has not had an issue for almost 3 weeks now. I have tried it with two ROMs and 3 different headsets without any issues.

    I guess I will not toss this phone after all :D.

    Putting it out there in the hope that it may help others solve some of their issues as well. I suspect bad data stays in places not touched by other methods.

    Your comments are most welcome.

    [Update]

    Klathmon has made an newer version with CWM 5.0.2.8. RP by Klathmon can be found here:

    http://xdaforums.com/showpost.php?p=24768294&postcount=66

    I have tested the windows version but linux one is untested. Use at your own risk.

    [Update]

    Now with CWM Touch!

    Thanks to everyone who has contributed on this thread with a drive to positive change! You work/comments/suggestions are very much appreciated.



    References:
    http://xdaforums.com/showthread.php?t=1248644. This link was the inspiration for the current work.

    Link to CWM Touch development thread. I took the image posted there: http://rootzwiki.com/topic/22984-recovery-touch-enabled-cwm-5813/



    [EDIT] The zip file should be fixed now. Darn work machine does something to the upload.
    5
    If you create and test a linux version, please post it. If you like I can post the link in the OP.

    Good things should be spread like wild fire :D

    attached the linux version. everything should work but ill need someone to test it cause i made it on my windows machine because my nix-box is currently OOC.

    i also updated the CWM version from 5.0.2.0 to 5.0.2.8 and uploaded a windows version of it too... :) (please test this too before trusting it)

    Enjoy :cool:

    EDIT: changed linux version to more nix-friendly compression format.

    ANOTHER EDIT: added actual 5.0.2.8.img to the linux version (whoopsies)

    Both files are tested and working :)
    4
    honestly this is a great idea. Unless your trying to wipe data for security purposes (like the FBI is out to get you) there is no need to write all 1's then all 0's (and honesty you should follow that up with random data for true security). Removing the partition table and recreating it will TRULY restore this phone to as much of a clean-slate as your gonna get.

    I have never (and should never) seen a programmer access data by means of a low level memory address, so even though most of the 1's and 0's are still there, the pointers to those values are gone. so unless the program is written SPECIFICALLY to restore data from this, its not going to magically appear (or glitch into existence).

    and IMHO, this does a much faster, better, and more thorough job of restoring things back to a base, so that new ROM's will not have issues. It erases and rewrites ALL usable partitions of the phone (excluding external card), including boot, cache, data, system, internal sd, and a few others that im not sure what they are even used for. For all i know, many issues could be caused by strange data written to system, or a weird glitch in one of the other partitions caused from us flashing so much.

    I'm not trying to start fights here, im only simply stating a comparison, in the same way i would compare 2 apps. The nullifier does have its uses, but i feel its more suited to secure data destruction than resetting the phone back to a clean slate.

    last note, wiping internal might be a good idea, as newer roms are starting to use it differently than just a second storage. :)
    3
    First of all thank you for another useful tool for our G2X! Secondly I just had to say that I'm truly impressed with how you've handled this discussion. In my opinion people are just ridiculously sensitive on these forums sometimes and it can cause things to get out of hand quickly. To clarify I'm not saying Bork was ridiculously sensitive at all because he worked hard to provide everybody an awesome "tool" so he has all the right in the world to be sensitive about his work. (In fact I'm gonna try out his Nullifier along with this one and I'm truly appreciative for having both!) What I'm saying is if you were ridiculously sensitive and responded ignorantly it most likely could've gone out of control. It just seems like that happens a lot and we wind up losing either great developers or great "tools" for our phones. So I was definitely impressed because it shows that you really weren't trying to step on toes or compare girths lol. Very well played man and thanks for the script (or "tool") for my phone! Just my two cents anyway :D


    Sent from your inner child
    3
    :)I just wanted to thank you for all your work on this. I was getting ready to flash 5.0.2.8 this morning by using the flash tool with 5.0.2.0 in it and altering the file to change the img to 5.0.2.8 so that it would upgrade my CWM. I wanted to try the new touch recovery from CWM but I decided it would be allot more trouble renaming files etc..... and lo and behold I get up this morning and come into to check the OP one more time before I flashed and there as pretty as you please is the Touch CWM already set up to flash my G2x and get the added advantage of G2x Clean Up Batch as I also was having issues with Bluetooth. Flashed the batch file and it all went smoothly as can be, now up and running my Hell Fire Rom and its much faster. No one can compensate you guys for the work you do on here but I did drop a donation in the box for you. Thanks again!!!!