0

I am using an Android One phone with rooted Android 5.1 and the Online Nandroid Backup application to do live (o)nandroid backups. I am also using the built-in encryption, which encrypts the /data partition, but as the backup is performed on a live running system, the resulting data.img is unencrypted as I've verified with Nandroid Manager being able to extract data without asking for a password. Apparently it is not doing a block-level copy of the /data.

As the backed-up system in the system.img expects encrypted /data and the restored /data is now unencrypted, my question is if the resulting backup can be restored and booted without any problems, using fastboot for example? Will Android hang while booting if the /data partition is decrypted and the system is not factory reset? What is the correct way to perform a live backup of an encrypted Android 5.1 system?

  • "restored /data is now unencrypted" -- no, this in incorrect. The encryption and decryption happens on-the-fly. It simply means that data is first encrypted and then written into the disk. It also means that data is first decrypted and then is passed to the apps or anything which requested a read. There is no problem here to begin with. – Firelord Mar 20 '16 at 18:43
  • @Firelord So if I buy another phone alike and restore only the /data partition with fastboot, where exactly (you didn't oppose the fact that the resulting backup data.img is unencrypted) it is stated that the /data partition should be encrypted during restore? Using which password? – drws Apr 1 '16 at 8:01
1

I looked at the onandroid script and it seems that it does a block-level copy of the data with dd only for partitions that are not mounted during the normal system operation (such as recovery partition) and copies the files on the filesystem level from the mounted ones - meaning it copies the decrypted content of the data partition and others and creates a backup images out of it. Further testing would be needed to determine what happens after a recovery is made from a system image (expecting encrypted data) and non-encrypted data image.

It seems that onandroid is "best effort" software (I didn't see any mount -o remount,ro / before copying the contents of the partition - it would probably also affect the running system possibly crashing it) and is therefore best not to use it with encrypted devices. The proper way to handle them still remains encryption-supporting recovery such as TWRP (or dumping the partitions via adb pull while in ADB-supporting recovery). I would be happy to be proven wrong by someone who knows the onandroid script in greater depth.

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.