I'm trying to recover accidentally deleted video from HUAWEI P10. I use Ubuntu so I tried to recover it using photorec.

The problem is that I can't see mobile internal storage or SD card storage in the list:enter image description here

First row is a HDD, second row is SSD, third is external HDD and the fourth is I don't know what but not any of the mobile storages.

The last row is present only when mobile is connected to the PC.

The mobile is connected to the PC through USB cable and I've set transfer files option. Same result with Transfer photos.

enter image description here

Do you know what to do?


Connecting to PC through USB (MTP) doesn't expose underlying filesystem (ext4 or f2fs) of internal storage (/data partition) to PC. But recovery programs need direct access to filesystem i.e. block level access and won't work with MTP (Transfer Files) which is just a client-server type protocol for data transfer.

You need USB Mass Storage (UMS) which is disabled on newer Android versions by default. So you need root access or at least custom recovery to enable UMS:

# mountpoint /data && umount /data

# echo '0' >/sys/class/android_usb/android0/enable
# echo '/dev/block/bootdevice/by-name/userdata' >/sys/class/android_usb/android0/f_mass_storage/lun/file
# echo 'mass_storage' >/sys/class/android_usb/android0/functions
# echo '1' >/sys/class/android_usb/android0/enable

* Kernel should be built with CONFIG_USB_F_MASS_STORAGE and CONFIG_USB_G_ANDROID. For devices built with CONFIG_USB_CONFIGFS_MASS_STORAGE /config interfaces are to be used in place of /sys.
* Paths may vary depending on device
* If your /data partition is FDE encrypted and you unencrypted it in recovery, path will be dev/block/dm-0

Now /data will appear as a partition on Linux PC which you can mount (preferably read-only to avoid overwriting data). However recovery tools including extundelete mostly don't need mounting filesystems.

If you have custom recovery, another option is to dd out an image of /data partition to external SD card and then mount it on Linux PC as a loop file:

# umount /data
# dd if=/dev/block/bootdevice/by-name/userdata of=/external_sd/data.img

Same is also achievable using adb exec-out.

To make sure your data is recoverable, see this answer.


| improve this answer | |

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.