19

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?

2
  • 4
    Check this universal thread: Making Dump of Android Partitions. Just backup the recovery.img from there
    – Gokul NC
    Dec 23, 2015 at 9:37
  • 1
    Why do you you think it won't be possible? Rashr, Flashify and dd are always there to help as long as you've root access.
    – Firelord
    Dec 23, 2015 at 11:51

3 Answers 3

10

EXTRACTING BOOT.IMG FROM STOCK ROM or OTHER IMG LIKE RECOVERY ETC.

REQUIREMENT:
1. Download adb required tools.
2. PC
3. Phone Drivers (for other phones google it out)
for spreadtrum phones: SCI-Usb-Jungo v4 (download here) or SCI-USB2Serial v1.5.6.1 (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
Source: http://howtorootcherrymobilesnap.weebly.com/adb/how-to-extract-img-files-via-adb-ex-bootimg

8
  • 3
    /proc/mtd is not universal. It's not there in all devices.. Change it :)
    – Gokul NC
    Dec 23, 2015 at 9:37
  • But works in many devices.
    – Vivek Ji
    Dec 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 NC
    Dec 23, 2015 at 11:17
  • 3
    And you conveniently didn't mention the original source. Please follow How to reference material written by others
    – Firelord
    Dec 23, 2015 at 11:48
  • 2
    While /proc/mtd may 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 dd will also work great for doing full backups over USB.
    – S0AndS0
    Nov 9, 2016 at 14:52
5

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 find and grep

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$)

Backup

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

Restore

Warning Data lost possible! Don't use until You understand all dd parameter.

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
3

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.

adb shell

su

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .