2

I have nothing against root except eFUSE. Whose ever idea eFUSE was . . .

As far as I understand:
Because of amateur users and clueless minimalists who don't know how to utilise tools that are intended for power users, the development team of TWRP has controversially decided that their NANDROID backup does not include /data/media.

More information and sources in these comments:
1. Best practice for backing up /data/media?
2. Best practice for backing up /data/media?

What I want is a block-level image backup of the entire phone, so that I can return to the exact spot later on.

I want that block-level backup to include the /data/media partition.

Now, I have found out it is possible via ADB, but that requires root. If there is really no other way, I would consider taking the risk of rooting the phone after doing any other possible backup method (adb app backup, file backup, etc.)

But my question is:

Is it technically possible to do a block-level (dd) backup of the /data/media partition without root?

Had the developement team of TWRP decided to include /data/media, pleasing power users and maximalists instead of minimalists and amateur users, would it actually have been possible without root?

8
  • 1
    First of all /data/media is not /dev/media. Former is a directory of userdata partition which is mounted at /data. So in a sense you want to backup the whole block device of userdata partition. That's possible without rooting your actual OS. But you need an unlocked bootloader to boot in TWRP. From there you can dd out any block device, even the whole flash memory chip. But why do you want a block level access? A simple tar of /sdcard is sufficient in most cases. Commented Apr 14, 2019 at 8:42
  • 1
    @IrfanLatif Block-level access means that it can be flashed back bit by bit to it's original state and the confidence that absolutely nothing is missing from the backup.
    – neverMind9
    Commented Apr 14, 2019 at 20:05
  • 1
    The first thing to do when buying an Android device is making sure the bootloader is unlocked. I'm looking at you, Google Nexus. (their locked bootloader has been troublesome to me at some point). Samsung fortunately usually ships without crippled bootloader.
    – neverMind9
    Commented Apr 14, 2019 at 20:25
  • 2
    Block level access is usually required when you have to deal with inodes or filesystem journal, such as to recover some deleted data or do some forensics. /sdcard (which exposes /data/media to us) is an emulated filesystem with a subset of filesystem features. E.g. you can't change permissions and SELinux context of files, those are fixed. So they even don't need to be backed up and restored. Filesystem attributes (such as immutable flag) are supported on /sdcard but can't be backed up with tar. Commented Apr 14, 2019 at 21:51
  • 2
    Extended attributes (and hence ACL's) are not supported (except security.selinux), but they don't matter a lot on Android. However if you are backing up and restoring /data/media directly (with root access), you should take care of file permissions and SELinux contexts. Tar supports backing up a lot of metadata; permissions (including owner and group), timestamps (including mtime, atime, ctime) and extended attributes (including ACLs, SELinux contexts and file capabilities). Interestingly, TWRP also creates tar backups of filesystems like /data, /system, /vendor etc. Commented Apr 14, 2019 at 21:57

1 Answer 1

2

Is it technically possible to do a block-level (dd) backup of a file? - Yes
Is it technically possible to do a block-level (dd) backup of a folder? - No

10
  • 1
    Also from /dev/block/mmcblk0?
    – neverMind9
    Commented Apr 14, 2019 at 21:24
  • 3
    @neverMind9 mmcblk0 is a block device file, which can be backed up by dding out (provided that you arrange to provide enough space for saving file). But that's unnecessary. If your device is no more bootable, you won't be able to restore that backup. So overwriting partitions related to bootloaders (like sbl, aboot etc.) and telephony (like modem) is never recommended. Normally you should backup (and restore) only filesystems (data, cache, system, vendor) and kernel (boot). But do keep backup of other partitions as well just to be on safe side. Commented Apr 14, 2019 at 23:13
  • 2
    But it is useless if device is encrypted. GNU tar is strongly recommended. at least we need a custom recovery, or rooted device for this. some stock recovery do full dd backup of whole data partition (chinese brands). some stock flash tools can make a full dump. adb backup has a -shared flag. but easiest "stock" way is just copy /storage/emulated/0 via MTP, the file permissions are not a big mystery for /data/media and can be ignored
    – alecxs
    Commented Apr 15, 2019 at 8:15
  • 2
    Android encryption is hardware-bound (Arm TrustZone). userdata can only decrypted on the source phone itself. EFS (or METADATA) partition is wiped on each userdata format (thats where encrypted key is stored) - encrypted backup becomes useless
    – alecxs
    Commented Apr 15, 2019 at 23:44
  • 1
    @alecxs What a headache.
    – neverMind9
    Commented Apr 16, 2019 at 20:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .