Here are a couple of scripts to backup and restore the device IMEI. They won't help with a lost IMEI. Use them to backup your pds partition that store all the device specific data just in case they are lost. They should also be compatible with any device that has the same partitioning as our Moto G (eg Moto X).
- Device has to be rooted, with USB debugging enabled.
- Motorola fastboot (see attachment).
- ADB installed, minimal or the full ADK.
You can search the forum to find how to meet these requirements or for the terms described in this post beginning here:
Extract imei_scripts.zip (attached) and copy the scripts "imei_backup.bat" and "imei_flash.bat" into the ADB root directory.
Extract mfastboot_only.zip (attached) and copy "mfastboot.exe" into the ADB root directory.
Description/How to use:
These are batch scripts and can be run by double-clicking them or opening a command window from the ADB root. Help is also contained in the scripts. They are run interactively and won't execute anything without the user selecting a choice.
Use this script to backup and restore normally using ADB.
Use this script to flash the partition as an alternative to the other method using mfastboot while in bootloader mode. The backup, "pds.img" must be located in the ADB directory for the script to run.
The backup is made on the sdcard and is named "pds.img". You'll want to store this elsewhere once backed up. Once done, that's it! You don't need to do anything more. The purpose is as a preventative in the event of the loss of your IMEI.
Run the scripts for additional options and help.
The contents of "imei_backup.bat" (use this script to backup and restore IMEI):
The contents of "imei_flash.bat" (alternative to restore IMEI using mfastboot):
I've tried to make the scripts foolproof, but in the event that you lose data or they corrupt/break your phone, I won't be held responsible. That is, use only at your own risk!