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.
- You need to have beta version of TWRP recovery installed on your HTC One M9. Get it from here.
- 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):
- 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).
- 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.
- 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.
- 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.
- 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.
- 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.
- Do restore stock recovery too if you intend to take OTA updates after restoring stock system.
- 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:
- Power off your One M9.
- Press Power+Volume Up+Volume Down together until you boot into bootloader mode with white background.
- Highlight “BOOT TO RECOVERY MODE” using volume buttons.
- Select it using the Power button to boot into recovery mode.
- Once in TWRP recovery, tap on Backup.
- Make sure System is selected under ‘Select Partitions to Back Up’. Select other partitions you wish to back up.
- The, do the Swipe to Back Up to start backing up of stock system.
- 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:
- We’re talking about the stock system partition’s backup we did using the beta version of TWRP recovery as detailed above.
- 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.
- Backup should be in this particular format: system.emmc.win, because we need to flash it in fastboot mode.
- 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.
- We’re assuming you’ve got the HTC One M9 drivers and ADB drivers installed and properly working. if not, install them now.
- Disconnect your HTC One M9 from PC if connected.
- Boot One M9 into Fastboot/Download mode:
- Power Off your One M9.
- Press and hold both Volume Down+ Power button until you see download mode (black background).
- Connect the phone to PC now.
- Create a folder onem9r on C drive on your PC, and transfer the backup file, system.emmc.win, to this folder.
- Open command prompt (CMD) window.
- 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 126.96.36.199, 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.
- 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.
- When done, reboot One M9 by typing fastboot reboot and then hit enter key.
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.