How to mount Android device as USB mass storage instead of MTP? I accidentally removed my whole file system on my phone .I tried to recover my files with my linux pc using photorec program .but photorec only can detect directly connected devices to the system.my phone only makes connection with mtp and ptp.if i can mount my phone to my pc as a ums(usb mass storage) photorec will detect my device.so is there any way to mount my phone as ums?
phone OS
Android Lollipop 5.02
phone model
LG G3 Beat (a.k.a mini) D723tr
pc os
Linux mint rosa
Follow these Steps to mount your /data partition as Mass Storage:


Boot to recovery
mount | grep /data(note down the device file /dev/block/.....)
umount /data
find /sys -name lun*(Note down the url containing f_mass_storage
adb shell
su
cd /data/local/tmp
vim usb_mount.sh
Press i
echo 0 &gt; /sys/class/android_usb/android0/enable
echo [Previously noted down device file] &gt; [Previously noted down URL]/file
echo mass_storage &gt; /sys/class/android_usb/android0/functions
echo 1 &gt; /sys/class/android_usb/android0/enable
Write :wq and press enter
chmod 777 /data/local/tmp/usb_mount.sh
sh /data/local/tmp/usb_mount.sh


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

Comment if you face any issues.