Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a rooted phone and i need to do some change to buid.prop. And if i got my phone bricked i need to recover it back. The thing is There's no CWM or TWRP roms available to my tablet(ZTE E7P(3G) running Kitkat 4.4.2).

Is there any way i can take a snapshot(Nandroid backup) of my currently running OS and restore it back if anything happen using default recovery mode(May be with ADB).

Simply what i want is to perform a Nandroid backup of my rooted tab and restore it without using custom recoveries like CWM or TWRP.

share|improve this question

Provided your device is rooted, you can do that with simple dd commands. Trouble is just to find out what partitions you might need to backup: some devices have more than 20 partitions, and you will most likely not need more than 5 backed up.

This is where e.g. my little tool Adebar comes in which, amongst others, creates you a script for exactly this purpose: dd the relevant partitions and get them to your computer, giving the files recognizable names. The result for my LG P880 e.g. looks like:

adb shell "su -c 'stty raw; cat /dev/block/mmcblk0p3'" > "images/system.img"
adb shell "su -c 'stty raw; cat /dev/block/mmcblk0p4'" > "images/cache.img"
adb shell "su -c 'stty raw; cat /dev/block/mmcblk0p12'" > "images/cal.img"
adb shell "su -c 'stty raw; cat /dev/block/mmcblk0p9'" > "images/persist-lg.img"
adb shell "su -c 'stty raw; cat /dev/block/mmcblk0p11'" > "images/FOT.img"
adb shell "su -c 'stty raw; cat /dev/block/mmcblk0p2'" > "images/LNX.img"
adb shell "su -c 'stty raw; cat /dev/block/mmcblk0p10'" > "images/mpt.img"
adb shell "su -c 'stty raw; cat /dev/block/mmcblk0p5'" > "images/MSC.img"
adb shell "su -c 'stty raw; cat /dev/block/mmcblk0p7'" > "images/NVA.img"
adb shell "su -c 'stty raw; cat /dev/block/mmcblk0p1'" > "images/SOS.img"
adb shell "su -c 'stty raw; cat /dev/block/mmcblk0p8'" > "images/data.img"
adb shell "su -c 'stty raw; cat /dev/block/mmcblk0p13'" > "images/UDB.img"
adb shell "su -c 'stty raw; cat /dev/block/mmcblk0p6'" > "images/USP.img"

As you can see, this does not only include partitions mounted at the time the script was generated, but also all other "named ones".

Adebar is plain Bash + ADB, and reportedly works in Cygwin (as well as of course on Linux).

share|improve this answer
    
pretty much ignorant of these things. Is it possible to identify blocks , meaning the ones you need to take back up using Windows only ? Also the next step how to restore is equally important and you may consider adding – beeshyams Feb 28 at 12:17
1  
a partition backup always backs up the entire partition, that's how it is supposed to work (that's also what my quoted script does, though it doesn't use dd). And I rather don't give ideas on how to restore those (hint: just reverse source and target, but don't do that with the system booted – i.e. the corresponding partition being used), can be tricky ;) – Izzy Feb 28 at 12:34
    
This might be a noob question. if i backup "mmcblk0" using above shell command does that mean i have all the sub-subsequent partitions like mmcblk0p1, mmcblk0p2..... inside it or do i have to call script separate on each one(of course your tool will do it automatically, but i'm asking theoretical does mmcblk0 contains all the partition data) . – HarshaXsoad Feb 28 at 13:25
    
@HarshaXsoad mmcblk0 would be the entire "drive" with all the partitions (you could inspect that probably with e.g. TestDisk). However, it's unlikely you want to restore it this way (basically, as soon as your device is booted at least one of the partitions will be in use), so it's better to capture the partitions separately. – Izzy Feb 28 at 13:47
    
What do you mean by "device is booted", to OS or to recover mode/powered on. Can i restore the entire drive(mmcblk0) on recover mode with adb because i guess non of the partitions are mounted and won't be in use on that mode. Am i correct ? – HarshaXsoad Feb 29 at 2:08

Yes, with ADB, this is possible. However, there are also some unofficial images on TWRP and CWM, which may be unofficially ported to your device. If not, you can follow ADB instructions below.

NOTE: Do it at your own risk.

This is the compilation of some of my research on this specifically, so proceed at your own risk until I test it myself.


Prerequisites

You will need busybox installed on your android, ADB on PC, OS X/Linux native tools or Cygwin for Windows, USB debugging.


Once you are sure that everything is working on your phone, then you have a choice between backing the entire phone up, or partitions by name. To view partitions by name, type this in your adb shell or phone terminal:

ls /dev/block/platform/dw_mmc*/by-name

You should get a long list of names like USERDATA or SYSTEM. These are familiar when doing a nandroid on TWRP or CWM.


Backing up entire phone

I would recommend this one more because I had experience with restoring System and Data partitions from TWRP, but all of my photos disappeared.

Type in cygwin window

adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0

And in a new cygwin window

adb forward tcp:5555 tcp:5555
cd /path/to/store/the/backup
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0.raw

This will netcat transfer the raw mmcblk0 to your computer.


Backing up by name

Backing up by name, you would do the same as with the whole phone, just replacing /dev/block/mmcblk0 in the dd command, with /dev/block/platfrom/dw_mmc*/by-name/USERDATA, replacing USERDATA with whatever partition you want.

share|improve this answer
    
When recovering (assume that i have bricked my phone) in which mode i can/supposed to restore above image with ADB(Since i can't load into OS). – HarshaXsoad Feb 28 at 9:31
    
I think that the stock recovery supports ADB too. Check on your device first – TheBro21 Feb 28 at 9:44
    
Ok thanks. I'm gonna try this. Will accept your answer soon as i done it. – HarshaXsoad Feb 28 at 9:45
1  
An easy way to find out what partitions to take (and which partition contains what) is using my little tool Adebar, which (amongst others) creates you a script for exactly this purpose: dd the partitions and get them to your computer. – Izzy Feb 28 at 10:45
1  
They say plagiarism is not a good thing to a platform meant for dissemination of knowledge. Follow How to reference material written by others. – Firelord Feb 29 at 15:22

OK, that was my case some months ago:) My phone too was neither supported by cwm nor twrp. But after some research online, I rooted it and created nandroid backup..I have provided step-by-step procedure here- creating safe nandroid backup of any device

when the backup is complete, you will also get custom recovery for your device... I created this tutorial just to help people like you and me who were struggling to do nandroid backup.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.