1

I accidentally removed my whole file system on my LG G3 Beat (a.k.a mini) D723tr running Android 5.0.2 Lollipop. I tried to recover my files with my Linux Mint (Rosa) PC using PhotoRec program, but PhotoRec can only detect directly connected devices to the system. My phone only makes connections with MTP and PTP. If I can mount my phone to my PC as a UMS (USB mass storage), PhotoRec will detect my device.

Is there any way to mount my phone as UMS?

Andrew T.
  • 15,988
  • 10
  • 74
  • 123
Huloo
  • 11
  • 2

1 Answers1

1

Follow these steps to mount your /data partition as Mass Storage:

  1. Boot to recovery
  2. mount | grep /data
    (Note down the device file /dev/block/...)
  3. umount /data
  4. find /sys -name lun*
    (Note down the URL containing f_mass_storage)
  5. adb shell
  6. su
  7. cd /data/local/tmp
  8. vim usb_mount.sh
  9. Press "i" key to enter Insert Mode
  10. echo 0 > /sys/class/android_usb/android0/enable
    echo [Previously noted down device file] > [Previously noted down URL]/file
    echo mass_storage > /sys/class/android_usb/android0/functions
    echo 1 > /sys/class/android_usb/android0/enable
    
  11. Press "Escape" key to go back to Command Mode
  12. Write :wq and press Enter to save and quit
  13. chmod 777 /data/local/tmp/usb_mount.sh
  14. sh /data/local/tmp/usb_mount.sh

This should disconnect and reconnect your device as USB Mass Storage.

Andrew T.
  • 15,988
  • 10
  • 74
  • 123
Anupam Basak
  • 173
  • 1
  • 7
  • I have a question... from where did that script at point 8 pop up? – Grimoire Aug 25 '16 at 14:58
  • 2
    @DeathMaskSalesman That's not an existing script, he's creating that script using vim, then then at step 9, enters input mode and at step 10, enters the contents of the script . At step 11, he saves(writes) the file and quits vim. (Check the vim Documentation if you're not clear.) Well yeah, that would have been comfortable to read if the answerer has included all these with the explanations in the same point. – Gokul NC Aug 25 '16 at 16:09
  • 1
    @GokulNC Good explanation.. Go ahead and edit my answer.. – Anupam Basak Aug 25 '16 at 16:35