Suppose I plan to flash my recovery with TWRP/CWM, but then later suppose I would like to move back to the stock recovery. Is it possible to take a backup of stock recovery just like we can take a backup of our ROM?
EXTRACTING BOOT.IMG FROM STOCK ROM or OTHER IMG LIKE RECOVERY ETC.
1. Download adb required tools.
3. Phone Drivers (for other phones google it out)
for spreadtrum phones: SCI-Usb-Jungo v4 (download here) or SCI-USB2Serial v126.96.36.199 (download here)
4. Android Phone + Usb cables
STEPS: OPEN cmd window in adb folder
type the ff:
adb devices adb shell su cat /proc/mtd
Now from your screen look at your files and you see mtd10 has your recovery.img
dev: size erasesize name mtd0: 00040000 00020000 "misc" mtd10: 00500000 00020000 "recovery" mtd12: 00280000 00020000 "boot" mtd13: 04380000 00020000 "system" mtd14: 04380000 00020000 "cache" mtd15: 04ac0000 00020000 "userdata"
Once u see it's LOCATION in which in this sample is in mtd10 type:
cat /dev/mtd/mtd10 > /sdcard/mtd10.img or
cat /dev/mtd/mtd10 > /sdcard/recovery.img
3/proc/mtd is not universal. It's not there in all devices.. Change it :)– Gokul NCDec 23, 2015 at 9:37
But works in many devices.– Vivek JiDec 23, 2015 at 11:15
/proc/mtd is not there in my device (Yuphoria). It's empty in my mom's device (Android One).– Gokul NCDec 23, 2015 at 11:17
3And you conveniently didn't mention the original source. Please follow How to reference material written by others– Firelord ♦Dec 23, 2015 at 11:48
/proc/mtdmay not be valid for all devices how would anyone know trying to answer this question without first being provided what device model number/name is being worked on? This answer is good and until the question's author can provide specs I don't think I'd do any better than Vivek Ji already has. Also Firelord suggestions on
ddwill also work great for doing full backups over USB.– S0AndS0Nov 9, 2016 at 14:52
Generic Backup/ Restore
If you are root you can backup/ restore all partitions (not only recovery) with native tools.
To list all mountable partitions and block devices use
adb shell su find /dev | grep by-name$
On my system I get
/dev/block/platform/soc/1d84000.ufshc/by-name back (this is very device specific and yours may look different).
Now You can list
ls this path to show all mountable partitions.
ls -al --color /dev/block/platform/soc/1d84000.ufshc/by-name/
Or all in one command
ls -al --color $(find /dev|grep by-name$)
Armed with this information you can, as root, backup all partitions. Just use the
dd (part of every android toolboox/ toyboox e.g.:
dd if=/dev/block/platform/soc/1d84000.ufshc/by-name/recovery of=/sdcard/Download/recovery.img.dd
Warning Data lost possible! Don't use until You understand all
In many cases you can also restore with the
dd tool, e.g:
dd if=/sdcard/Download/recovery.img.dd of=/dev/block/platform/soc/1d84000.ufshc/recovery
The key point is to boot a custom recovery partition such as TWRP without installing it. For instance with an HTC device you would use the platform adb tools and run this command from a terminal in Windows:
fastboot boot twrp.img
This remote-boots the custom recovery partition so you leave the stock recovery partition intact.
Now you root the phone.
Reboot the phone.
Use dd command to copy the recovery partition.
If you have already flashed a recovery partition then it's too late. You will have to find a stock recovery partition for your phone somewhere on the interweb.
ddare always there to help as long as you've root access.