HTC One M9 TWRP Recovery Issue: How to backup and restore stock system [Fix]

Page content:

Because of HTC employing the block based system for OTA updates, the job for developers as regards providing the custom recovery has got little harder. You cannot simply mount the system as read-write because it breaks the device’s compatibility with OTA updates, and traditional escape route of disabling the check from within the OTA update doesn’t come to the rescue either this time around. Hence, even if you’ve unlocked One M9 bootloader and have the TWRP recovery installed alright, you’ll find some things broken, including backing up of stock system, a must when you want to grab an OTA update later on.

Imp: So, once again, you need stock system backed up to be able to update phone using HTC OTA updates, along with stock recovery.

Thankfully, TWRP team is hard at work and has already come with a fix, which is yet to make it to stable builds of the TWRP recovery but is available under beta version of TWRP, of which we’ve shared links below.

The beta version of the TWRP recovery for HTC One M9 allows you to take full system backup, which is flashable via fastboot when you decide to restore it back. Yes, it’s not restore-able directly via TWRP, but that’s actually fine as far as this developers got this to working at least.

How to back up stock system partition on HTC One M9 using TWRP recovery

Backing up the system is actually easy. But you need to take care of some things. And that’s a must. Like the status of system, whether it’s read-only or read-write, and then some other things. So, let’s first see what is required of your One M9 and TWRP recovery.

  1. You need to have beta version of TWRP recovery installed on your HTC One M9. Get it from here.
  2. System needs to be set as read-only. It is so by default, so unless you changed it, you are safe when you’re on beta version of TWRP recovery. Some noteworthy points (once you’ve got the beta TWRP installed from link in point 1 above):
    1. Under mount menu, system will not show up, because it’s set to read-only by default. Don’t worry though, it’s available for the backup until you set it to read-write (possible via particular adb command).
    2. You must not have altered the system’s mount status. By default, under beta version TWRP, it’s set to read-only as a fix to various problems, mainly to allow you to back up the stock system image.
    3. If you mount the system as read-write after installing the beta version of TWRP, intentionally or not, you’re in trouble and you cannot back up the stock system partition.
    4. Once you change the system to read-write, there is no going back. You cannot back up stock system now. You’ll need to flash the firmware using HTC’s RUU for your particular model. Then flash the beta TWRP and take stock system backup. You cannot simply change it to read-only to support system backup.
    5. Hence, be sure to back up the stock system before changing mounting the system as read-write, which you may require for variety of reasons.
    6. Once you’ve got the stock system backup, you can mount the system as read-write, as restoring the system doesn’t really depend on system’s mount status and is done via fastboot.
    7. Do restore stock recovery too if you intend to take OTA updates after restoring stock system.
  3. When you satisfy both of the above conditions, namely installation of a beta TWRP recovery, and second, that its read-only mount status remains unaltered by you, you can simply back up the stock system image using usual backup option in the recovery which will create the nandroid backup of your whole stock system. Do this:
    1. Power off your One M9.
    2. Press Power+Volume Up+Volume Down together until you boot into bootloader mode with white background.
    3. Highlight “BOOT TO RECOVERY MODE” using volume buttons.
    4. Select it using the Power button to boot into recovery mode.
    5. Once in TWRP recovery, tap on Backup.
    6. Make sure System is selected under ‘Select Partitions to Back Up’. Select other partitions you wish to back up.
    7. The, do the Swipe to Back Up to start backing up of stock system.
    8. Once that is done, be sure to copy the backup in system.emmc.win format to PC. So that you have a backup separately from phone. Also, because system can be restored only using fastboot command, you need it on PC anyway.

That’s it. You have successfully backed up the stock system of your HTC One M9. Let’s see how to restore it, because it’s completely fixed by the TWRP team, it remains a tricky thing to do.

 

How to restore stock system partition on HTC One M9

Please make sure you fulfill the following requirements:

  1. We’re talking about the stock system partition’s backup we did using the beta version of TWRP recovery as detailed above.
  2. You need to have the stock system on your PC. Go to TWRP folder of your One M9, and look into folders inside the BACKUPS folder there, and copy the backup of stock system to PC.
  3. Backup should be in this particular format: system.emmc.win, because we need to flash it in fastboot mode.
  4. Once you have got the system.emmc.win file on your PC proceed to restore process.

Now, follow the guide below to restore stock system partition.

  1. We’re assuming you’ve got the HTC One M9 drivers and ADB drivers installed and properly working. if not, install them now.
  2. Disconnect your HTC One M9 from PC if connected.
  3. Boot One M9 into Fastboot/Download mode:
    1. Power Off your One M9.
    2. Press and hold both Volume Down+ Power button until you see download mode (black background).
  4. Connect the phone to PC now.
  5. Create a folder onem9r on C drive on your PC, and transfer the backup file, system.emmc.win, to this folder.
  6. Open command prompt (CMD) window.
  7. Optional: It’s better to have stock recovery installed before restoring system. Or at least the beta version of TWRP recovery. If you’ve flashed a TWRP recovery prior to 2.8.6.0, then it will mount the system as read-write, and you’ll not be able to take OTA updates, even after restoring the stock system using this guide. With stock recovery, you take OTA after doing step 8 below. And if you have beta version of TWRP recovery, your system will remain in good shape after doing the step 8 and 9 below, as only earlier version of TWRP recovery causes problems with OTA.
  8. In CMD, type fastboot flash system C:onem9rsystem.emmc.win and then hit enter key. This will remove the current system with the stock system partition you had backed up.
  9. When done, reboot One M9 by typing fastboot reboot and then hit enter key.

That’s it.

Btw, what if you’re screwed already?

If you have already used an older TWRP recovery, and the system’s mount status is no longer read-only, that is has changed to read-write, you are not in luck.

Now, you need to find the firmware RUU file for your particular One M9 model carefully, and restore the phone using that, which will remove everything you’ve got on the phone, including your apps, custom recovery and custom ROM, if any.

4 Comment

  1. Derek Elphick says: Reply

    Would’ve been nice to learn about this earlier….anyway, I’ve flashed twrp-2.8.6.1-hima.img, and did a complete back up and now have a back up with heaps of files none of which are system.emmc.win

    I’ve got

    boot.emmc.win
    boot.emmc.win.md5
    data.ext4.000…..etc etc The only system ones I have are
    system.ext.win000
    system.ext.win000.md5
    system.ext.win001
    system.ext.win001.md5
    system.extwin002
    system.extwin002.md5

    Can I restore from this? How is the system saved as emmc?
    I hate this phone….thinking about going back to my Galaxy S4 as it’s so much easier to deal with.

    BTW I did all this prior to learning of the problems. I tried to do a restore as the rom I’m using is making the phone constantly switch off. I get the message “cannot restore system–mounted read only” I always thought TWRP was for recovery….not much help now is it.

    Any advice would be greatly appreciated.

    1. Kapil says: Reply

      v2.8.6.1 is the best version right now. Restore should be done from TWRP only automatically without you needing to do anything. Have you tried restoring from TWRP? Be sure to keep “Mount system as read-only” option checked under the Mount option.
      Let me know.

      1. Derek Elphick says: Reply

        Thanks for your reply….I have installed another custom rom, Lee droid and it is working fine. The problem I was having was because I didn’t have S off. Really not happy with HTC. Thanks again Kapil.

    2. Orllarwhalley says: Reply

      Please can i have the twrp backup for the htc m9. I need it so badly.i hate this AT&T OS I got.

Leave a Reply