Copy/Wipe/Flash with ADB

BlackHawkA4

Drop the Bag
Sep 1, 2010
2,192
74
0
Can I do this?

I'm looking to do this and was wondering it if was possible: No root. Nothing. Just stock as is.

1) Plug phone into a computer
2) Run Command to copy mirror image of phone including OS
3) Run command to wipe (Format everything) so nothing is left on the phone not even the OS
4) Run command to flash the mirror copy from step 2 back to phone
5) Phone is as if it were never touched.

I was looking at some ADB commands. Would the pull command of the root directory do everything I want for step 2? If so what would I run to wipe the phone? How do I then install the copied files?

Side question: If I root after that process and flash the copied data will I lose root if I flash more than just apps and files?

Thanks,
 
Can I do this?

I'm looking to do this and was wondering it if was possible: No root. Nothing. Just stock as is.

1) Plug phone into a computer
2) Run Command to copy mirror image of phone including OS
3) Run command to wipe (Format everything) so nothing is left on the phone not even the OS
4) Run command to flash the mirror copy from step 2 back to phone
5) Phone is as if it were never touched.

I was looking at some ADB commands. Would the pull command of the root directory do everything I want for step 2? If so what would I run to wipe the phone? How do I then install the copied files?

Side question: If I root after that process and flash the copied data will I lose root if I flash more than just apps and files?

Thanks,

Basically yes you could do all of this but you would probably end up without root.
2)
Code:
adb pull /
should pull everything from system that you would need. There is a adb command to pull the system and make it into a system.img i can't remember it off the top of my head ill see if i can find it.(Edit,actually you would still need the boot.img also.)
4) this is were you would run into the problem of losing root, when you would flash back all your old files it would delete the root files.

If all you want is root then i would follow http://forums.androidcentral.com/sp...how-unlock-install-su-custom-recovery-16.html the last post i made has the updated recovery and a zip that will give you root. Either way your phones going to get wiped to unlock the bootloader to allow flashing.It sucks but that's part of the process. Back up everything you can before hand. There's plenty of free apps in the market to back up sms,bookmarks,and apps. I only back up apps so i use astro for that it will back up the apps but not the apps data.
I would follow the guide by Ksmith to unlock,flash recovery,and gain root. After rooting in flashing recovery i would set everything up how you have it now then boot into recovery and make you a nadroid backup then you can alwaysflash back to your set up if down the road you decide you want to try kernels or roms.
 
  • Like
Reactions: BlackHawkA4
Basically yes you could do all of this but you would probably end up without root.
2)
Code:
adb pull /
should pull everything from system that you would need. There is a adb command to pull the system and make it into a system.img i can't remember it off the top of my head ill see if i can find it.(Edit,actually you would still need the boot.img also.)
4) this is were you would run into the problem of losing root, when you would flash back all your old files it would delete the root files.

If all you want is root then i would follow http://forums.androidcentral.com/sp...how-unlock-install-su-custom-recovery-16.html the last post i made has the updated recovery and a zip that will give you root. Either way your phones going to get wiped to unlock the bootloader to allow flashing.It sucks but that's part of the process. Back up everything you can before hand. There's plenty of free apps in the market to back up sms,bookmarks,and apps. I only back up apps so i use astro for that it will back up the apps but not the apps data.
I would follow the guide by Ksmith to unlock,flash recovery,and gain root. After rooting in flashing recovery i would set everything up how you have it now then boot into recovery and make you a nadroid backup then you can alwaysflash back to your set up if down the road you decide you want to try kernels or roms.

I wasn't worried about losing the root after this process. I figured that would happen. Was just curious if I could. This is more of my back up return to stock method. I want to make my own backup so when I'm done rooting or mess something else up I could just do this and return to how it was like I never touched it.

So your saying there is a cmd to run that will make an entire img of my phone as is right now? Does that include data or I still need to pull / to keep all of that ?

After I would do that (Or both) do I need to wipe or would I just flash the img and/or data? I would prefer wiping if that's possible.

Thanks a lot.
 
I wasn't worried about losing the root after this process. I figured that would happen. Was just curious if I could. This is more of my back up return to stock method. I want to make my own backup so when I'm done rooting or mess something else up I could just do this and return to how it was like I never touched it.

So your saying there is a cmd to run that will make an entire img of my phone as is right now? Does that include data or I still need to pull / to keep all of that ?

After I would do that (Or both) do I need to wipe or would I just flash the img and/or data? I would prefer wiping if that's possible.

