[Moto G4 Plus Guides, News, & Discussion] HeethJain21:
Part 2: Restore

Note: Make sure that you place only the partitions which you want to restore in Athene_Partitions(if its not there, create it and put all the partitions which you want to restore in that folder) folder in /sdcard directory. Its fine if you still run all the commands while restoring partitions, as it will just ignore the files which it didn't find.

If you are using TWRP to restore the partitions, make sure it Official TWRP only (Unofficial TWRP won't work because for some partitions it might reboot in between (It happened with me and I do not know which partitions are causing this (one of them is hw)) so just a warning)

Here are the commands

dd if=/sdcard/Athene_Partitions/build.prop of=/system/build.prop

dd if=/sdcard/Athene_Partitions/aboot.img of=/dev/block/bootdevice/by-name/aboot
dd if=/sdcard/Athene_Partitions/abootbak.img of=/dev/block/bootdevice/by-name/abootbak
dd if=/sdcard/Athene_Partitions/boot.img of=/dev/block/bootdevice/by-name/boot

dd if=/sdcard/Athene_Partitions/cid.img of=/dev/block/bootdevice/by-name/cid
dd if=/sdcard/Athene_Partitions/clogo.img of=/dev/block/bootdevice/by-name/clogo
dd if=/sdcard/Athene_Partitions/cmnlib.img of=/dev/block/bootdevice/by-name/cmnlib
dd if=/sdcard/Athene_Partitions/config.img of=/dev/block/bootdevice/by-name/config

dd if=/sdcard/Athene_Partitions/customize.img of=/dev/block/bootdevice/by-name/customize
dd if=/sdcard/Athene_Partitions/DDR.img of=/dev/block/bootdevice/by-name/DDR
dd if=/sdcard/Athene_Partitions/devcfg.img of=/dev/block/bootdevice/by-name/devcfg
dd if=/sdcard/Athene_Partitions/dip.img of=/dev/block/bootdevice/by-name/dip

dd if=/sdcard/Athene_Partitions/dsp.img of=/dev/block/bootdevice/by-name/dsp
dd if=/sdcard/Athene_Partitions/frp.img of=/dev/block/bootdevice/by-name/frp
dd if=/sdcard/Athene_Partitions/fsc.img of=/dev/block/bootdevice/by-name/fsc
dd if=/sdcard/Athene_Partitions/fsg.img of=/dev/block/bootdevice/by-name/fsg

dd if=/sdcard/Athene_Partitions/hw.img of=/dev/block/bootdevice/by-name/hw
dd if=/sdcard/Athene_Partitions/hyp.img of=/dev/block/bootdevice/by-name/hyp
dd if=/sdcard/Athene_Partitions/hypbak.img of=/dev/block/bootdevice/by-name/hypbak
dd if=/sdcard/Athene_Partitions/keymaster.img of=/dev/block/bootdevice/by-name/keymaster

dd if=/sdcard/Athene_Partitions/kpan.img of=/dev/block/bootdevice/by-name/kpan
dd if=/sdcard/Athene_Partitions/limits.img of=/dev/block/bootdevice/by-name/limits
dd if=/sdcard/Athene_Partitions/logo.img of=/dev/block/bootdevice/by-name/logo
dd if=/sdcard/Athene_Partitions/logs.img of=/dev/block/bootdevice/by-name/logs

dd if=/sdcard/Athene_Partitions/metadata.img of=/dev/block/bootdevice/by-name/metadata
dd if=/sdcard/Athene_Partitions/misc.img of=/dev/block/bootdevice/by-name/misc
dd if=/sdcard/Athene_Partitions/modem.img of=/dev/block/bootdevice/by-name/modem
dd if=/sdcard/Athene_Partitions/modemst1.img of=/dev/block/bootdevice/by-name/modemst1

dd if=/sdcard/Athene_Partitions/modemst2.img of=/dev/block/bootdevice/by-name/modemst2
dd if=/sdcard/Athene_Partitions/mota.img of=/dev/block/bootdevice/by-name/mota
dd if=/sdcard/Athene_Partitions/oem.img of=/dev/block/bootdevice/by-name/oem
dd if=/sdcard/Athene_Partitions/padC.img of=/dev/block/bootdevice/by-name/padC

dd if=/sdcard/Athene_Partitions/persist.img of=/dev/block/bootdevice/by-name/persist
dd if=/sdcard/Athene_Partitions/recovery.img of=/dev/block/bootdevice/by-name/recovery
dd if=/sdcard/Athene_Partitions/rpm.img of=/dev/block/bootdevice/by-name/rpm
dd if=/sdcard/Athene_Partitions/rpmbak.img of=/dev/block/bootdevice/by-name/rpmbak

dd if=/sdcard/Athene_Partitions/sbl1.img of=/dev/block/bootdevice/by-name/sbl1
dd if=/sdcard/Athene_Partitions/sbl1bak.img of=/dev/block/bootdevice/by-name/sbl1bak
dd if=/sdcard/Athene_Partitions/sec.img of=/dev/block/bootdevice/by-name/sec
dd if=/sdcard/Athene_Partitions/sp.img of=/dev/block/bootdevice/by-name/sp

dd if=/sdcard/Athene_Partitions/ssd.img of=/dev/block/bootdevice/by-name/ssd
dd if=/sdcard/Athene_Partitions/syscfg.img of=/dev/block/bootdevice/by-name/syscfg
dd if=/sdcard/Athene_Partitions/tz.img of=/dev/block/bootdevice/by-name/tz

dd if=/sdcard/Athene_Partitions/tzbak.img of=/dev/block/bootdevice/by-name/tzbak
dd if=/sdcard/Athene_Partitions/utags.img of=/dev/block/bootdevice/by-name/utags
dd if=/sdcard/Athene_Partitions/utagsBackup.img of=/dev/block/bootdevice/by-name/utagsBackup

Like earlier in Step 1, I have not included system, userdata and cache.

You can simply copy and paste them on the terminal and it will execute all of the commands simultaneously one after the other.

I am attaching a .bat file and a .txt file which will basically do the same thing as typing or copy-pasting the above commands.

Note: Restore-Partitions.bat and Restore-Partitions.txt should be saved together in adb and fastboot folder, otherwise the .bat file won't work.

I have created a TWRP flashable zip file which will do the same task as above. Make sure you flash it in Official TWRP only (Unofficial TWRP won't work because for some partitions it might reboot in between (It happened with me and I do not know which partitions are causing this (one of them is hw)) so just a warning).

Just like earlier, just place the partitions you want to restore in

Athene_Paritions

folder and the zip file will ignore the partitions which aren't present.

Downloads:

Link: https://www.androidfilehost.com/?fid=11410963190603873124

md5: cfd44f834b72342816c308e915791135

Also do note that some people who weren't able to flash hw.img after getting their device changed from Moto G4 Plus to Moto G4, the restoring part wouldn't work for you unless you skip restoring hw.img, but trying won't hurt.