How To Backup Your Android Phone’s Boot, Recovery And System Partition Images -- RomDump

9304 ワード

One can’t stress enough on the importance of backups and when it comes to tinkering with your Android phone, a backup of your system, recovery and boot partitions can save you a lot of hassle that you might otherwise have to go through if you mess things up and need those stock images. In this guide, we will tell you how to take these backups using a free tool called RomDump.
Although you can find these backups on the internet, those have been taken by other users and you never know if they have been modified to contain malicious code or not. Secondly, you can’t be too sure if they would work with the exact specifications of your phone or not, as even for the same phone model, there can be differences depending on the phone’s regions, intended carriers and other similar factors, and flashing a wrong boot, system or recovery image to your phone can most likely brick it. Therefore, it is always a great idea to take backup images of these partitions of your device yourself before you attempt to modify them, so that they can be recovered later if anything goes wrong.
 
RomDump is a free tool that lets you do just that. It is quite easy to use for anyone who is comfortable with typing a few commands, and effectively creates backup images of your Android phone’s boot, recovery and system partitions. It requires your phone to be rooted first and you will either need ADB installed on your computer or a terminal application installed on your Android device.
Now that we have had an overview, let’s proceed to actually getting things done.
Before you proceed:
  • Make sure that your device is rooted. If it isn’t, do a quick search on our site for “root phone_name” without the quotes, replacing ‘phone_name’ with the name of your device. You will find an easy to follow guide on rooting your phone.
  • In case you are using the ADB method, make sure you have ADB installed on your computer. If it isn’t, refer to our guide on  what is ADB and how to set it up on your computer .
  • On the other hand, if you are going to use a terminal application, download and install Android Terminal Emulator which is available for free in the Android Market.

  • Now proceed according to the method that you chose.
    ADB Method:
  • Download RomDump from the link given below, extract the file named ‘install’ from the downloaded zip archive to your computer and copy it to the ‘tools’ folder of your Android SDK installation folder.
  • Connect your phone to your computer via USB and make sure USB debugging mode is enabled in Settings >> Applications >> Development.
  • Open a command prompt window and enter the following commands:
    adb push install /data/local/
    adb shell chmod 04755 /data/local/install
    adb shell /data/local/install

  • You might see some output of the above command. Wait until it finishes.
  • Enable and then disable Wi-Fi on your Android phone. If it was already enabled, disable, enable and then disable it again.
  • Type this command in the command prompt window on your computer:
    adb shell romdump

     
  • Wait patiently for the process to finish and you’re done. You may now exit the command prompt.

  • Terminal Method: 
  • Download RomDump from the link given below, extract the file named ‘install’ from the downloaded zip archive to your computer and copy it to the root of your phone’s storage card.
  • Launch Android Terminal Emulator (or any other terminal app of your choice) on your Android phone and enter these commands:
    su
    
    cat /sdcard/install >/data/local/install
    chmod 04755 /data/local/install
    /data/local/install

  • You will see some output of the above command. Wait till the output finishes.
  • After this last line has appeared, enable and then disable Wi-Fi on your phone. If it was already enabled, disable, enable and then disable it again.
  • Type this command in Terminal Emulator:
    /system/bin/romdump

     
  • Wait patiently till the process finishes and you’re done. You may now exit Terminal Emulator.

  • If you have completed the above steps for any of the two methods successfully, you will find a folder named ‘romdump’ on the root of your SD card that contains a subfolder by the name of your device model. This folder will contain the boot, system and recovery partition images.
    Alternative Method If The Above Does Not Work:
    If this method does not work for you and all you need to backup is your recovery and boot images, you can simply do so as follows.
    Note: Do NOT attempt to backup the system partition using this method as the system image it produces this way will NOT be a valid system image to be used later to restore your system partition. Use it only for the recovery and boot partition images.
  • If you are using ADB, connect your device to your computer via USB, launch a command prompt window on your computer and enter the following command:
    adb shell

    If you are using Terminal Emulator instead, just launch it on your Android phone and enter the following command and agree to grant any permissions you’re prompted for:
    su

      The remaining process will be the same for both ADB and Terminal Emulator.
  • Enter the following command:
    cat proc/mtd

    /proc/mtd: No such file or directory

    That doesn't exist on your device.
    It doesn't on my Vibrant either, though I can get somewhat similar info via 

    cat /proc/partitions

  • You will get an output similar to this. Note that your result may differ from this one and you must proceed according to the output that you get, rather than the example that you see here.
    dev:    size   erasesize  name
    mtd0: 000a0000 00020000 "misc"
    mtd1: 00480000 00020000 "recovery"
    mtd2: 00300000 00020000 "boot"
    mtd3: 0fa00000 00020000 "system"
    mtd4: 02800000 00020000 "cache"
    mtd5: 093a0000 00020000 "userdata"

     

  • To dump the recovery image to your SD card, make note of the first word of the line which says “recovery” in the end. It is ‘mtd1’ in case of this example but may be another entry for you. Now use this command, replacing ‘mtd1’ with the term that applies in your case, if different:
    dd if=/dev/mtd/mtd1 of=/sdcard/recovery.img bs=4096

     

  • Similarly, to dump the boot image to your SD card, make note of the first word of the line which says “boot” in the end, which is ‘mtd2’ in our case but may differ for you. Use this command now, replacing ‘mtd2’ with the term that is applicable in your case, if different:
    dd if=/dev/mtd/mtd2 of=/sdcard/boot.img bs=4096

     

  • That’s it – you now have recovery.img and boot.img backed up on the root of your SD card.