Thanks a lot.

Im looking to see if i can find the commands basically what you will do then is.
adb pull /system into system.img
adb pull /data into data.img
adb pull /boot into boot.img
(^them are made up commands not the real ones.)

Then you will just have to fastboot flash boot.img,data.img,and system.img if you ever needed.(there's a command to wipe everything.)

To make it all super easy on you i would follow the guide by ksmith, set things up how you want then make the nadroid backup,save that nadroid,(i'd even copy to pc so you have that copy). Then if you ever need to return to present state you could restore said nadroid then you would only need to fastboot recovery and then fastboot oem lock and would be completely back to the stage your at now.
When i find the commands to do it all from command line ill post them up here.
 
  • Like
Reactions: BlackHawkA4
I looked on the android sdk site for the commands and couldn't find them. Hmm. Thanks for looking.

So, I would just need to make a system, data, and boot img and I'd be good to go? Then just wipe (if wanted) and flash 3 img and everything is back to normal?

One other question. Could I get ADB without installing SDK?
 
I looked on the android sdk site for the commands and couldn't find them. Hmm. Thanks for looking.

So, I would just need to make a system, data, and boot img and I'd be good to go? Then just wipe (if wanted) and flash 3 img and everything is back to normal?

One other question. Could I get ADB without installing SDK?

Nope adb is part of the sdk no way around it. It's simple to install they have made it into a .exe the last i checked so it pretty much does everything for you. Once it's installed and set up you shouldn't really have to mess with the sdk again.
 
  • Like
Reactions: BlackHawkA4
Nope adb is part of the sdk no way around it. It's simple to install they have made it into a .exe the last i checked so it pretty much does everything for you. Once it's installed and set up you shouldn't really have to mess with the sdk again.

Yea, I saw the .exe. I'll have to do it when I get home. Can't install .exe on the work computer.

I'm looking to see if I can find the cmd as well but haven't gotten lucky yet. Just to make sure I full understand. This is what I'd be going here in ADB.

1) Making the img i just copying the directory into an img? (Or wait... they are partitions correct that I'm making img?)
2) Wipe android would be a "format /" (root directory or drive?)

If I'm just making a img out of the directories couldn't I just make 1 img out of the entire drive?

And how exactly would the the computer read the phone if the OS wasn't there with debug on? Would it just boot up into BIOS or something?

With NOTHING on the phone I would just fastboot the images and the phone would be back? With that I don't have to chose where they go?
 
Last edited:
You can't just make one .img of all the files that would be sweet. If you wiped everything off the phone it would boot into bootloader when powering on still giving you fastboot access which then you could fastboot any .img file just not radio.img those have to be flashed different. Don't worry about radio tho cause even if you wiped your phone completely radio's aren't touched there on different partition.The fastboot commands will tell the phone where to flash .img files.

fastboot commands are like this
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash system system.img

so as you see it tells it hey flash boot with that boot.img or flash recovery partition with this recovery.img,etc.
 
  • Like
Reactions: BlackHawkA4
You can't just make one .img of all the files that would be sweet. If you wiped everything off the phone it would boot into bootloader when powering on still giving you fastboot access which then you could fastboot any .img file just not radio.img those have to be flashed different. Don't worry about radio tho cause even if you wiped your phone completely radio's aren't touched there on different partition.The fastboot commands will tell the phone where to flash .img files.

fastboot commands are like this
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash system system.img

so as you see it tells it hey flash boot with that boot.img or flash recovery partition with this recovery.img,etc.

Thanks. Was just digging around. I got ADB and Fastboot up on the work computer. I ran into a wall not being able to install drivers though. So I was just looking through it.

So system, boot, etc are partitions on the drive? So I wouldn't need to wipe the partitions anyways because flashing the would overwrite right? What if I had a new rom/kernel installed. Would flashing my boot.img I made bring it back to stock? (Don't worry about data and root cause I'm doing this as fail safe and to go back).

And when we find the command I'm just gonna copy those partitions as img's to flash with fastboot?

Does ADB use linux command line as well to get to those partitions to copy or how would I navigate there? Or is fastboot going to be used her to make the .img? I saw fastboot has the erase partition commands.

I see in fastboot "Flash:raw boot <kernel> [ <ramdisk> ]" create boot image and flash it. What's that going to do?
 
Thanks. Was just digging around. I got ADB and Fastboot up on the work computer. I ran into a wall not being able to install drivers though. So I was just looking through it.

So system, boot, etc are partitions on the drive? So I wouldn't need to wipe the partitions anyways because flashing the would overwrite right? What if I had a new rom/kernel installed. Would flashing my boot.img I made bring it back to stock? (Don't worry about data and root cause I'm doing this as fail safe and to go back).

And when we find the command I'm just gonna copy those partitions as img's to flash with fastboot?

Does ADB use linux command line as well to get to those partitions to copy or how would I navigate there? Or is fastboot going to be used her to make the .img? I saw fastboot has the erase partition commands.

I see in fastboot "Flash:raw boot <kernel> [ <ramdisk> ]" create boot image and flash it. What's that going to do?

Linux/windows are the same when it comes to sdk just don't have to worry about drivers for linux.
flashing your boot.img after say you flashed a custom kernel or anything it would return it to the current boot.img
I see in fastboot "Flash:raw boot <kernel> [ <ramdisk> ]" create boot image and flash it. What's that going to do?
this would be if you wanted to flash a ramdisk and kernel together to make a boot.img. Not really anything you would use that's mainly for developers/development.Sometime today ill remember where these commands are if i wasnt' looking then i could find them without issue.
 
Ah, ok. Think I got it all down now except for the process of making my own images before I root. You have any luck finding it? I can't find a thing. Just a bunch of nandroid stuff.

Except, one thing. Is the bootloader on the boot partition? I don't wanna lose it and brick my phone. Would I just flash over that instead of wipe to go stock with that? OR where is it so I know not to wipe and reboot, lol.

And this is probably a dumb question but since I got you here. The one root method I saw flashed superuser.zip. Is this any different than the app from the market?

So I would just unlock bootloader. Reboot phone. Download rom manager. Flash clockwork. (Or do it from fastboot) and then download super user from market; or, I need superuser.zip?
 
Last edited:
Ah, ok. Think I got it all down now except for the process of making my own images before I root. You have any luck finding it? I can't find a thing. Just a bunch of nandroid stuff.

And this is probably a dumb question but since I got you here. The one root method I saw flashed superuser.zip. Is this any different than the app from the market?

So I would just unlock bootloader. Reboot phone. Download rom manager. Flash clockwork. (Or do it from fastboot) and then download super user from market; or, I need superuser.zip?

Im still looking i thought i had them writen down somewhere.
The best process to use is ksmith's at the top of this forum area.http://forums.androidcentral.com/sp...61-how-unlock-install-su-custom-recovery.html get the zip and recovery from the very last page I posted it,ksmith is just busy and hasn't been able to update first post.
Short story is
-boot into bootlaoder
-unlock,flash recovery,and flash the super user zip
-make nadroid or reboot set up everything how you like then make nadroid

That would be your fail safe for now cause as long as you have that nadroid you can restore it and we can make the .img files anytime.Sorry i lost all my bookmarks or id have the stuff to make .img's already.

EDIT* if you use his method and the zip recovery i posted you won't have to worry about manually deleting the install-recovery.sh file. That file if not deleted will keep replacing your recovery with the stock one then you have to reflash the recovery so easy way flash the zip i attached to last post in that thread it delete's that file for you.
 
  • Like
Reactions: BlackHawkA4
Would flashing clockwork from rom manager and downloading superuser from the market be the same. Or, my main concern was is superuser from the market less than what that zip is? (Edit, I opened up the zip. Answered my own question. It's not. Where do those files come from though. Just curious)

Also, how would I make the stock prerooted img files post root?

Sorry for all the questions but you've been a big help.
 
Last edited:
Would flashing clockwork from rom manager and downloading superuser from the market be the same. Or, my main concern was is superuser from the market less than what that zip is? (Edit, I opened up the zip. Answered my own question. It's not. Where do those files come from though. Just curious)

Also, how would I make the stock prerooted img files post root?

Sorry for all the questions but you've been a big help.

In that zip is basically the same as from market just it puts bin files in place so that root sticks.Plus it removes the file that would keep removing recovery.
I would just give you a couple commands that would remove root before the making the files or just uninstall superuser;)
If you want you can use rom manager and the market just not my cup of tea i like to do things manually. I've heard of some having issues with rom manager and flashing recovery.
 
  • Like
Reactions: BlackHawkA4
In that zip is basically the same as from market just it puts bin files in place so that root sticks.Plus it removes the file that would keep removing recovery.
I would just give you a couple commands that would remove root before the making the files or just uninstall superuser;)
If you want you can use rom manager and the market just not my cup of tea i like to do things manually. I've heard of some having issues with rom manager and flashing recovery.

Yea, I was going to do it manually. Just wanted to make sure it would do the same. Got ya on the SU thing.

Final question, if I do this before we find a image command: how do I go stock without my original recovery.img? Will locking the phone put it back? (That doesn't make sense to me, lol. but neither does removing a file that removes the recovery and puts back the stock one when I just removed the stock one).

(And i never pay attention to the answer of this. OTA comes. Stock and rooted. Install you would just lose root? right? Or would it not install? I don't remember the ota has recovery and everything in it doesnt it?).
 
Yea, I was going to do it manually. Just wanted to make sure it would do the same. Got ya on the SU thing.

Final question, if I do this before we find a image command: how do I go stock without my original recovery.img? Will locking the phone put it back? (That doesn't make sense to me, lol. but neither does removing a file that removes the recovery and puts back the stock one when I just removed the stock one).

(And i never pay attention to the answer of this. OTA comes. Stock and rooted. Install you would just lose root? right? Or would it not install? I don't remember the ota has recovery and everything in it doesnt it?).

lol,i know somethings just seems weird.
If need be you just fastboot flash the stock recovery,but it's not needed cause clockwork recovery allows you to flash OTA zips. As long as your stock with or without root you would just accept the OTA then when it would reboot to install you would choose the option install update.zip and it would flash the OTA.Like you stated you will lose root but it's simple to get back just flash the SU.zip you would have root again.
The worst that would happen from OTA is it includes the crazy file to install stock recovery which wouldn't matter cause the SU.zip would delete that file foir you.
The good thing about a nexus is we don't have to worry about our root exploit getting patched we have a unlocked bootloader so we can just fastboot custom recovery and then flash SU and have root again.
 
lol,i know somethings just seems weird.
If need be you just fastboot flash the stock recovery,but it's not needed cause clockwork recovery allows you to flash OTA zips. As long as your stock with or without root you would just accept the OTA then when it would reboot to install you would choose the option install update.zip and it would flash the OTA.Like you stated you will lose root but it's simple to get back just flash the SU.zip you would have root again.
The worst that would happen from OTA is it includes the crazy file to install stock recovery which wouldn't matter cause the SU.zip would delete that file foir you.
The good thing about a nexus is we don't have to worry about our root exploit getting patched we have a unlocked bootloader so we can just fastboot custom recovery and then flash SU and have root again.

Cool.

Wait your saying locking the boot loader up again will wipe everything and put back the stock recovery, boot, etc images? So right now if I wanted to root and then didn't want root or flashed some custom things and then wanted to go back I just lock up again and back to normal?

Or I need to recovery image? (And so forth).
 
Cool.

Wait your saying locking the boot loader up again will wipe everything and put back the stock recovery, boot, etc images? So right now if I wanted to root and then didn't want root or flashed some custom things and then wanted to go back I just lock up again and back to normal?

Or I need to recovery image? (And so forth).

If you want to completely remove everything and start over like a brand new phone you would download GRJ22IMAGES.zip extract the .img files that are needed into sdk/tools and run these commands while in bootloader
Code:
fastboot flash boot boot.img
fastboot flash system system.img
fastboot flash recovery recovery.img
fastboot flash userdata userdata.img
fastboot erase cache
then
Code:
fastboot oem lock

That would remove everything and give you a phone like brand new out the box.
 
You know. I might just use the nandroid to make back up images post root. And then for whatever reason if I needed to untoot just use those files. Odds are it would be because I was returning the phone for something and wouldn't be getting it back.

If you do find those commands ill gladly take them though.
 
You know. I might just use the nandroid to make back up images post root. And then for whatever reason if I needed to untoot just use those files. Odds are it would be because I was returning the phone for something and wouldn't be getting it back.

If you do find those commands ill gladly take them though.


That's the best bet just keep a copy of the nadroid you make on your pc. Even if things go really really wrong if you can get to bootloader then you can flash recovery and restore that nadroid or use the files i uploaded and return to stock and start over. Once you get the hang of it takes no time at all. Last not i unrooted/rooted in less then 30min.Im going to find them commands and ill make sure to post them. (i want them too)lol
 

Trending Posts

Forum statistics

Threads
953,997
Messages
6,960,209
Members
3,162,896
Latest member
onetimeuserpost