Currently, TWRP backups don't include /data/media
, and this doesn't appear to be on the developers' radar at all (the issue for it over at GitHub is just a bunch of +1s with no official response). Now that we have SELinux to contend with, simply copying the files back and forth is apparently no longer an option, and there are a number of different ways to access /data/media
throughout the filesystem, each with different effective owners and permissions.
In excruciating detail, how should I approach backing up and restoring /data/media
so everything is restored exactly as it was and my apps don't have trouble with the resulting permissions?
/data/media
just an alias for/storage/emulated/0
? Permissions and ownership are always restored with Android .tar archives.dd
/data/media since it's recognized as a directory. I've not tried, but I think that you candd
/dev/block/platform/msm_sdcc.1/by-name/userdata, instead.dd
is surely a bad idea. It's even worse than TWRP & CWM's default backup method,tar
. In case you're very wealthy and bought a 128GB phone and you only stored a few files in it,dd
will still backup the whole partition, block by block, resulting in an image of 128GB in size. Also another serious problem is that you can'tdd
directly onto your computer, so you have to find another 128GB storage on your phone (SD card?) to hold the inage temporarily.dd
directly to the computer by means ofadb shell
, so that the final command becomesadb shell "dd if=partition" > out.img
.