User:Ogopog

Jump to: navigation, search

WIP!

Recover Files from an (rooted) Android Device

Install adb, TestDisk and PhotoRec:

# zypper install android-tools testdisk photorec

Install BusyBox on your device.

Attach your device to the computer via the USB cable, with USB debugging enabled

Check if device is connected:

$ adb devices
List of devices attached
BV6800Pro006871 device

Enter adb shell

$ adb shell
BV6800Pro:/ $ 

To provide adb root access to the device:

$ su
BV6800Pro:/ $ su
Permission denied 
  • For devices with ROM that have Developer Options -> Root access, choose "ADB only" to provide adb root access to the device.
  • If rooted with Magisk in Settings screen switch from "Apps and ADB" to "ADB only".
Magisk v18.0
BV6800Pro:/ $ su
BV6800Pro:/ $


$ ls /dev/block
dm-0   loop4   mmcblk0       mmcblk0p11  mmcblk0p16  mmcblk0p20  mmcblk0p25  mmcblk0p3   mmcblk0p5  mmcblk0rpmb  
loop0  loop5   mmcblk0boot0  mmcblk0p12  mmcblk0p17  mmcblk0p21  mmcblk0p26  mmcblk0p30  mmcblk0p6  platform     
loop1  loop6   mmcblk0boot1  mmcblk0p13  mmcblk0p18  mmcblk0p22  mmcblk0p27  mmcblk0p31  mmcblk0p7  vold         
loop2  loop64  mmcblk0p1     mmcblk0p14  mmcblk0p19  mmcblk0p23  mmcblk0p28  mmcblk0p32  mmcblk0p8  zram0        
loop3  loop7   mmcblk0p10    mmcblk0p15  mmcblk0p2   mmcblk0p24  mmcblk0p29  mmcblk0p4   mmcblk0p9

To dump the whole storage content of /dev/block/mmcblk0 to the computer:

$ cat /dev/block/mmcblk0 > mmcblk0.img

or

$ mount
rootfs on / type rootfs (ro,seclabel)
tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600)
proc on /proc type proc (rw,relatime,gid=3009,hidepid=2)
sysfs on /sys type sysfs (rw,seclabel,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
/dev/block/mmcblk0p28 on /system type ext4 (ro,seclabel,relatime,data=ordered)
/dev/block/mmcblk0p27 on /vendor type ext4 (ro,seclabel,relatime,data=ordered)
debugfs on /sys/kernel/debug type debugfs (rw,seclabel,relatime)
none on /acct type cgroup (rw,relatime,cpuacct)
tmpfs on /mnt type tmpfs (rw,seclabel,relatime,mode=755,gid=1000)
none on /config type configfs (rw,relatime)
none on /dev/cpuctl type cgroup (rw,relatime,cpu)
pstore on /sys/fs/pstore type pstore (rw,seclabel,relatime)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,seclabel,relatime)
/dev/block/mmcblk0p29 on /cache type ext4 (rw,seclabel,nosuid,nodev,noatime,discard,noauto_da_alloc,data=ordered)
/dev/block/mmcblk0p8 on /protect_f type ext4 (rw,seclabel,nosuid,nodev,noatime,nodelalloc,noauto_da_alloc,commit=1,data=ordered)
/dev/block/mmcblk0p9 on /protect_s type ext4 (rw,seclabel,nosuid,nodev,noatime,nodelalloc,noauto_da_alloc,commit=1,data=ordered)
/dev/block/mmcblk0p6 on /nvdata type ext4 (rw,seclabel,nosuid,nodev,noatime,discard,noauto_da_alloc,data=ordered)
adb on /dev/usb-ffs/adb type functionfs (rw,relatime)
tmpfs on /storage type tmpfs (rw,seclabel,relatime,mode=755,gid=1000)
/dev/block/dm-0 on /data type ext4 (rw,seclabel,nosuid,nodev,noatime,noauto_da_alloc,resuid=10010,data=ordered)
tmpfs on /sbin type tmpfs (rw,seclabel,relatime)
/dev/block/mmcblk0p28 on /sbin/.magisk/mirror/system type ext4 (ro,seclabel,relatime,data=ordered)
/dev/block/mmcblk0p27 on /sbin/.magisk/mirror/vendor type ext4 (ro,seclabel,relatime,data=ordered)
/dev/block/dm-0 on /sbin/.magisk/mirror/bin type ext4 (rw,seclabel,nosuid,nodev,noatime,noauto_da_alloc,resuid=10010,data=ordered)
/sbin/.magisk/block/loop08 on /sbin/.magisk/img type ext4 (rw,seclabel,noatime,data=ordered)
/sbin/.magisk/block/loop08 on /system/etc/hosts type ext4 (rw,seclabel,noatime,data=ordered)
/data/media on /mnt/runtime/default/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6)
/data/media on /storage/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6)
/data/media on /mnt/runtime/read/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=23)
/data/media on /mnt/runtime/write/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7)


$ exit
$ exit
$ exit