5

I would like to backup and restore manually all partitions. I know this is not the first time this issue has been raised. There are already many links and questions on this issue, and I have reviewed most of them probably.

The suggested answers are divided to the following:

  1. Root the device, install appropriate recovery tool (nexus root toolkit, TWRP or clockworkmod recovery), and boot into recovery, then do the backup from the tool.

  2. Other solution suggest to use "dd command" but only for boot partitions, not all partitions. I'm not sure why. for example the follwing page warns not to use dd on system partition: http://www.addictivetips.com/mobile/how-to-backup-your-android-phones-boot-recovery-and-system-partition-images/

I wonder how the suggested tools are capable of backup all partitions. If "dd command" is not used, what is the way to manually backup all partitions (which is probably the way these tools do backup in source code) ?

3
  • You can pull using dd or cat other partitions as well. All you need is a custom recovery or root access (adbd as root is better). To restore, you need to push the image back. I've done that on recovery, boot, system and frp partition. – Firelord May 10 '16 at 14:26
  • the link above with the warnings not to copy other partitions make any sense to you ? – ransh May 10 '16 at 14:52
  • The article is from 2010 and seems to be relevant to MTD based device (because that's what it has been tested upon). I should've been explicit in my last comment that I tested upon an eMMC based device (Nexus 6). Related: github.com/ameer1234567890/OnlineNandroid/wiki/… – Firelord May 10 '16 at 14:58
1

The reason for warning regarding backup is, that dd just copies block wise everything, not caring about content. It clones the partition. Of course you can use dd also for backup the /system or /data partitions in recovery mode.

But in normal mode you should not use dd for mounted partitions, because content may change during progress (Android is running) and you probably get inconsistent/unreadable result. Unmount the partition first.

Another way is to create a tarball archive. That is what nandroid backup does. But with the same warning - better to do this "offline" in recovery mode, and not in normal mode.

4
  • Ext4 handles such problems quite well. Of course a hot-cloned ext4 requires an e2fsck, but I never found any serious problems with it. I use that even in prod-critical environment - but only to extend filesystem-level backups. – peterh Dec 25 '20 at 19:41
  • In a server environment, you can also make an LVM snapshot from the partition, and then clone that snapshot. If the filesystem is journaled, so you reach a pretty consistent, snapshot-like atomic copy. Unfortunately, I've never seen LVM on Android. – peterh Dec 25 '20 at 19:44
  • You are lucky that you could root your Android. It is such a huge pain that it imho endangers even the free software movement on the longterm. You write good posts, but... if you search for any android, the results are mostly VLQ. This is imho a huge problem of the Android. I think if the Android SE would be an exception, the result could become influental. Particularly with the x??-developers I am very unsatisfied, most of the content there, well, is hardly decodable. Check this. – peterh Dec 25 '20 at 20:56
  • 1
    Okay! Herzliche Glückwünschen für den Junge. :-) – peterh Dec 25 '20 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.