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/mediajust an alias for/storage/emulated/0? Permissions and ownership are always restored with Android .tar archives. – Aaron Gillion Mar 18 '16 at 07:25dd/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. – Grimoire Mar 18 '16 at 14:19ddis 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,ddwill still backup the whole partition, block by block, resulting in an image of 128GB in size. Also another serious problem is that you can'tdddirectly onto your computer, so you have to find another 128GB storage on your phone (SD card?) to hold the inage temporarily. – iBug Jan 22 '17 at 00:48dddirectly to the computer by means ofadb shell, so that the final command becomesadb shell "dd if=partition" > out.img. – Grimoire Jan 22 '17 at 01:19ddfrom/dev/block. As often occurs,adbd cannot run as root in production builds. I just tested it out. However you can still do it in recovery but what's the point in doing so? – iBug Jan 22 '17 at 03:13taris still a better choice thandd. Also there hasn't been a solution to the storage problem discussed fordd's output image. I vote fortar. – iBug Jan 22 '17 at 15:58