Is There A Way To Clone An Android Installation?

Impact crater on phone displayWhen you accidentally drop your phone and it looks like on the picture on the left when you pick it up, your plans for the rest of the day are pretty much out the window. There are several options after such an accident one of them is to just get another device and start from scratch. This is what I did and spent the next 3 hours installing LineageOS and all apps and data from scratch again. Once done I thought I’d make the best out of the broken phone, which was still working, and see if I could have been faster (next time…) by just cloning the complete Android installation from one device to the other. This works great on the PC with Linux and I regularly do this to make sure I have a backup SSD with a working clone of my installation. After several hours and approaching the issue from several angles, I have to say that I came up empty handed.

Taking A Full Backup

Part of installing LineageOS is installing a TWRP recovery image that has the option to backup and restore an installation to an SD card. By default, however, it does not backup user data and also makes sure that without tweaking the backup’s directory name, the backup can only be installed to the same device it was taken from. It is possible to also back-up user data by renaming the media directory before the backup is made and then restoring it back to its original name before rebooting. And indeed, as long as the backup is restored on the same device, this approach works quite well. But restoring a backup to the same device is not what I was after.

Futile Restoration Attempts

To restore the backup on another identical device, lets call it ‘target device’,  the directory name of the backup has to be changed to the directory name that is generated on the target device. The target’s directory name for the backup can be determined by starting a TWRP backup on the target device, aborting it after a few seconds and then taking a look at the directory tree that was created. After renaming the directory tree of my original backup, TWRP on the target device gave me the option to restore the partitions backed up on the original device. After restoration I renamed the media directory back to its original name and rebooted with high expectations. Everything looked good for a few seconds but then the target device shut down and went back to the recovery image. I then renamed the media folder to see if there was something in there that was device specific but I was again kicked back to the bootloader at the end LineageOS’s boot process. I then wiped the data partition which made LineageOS boot correctly but then all apps and all data are gone and so this really defeats the purpose. I found one report on the web that somebody had this process working, but in my case with LineageOS 15 and two Samsung S9s, it’s definitely not working at all.

ADB Backup and Restore

So perhaps ‘adb backup‘ that backs-u and restores apps, data and configuration information over USB would come close to what I had in mind? Unfortunately, I came up empty handed as well. While I managed to get the app data on the target device, the app apks were never installed alongside. One could of course install the apps first and then apply the data backup, but that’s so far away from just applying a full backup to a target device that I’d rather just install everything from scratch. adb backup also has an option to save the complete data directory, but transferring 40 GB worth of data over USB-2 twice is far too slow to be practicable.


So in the end, it was an interesting experience, I learnt a bit in the process, but I’m still not closer to a simple full backup/restore procedure to quickly get an identical phone up and running when disaster strikes. If you have any ideas, please leave a comment!

2 thoughts on “Is There A Way To Clone An Android Installation?”

Comments are closed.