Friday, 28 April 2023

 

ACCESS ANDROID FILES FROM LINUX TERMINAL



First, hook up the cable.


To find out what is going on, use the command cd /dev/disk/by-id/; ls


-al. There will be,many



 lines of output. With any luck, you will see a line like this:

lrwxrwxrwx 1 root root   9 Mar 26 14:22 usb-HTC_Android_Phone_SH16MT501921-0:0 -> ../../sdc

lrwxrwxrwx 1 root root  10 Mar 26 14:22 usb-HTC_Android_Phone_SH16MT501921-0:0-part1 -> ../../sdc1

The foregoing means that 

the phone is in disk-drive mode (not charge-only mode) and is ready to mount.

In contrast, if you see something like the following, it means the phone is in 

charge-only mode (not disk-drive mode).

lrwxrwxrwx 1 root root   9 Mar 26 08:36 usb-HTC_Android_Phone_SH16MT501921-0:0 -> ../../sdc

To change modes, touch the bar at the very top of the phone, then drag 

it down. There should be an item with a pitchfork-shaped USB icon. Tap on that 

item, and select the desired mode.

Once

 you have the phone in disk-drive mode, create a mountpoint install -d /mn

t/Phone 

and then mount the device mount /dev/sdc1 /mnt/phone.

You know the   

Correct Device 

based on the output of the ls command, above. In our example, the device is

/dev/sdc1.

You can make the thing even easier for next time

if you fix up your /etc/fstab. First, find the UUID ass

ociated with your SD card.

 cd /dev/disk/by-uuid/

  ls -al | grep sdc1

lrwxrwxrwx 1 root root  10 Mar 26 14:22 6163-3439 -> ../../sdc1

Then add the following line to your /etc/fstab:

UUID=6163-3439          /mnt/phone   vfat   user,noauto 0 0

From now on, all you have to do is hook up the phone, put it into disk-drive mode,

And then type mount /mnt/phone.

Whenever you want to unmount it, the command is umount /mnt/phone ... 

and you should always unmount it before unplugging the cable.









No comments:

Post a Comment